From 5b926cc10273f2acf69aaf9cc1e74233160e8b65 Mon Sep 17 00:00:00 2001 From: Jeroen Jacobs Date: Fri, 17 Nov 2017 12:19:18 +0100 Subject: [PATCH 01/21] Adding a user in a specified organisation uses the admin API --- docs/sources/http_api/org.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/sources/http_api/org.md b/docs/sources/http_api/org.md index 4c1dff904c8..2afac49a7ce 100644 --- a/docs/sources/http_api/org.md +++ b/docs/sources/http_api/org.md @@ -380,6 +380,8 @@ Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk "role":"Viewer" } ``` +Note: The api will only work when you pass the admin name and password +to the request http url, like http://admin:admin@localhost:3000/api/orgs/1/users **Example Response**: @@ -436,4 +438,4 @@ HTTP/1.1 200 Content-Type: application/json {"message":"User removed from organization"} -``` \ No newline at end of file +``` From 8ed79d614b1a39ca6b32d01245f1ad537ea99ccd Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Tue, 8 May 2018 09:26:28 +0200 Subject: [PATCH 02/21] decrease length of auth_id column in user_auth table certain mysql versions don't support having indices with a greater varchar length than 190. --- pkg/services/sqlstore/migrations/user_auth_mig.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/services/sqlstore/migrations/user_auth_mig.go b/pkg/services/sqlstore/migrations/user_auth_mig.go index be4d112f6f6..953883376c3 100644 --- a/pkg/services/sqlstore/migrations/user_auth_mig.go +++ b/pkg/services/sqlstore/migrations/user_auth_mig.go @@ -22,8 +22,8 @@ func addUserAuthMigrations(mg *Migrator) { // add indices addTableIndicesMigrations(mg, "v1", userAuthV1) - mg.AddMigration("alter user_auth.auth_id to length 255", new(RawSqlMigration). + mg.AddMigration("alter user_auth.auth_id to length 190", new(RawSqlMigration). Sqlite("SELECT 0 WHERE 0;"). - Postgres("ALTER TABLE user_auth ALTER COLUMN auth_id TYPE VARCHAR(255);"). - Mysql("ALTER TABLE user_auth MODIFY auth_id VARCHAR(255);")) + Postgres("ALTER TABLE user_auth ALTER COLUMN auth_id TYPE VARCHAR(190);"). + Mysql("ALTER TABLE user_auth MODIFY auth_id VARCHAR(190);")) } From 869d8e6f0ec6e2ffd9c667d0ef9eacc5ea8352b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 8 May 2018 12:50:39 +0200 Subject: [PATCH 03/21] fix: ldap unit test --- pkg/login/ldap_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/login/ldap_test.go b/pkg/login/ldap_test.go index 22959cb7e7f..34932926406 100644 --- a/pkg/login/ldap_test.go +++ b/pkg/login/ldap_test.go @@ -62,7 +62,7 @@ func TestLdapAuther(t *testing.T) { sc.userQueryReturns(user1) - result, err := ldapAuther.GetGrafanaUserFor(&LdapUserInfo{MemberOf: []string{"CN=users"}}) + result, err := ldapAuther.GetGrafanaUserFor(nil, &LdapUserInfo{MemberOf: []string{"CN=users"}}) So(err, ShouldBeNil) So(result, ShouldEqual, user1) }) From bdb736a9ee367a88ebd3d09adcc134621f37a99d Mon Sep 17 00:00:00 2001 From: Thibaut Patel Date: Tue, 8 May 2018 13:54:00 +0200 Subject: [PATCH 04/21] http_server: All files in public/build have now a huge max-age (#11536) --- pkg/api/http_server.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/api/http_server.go b/pkg/api/http_server.go index f30e5602484..2afccb8f0d7 100644 --- a/pkg/api/http_server.go +++ b/pkg/api/http_server.go @@ -174,6 +174,7 @@ func (hs *HTTPServer) newMacaron() *macaron.Macaron { hs.mapStatic(m, route.Directory, "", pluginRoute) } + hs.mapStatic(m, setting.StaticRootPath, "build", "public/build") hs.mapStatic(m, setting.StaticRootPath, "", "public") hs.mapStatic(m, setting.StaticRootPath, "robots.txt", "robots.txt") @@ -241,6 +242,12 @@ func (hs *HTTPServer) mapStatic(m *macaron.Macaron, rootDir string, dir string, c.Resp.Header().Set("Cache-Control", "public, max-age=3600") } + if prefix == "public/build" { + headers = func(c *macaron.Context) { + c.Resp.Header().Set("Cache-Control", "public, max-age=31536000") + } + } + if setting.Env == setting.DEV { headers = func(c *macaron.Context) { c.Resp.Header().Set("Cache-Control", "max-age=0, must-revalidate, no-cache") From 1888708ca52b5d5e4a15546055ccb7799d616e2d Mon Sep 17 00:00:00 2001 From: Seuf Date: Tue, 8 May 2018 14:04:20 +0200 Subject: [PATCH 05/21] Templating : return __empty__ value when all value return nothing to prevent elasticsearch syntaxe error (#9701) --- public/app/features/templating/template_srv.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/app/features/templating/template_srv.ts b/public/app/features/templating/template_srv.ts index e7c1dc7f102..99a9f53d547 100644 --- a/public/app/features/templating/template_srv.ts +++ b/public/app/features/templating/template_srv.ts @@ -74,6 +74,9 @@ export class TemplateSrv { if (typeof value === 'string') { return luceneEscape(value); } + if (value instanceof Array && value.length === 0) { + return '__empty__'; + } var quotedValues = _.map(value, function(val) { return '"' + luceneEscape(val) + '"'; }); From 3095dabe3c70e87db882012f6aa9461466625ef1 Mon Sep 17 00:00:00 2001 From: Andrew Richards Date: Tue, 8 May 2018 14:17:16 +0100 Subject: [PATCH 06/21] interpolate 'field' again in Elasticsearch terms queries (#10026) * interpolate 'field' again in Elasticsearch terms queries Fix for #8662 which was regressed in commit e4950c2dc1012cb1a36cca947666244417e56194 (the field 'field' was no longer interpolated) * remove unnecessary check for existence of field 'field' --- public/app/plugins/datasource/elasticsearch/datasource.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/public/app/plugins/datasource/elasticsearch/datasource.ts b/public/app/plugins/datasource/elasticsearch/datasource.ts index 7476a36405b..e3eccfb8029 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.ts +++ b/public/app/plugins/datasource/elasticsearch/datasource.ts @@ -395,6 +395,7 @@ export class ElasticDatasource { } if (query.find === 'terms') { + query.field = this.templateSrv.replace(query.field, {}, 'lucene'); query.query = this.templateSrv.replace(query.query || '*', {}, 'lucene'); return this.getTerms(query); } From 10f934d287e94139bf3bf997ba7787b2e04d5143 Mon Sep 17 00:00:00 2001 From: Chris Rice Date: Tue, 8 May 2018 07:18:57 -0600 Subject: [PATCH 07/21] Add alpha color channel support for graph bars (#10956) * Set fillColor in bars on load and on color change * Change bar fill color on color override * Added test for series overrides * Moved bars fill color setting into time_series. Fixed issue with prev commit where you could not show bars because of series overrides. --- public/app/core/specs/time_series.jest.ts | 14 ++++++++++++++ public/app/core/time_series2.ts | 10 ++++++++-- public/app/plugins/panel/graph/module.ts | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/public/app/core/specs/time_series.jest.ts b/public/app/core/specs/time_series.jest.ts index 5043953071a..6214c687add 100644 --- a/public/app/core/specs/time_series.jest.ts +++ b/public/app/core/specs/time_series.jest.ts @@ -281,6 +281,20 @@ describe('TimeSeries', function() { expect(series.zindex).toBe(2); }); }); + + describe('override color', function() { + beforeEach(function() { + series.applySeriesOverrides([{ alias: 'test', color: '#112233' }]); + }); + + it('should set color', function() { + expect(series.color).toBe('#112233'); + }); + + it('should set bars.fillColor', function() { + expect(series.bars.fillColor).toBe('#112233'); + }); + }); }); describe('value formatter', function() { diff --git a/public/app/core/time_series2.ts b/public/app/core/time_series2.ts index 3e02b1ec939..4da64850e59 100644 --- a/public/app/core/time_series2.ts +++ b/public/app/core/time_series2.ts @@ -99,6 +99,7 @@ export default class TimeSeries { this.alias = opts.alias; this.aliasEscaped = _.escape(opts.alias); this.color = opts.color; + this.bars = { fillColor: opts.color }; this.valueFormater = kbn.valueFormats.none; this.stats = {}; this.legend = true; @@ -112,11 +113,11 @@ export default class TimeSeries { dashLength: [], }; this.points = {}; - this.bars = {}; this.yaxis = 1; this.zindex = 0; this.nullPointMode = null; delete this.stack; + delete this.bars.show; for (var i = 0; i < overrides.length; i++) { var override = overrides[i]; @@ -168,7 +169,7 @@ export default class TimeSeries { this.fillBelowTo = override.fillBelowTo; } if (override.color !== void 0) { - this.color = override.color; + this.setColor(override.color); } if (override.transform !== void 0) { this.transform = override.transform; @@ -346,4 +347,9 @@ export default class TimeSeries { return false; } + + setColor(color) { + this.color = color; + this.bars.fillColor = color; + } } diff --git a/public/app/plugins/panel/graph/module.ts b/public/app/plugins/panel/graph/module.ts index 6cebbe65ab8..ef82fb395a5 100644 --- a/public/app/plugins/panel/graph/module.ts +++ b/public/app/plugins/panel/graph/module.ts @@ -235,7 +235,7 @@ class GraphCtrl extends MetricsPanelCtrl { } changeSeriesColor(series, color) { - series.color = color; + series.setColor(color); this.panel.aliasColors[series.alias] = series.color; this.render(); } From e52aceeaba99b2f2215ef384e1ee592de217bbae Mon Sep 17 00:00:00 2001 From: Angrite <34138852+Angrite@users.noreply.github.com> Date: Tue, 8 May 2018 16:47:09 +0300 Subject: [PATCH 08/21] Fix for #10078: symbol "&" is not escaped (#10137) Fix for #10078: Render value as link in Table panel: ampersand symbol "&" is not escaped in link URL, resulting URL is wrong. --- public/app/plugins/panel/table/renderer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/panel/table/renderer.ts b/public/app/plugins/panel/table/renderer.ts index 78f224d723f..f6950dada52 100644 --- a/public/app/plugins/panel/table/renderer.ts +++ b/public/app/plugins/panel/table/renderer.ts @@ -247,7 +247,7 @@ export class TableRenderer { var scopedVars = this.renderRowVariables(rowIndex); scopedVars['__cell'] = { value: value }; - var cellLink = this.templateSrv.replace(column.style.linkUrl, scopedVars); + var cellLink = this.templateSrv.replace(column.style.linkUrl, scopedVars, encodeURIComponent); var cellLinkTooltip = this.templateSrv.replace(column.style.linkTooltip, scopedVars); var cellTarget = column.style.linkTargetBlank ? '_blank' : ''; From ef0b7bda6f556ecc0f9ee5685d75b1cbb5e65c14 Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Tue, 8 May 2018 15:59:29 +0200 Subject: [PATCH 09/21] singlestat: render time of last point based on dashboard timezone (#11425) * singlestat: render time of last point based on dashboard timezone * changelog: add note for #10338 --- CHANGELOG.md | 1 + public/app/core/specs/kbn.jest.ts | 74 ++++++++++++++++--- public/app/core/utils/kbn.ts | 13 ++-- public/app/plugins/panel/singlestat/module.ts | 2 +- .../singlestat/specs/singlestat_specs.ts | 47 ++++++++++++ public/test/specs/helpers.ts | 9 +++ 6 files changed, 127 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bdeeed9af1..adc52560155 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,7 @@ * **Cloudwatch**: Add dimension filtering to CloudWatch `dimension_values()` [#10029](https://github.com/grafana/grafana/issues/10029), thx [@willyhutw](https://github.com/willyhutw) * **Units**: Second to HH:mm:ss formatter [#11107](https://github.com/grafana/grafana/issues/11107), thx [@gladdiologist](https://github.com/gladdiologist) * **Singlestat**: Add color to prefix and postfix in singlestat panel [#11143](https://github.com/grafana/grafana/pull/11143), thx [@ApsOps](https://github.com/ApsOps) +* **Singlestat**: Fix "time of last point" shows local time when dashboard timezone set to UTC [#10338](https://github.com/grafana/grafana/issues/10338) * **Dashboards**: Version cleanup fails on old databases with many entries [#11278](https://github.com/grafana/grafana/issues/11278) * **Server**: Adjust permissions of unix socket [#11343](https://github.com/grafana/grafana/pull/11343), thx [@corny](https://github.com/corny) * **Shortcuts**: Add shortcut for duplicate panel [#11102](https://github.com/grafana/grafana/issues/11102) diff --git a/public/app/core/specs/kbn.jest.ts b/public/app/core/specs/kbn.jest.ts index 9fad1f30694..68945068043 100644 --- a/public/app/core/specs/kbn.jest.ts +++ b/public/app/core/specs/kbn.jest.ts @@ -101,38 +101,88 @@ describeValueFormat('d', 245, 100, 0, '35 week'); describeValueFormat('d', 2456, 10, 0, '6.73 year'); describe('date time formats', function() { + const epoch = 1505634997920; + const utcTime = moment.utc(epoch); + const browserTime = moment(epoch); + it('should format as iso date', function() { - var str = kbn.valueFormats.dateTimeAsIso(1505634997920, 1); - expect(str).toBe(moment(1505634997920).format('YYYY-MM-DD HH:mm:ss')); + var expected = browserTime.format('YYYY-MM-DD HH:mm:ss'); + var actual = kbn.valueFormats.dateTimeAsIso(epoch); + expect(actual).toBe(expected); + }); + + it('should format as iso date (in UTC)', function() { + var expected = utcTime.format('YYYY-MM-DD HH:mm:ss'); + var actual = kbn.valueFormats.dateTimeAsIso(epoch, true); + expect(actual).toBe(expected); }); it('should format as iso date and skip date when today', function() { var now = moment(); - var str = kbn.valueFormats.dateTimeAsIso(now.valueOf(), 1); - expect(str).toBe(now.format('HH:mm:ss')); + var expected = now.format('HH:mm:ss'); + var actual = kbn.valueFormats.dateTimeAsIso(now.valueOf(), false); + expect(actual).toBe(expected); + }); + + it('should format as iso date (in UTC) and skip date when today', function() { + var now = moment.utc(); + var expected = now.format('HH:mm:ss'); + var actual = kbn.valueFormats.dateTimeAsIso(now.valueOf(), true); + expect(actual).toBe(expected); }); it('should format as US date', function() { - var str = kbn.valueFormats.dateTimeAsUS(1505634997920, 1); - expect(str).toBe(moment(1505634997920).format('MM/DD/YYYY h:mm:ss a')); + var expected = browserTime.format('MM/DD/YYYY h:mm:ss a'); + var actual = kbn.valueFormats.dateTimeAsUS(epoch, false); + expect(actual).toBe(expected); + }); + + it('should format as US date (in UTC)', function() { + var expected = utcTime.format('MM/DD/YYYY h:mm:ss a'); + var actual = kbn.valueFormats.dateTimeAsUS(epoch, true); + expect(actual).toBe(expected); }); it('should format as US date and skip date when today', function() { var now = moment(); - var str = kbn.valueFormats.dateTimeAsUS(now.valueOf(), 1); - expect(str).toBe(now.format('h:mm:ss a')); + var expected = now.format('h:mm:ss a'); + var actual = kbn.valueFormats.dateTimeAsUS(now.valueOf(), false); + expect(actual).toBe(expected); + }); + + it('should format as US date (in UTC) and skip date when today', function() { + var now = moment.utc(); + var expected = now.format('h:mm:ss a'); + var actual = kbn.valueFormats.dateTimeAsUS(now.valueOf(), true); + expect(actual).toBe(expected); }); it('should format as from now with days', function() { var daysAgo = moment().add(-7, 'd'); - var str = kbn.valueFormats.dateTimeFromNow(daysAgo.valueOf(), 1); - expect(str).toBe('7 days ago'); + var expected = '7 days ago'; + var actual = kbn.valueFormats.dateTimeFromNow(daysAgo.valueOf(), false); + expect(actual).toBe(expected); + }); + + it('should format as from now with days (in UTC)', function() { + var daysAgo = moment.utc().add(-7, 'd'); + var expected = '7 days ago'; + var actual = kbn.valueFormats.dateTimeFromNow(daysAgo.valueOf(), true); + expect(actual).toBe(expected); }); it('should format as from now with minutes', function() { var daysAgo = moment().add(-2, 'm'); - var str = kbn.valueFormats.dateTimeFromNow(daysAgo.valueOf(), 1); - expect(str).toBe('2 minutes ago'); + var expected = '2 minutes ago'; + var actual = kbn.valueFormats.dateTimeFromNow(daysAgo.valueOf(), false); + expect(actual).toBe(expected); + }); + + it('should format as from now with minutes (in UTC)', function() { + var daysAgo = moment.utc().add(-2, 'm'); + var expected = '2 minutes ago'; + var actual = kbn.valueFormats.dateTimeFromNow(daysAgo.valueOf(), true); + expect(actual).toBe(expected); }); }); diff --git a/public/app/core/utils/kbn.ts b/public/app/core/utils/kbn.ts index f4ee7af3383..f1c782846fc 100644 --- a/public/app/core/utils/kbn.ts +++ b/public/app/core/utils/kbn.ts @@ -816,8 +816,8 @@ kbn.valueFormats.timeticks = function(size, decimals, scaledDecimals) { return kbn.valueFormats.s(size / 100, decimals, scaledDecimals); }; -kbn.valueFormats.dateTimeAsIso = function(epoch) { - var time = moment(epoch); +kbn.valueFormats.dateTimeAsIso = function(epoch, isUtc) { + var time = isUtc ? moment.utc(epoch) : moment(epoch); if (moment().isSame(epoch, 'day')) { return time.format('HH:mm:ss'); @@ -825,8 +825,8 @@ kbn.valueFormats.dateTimeAsIso = function(epoch) { return time.format('YYYY-MM-DD HH:mm:ss'); }; -kbn.valueFormats.dateTimeAsUS = function(epoch) { - var time = moment(epoch); +kbn.valueFormats.dateTimeAsUS = function(epoch, isUtc) { + var time = isUtc ? moment.utc(epoch) : moment(epoch); if (moment().isSame(epoch, 'day')) { return time.format('h:mm:ss a'); @@ -834,8 +834,9 @@ kbn.valueFormats.dateTimeAsUS = function(epoch) { return time.format('MM/DD/YYYY h:mm:ss a'); }; -kbn.valueFormats.dateTimeFromNow = function(epoch) { - return moment(epoch).fromNow(); +kbn.valueFormats.dateTimeFromNow = function(epoch, isUtc) { + var time = isUtc ? moment.utc(epoch) : moment(epoch); + return time.fromNow(); }; ///// FORMAT MENU ///// diff --git a/public/app/plugins/panel/singlestat/module.ts b/public/app/plugins/panel/singlestat/module.ts index 28d3f308d68..b1996d8ffc9 100644 --- a/public/app/plugins/panel/singlestat/module.ts +++ b/public/app/plugins/panel/singlestat/module.ts @@ -308,7 +308,7 @@ class SingleStatCtrl extends MetricsPanelCtrl { let formatFunc = kbn.valueFormats[this.panel.format]; data.value = lastPoint[1]; data.valueRounded = data.value; - data.valueFormatted = formatFunc(data.value, 0, 0); + data.valueFormatted = formatFunc(data.value, this.dashboard.isTimezoneUtc()); } else { data.value = this.series[0].stats[this.panel.valueName]; data.flotpairs = this.series[0].flotpairs; diff --git a/public/app/plugins/panel/singlestat/specs/singlestat_specs.ts b/public/app/plugins/panel/singlestat/specs/singlestat_specs.ts index f80465052f9..217ec5ee04c 100644 --- a/public/app/plugins/panel/singlestat/specs/singlestat_specs.ts +++ b/public/app/plugins/panel/singlestat/specs/singlestat_specs.ts @@ -82,6 +82,19 @@ describe('SingleStatCtrl', function() { }); }); + singleStatScenario('showing last iso time instead of value (in UTC)', function(ctx) { + ctx.setup(function() { + ctx.data = [{ target: 'test.cpu1', datapoints: [[10, 12], [20, 1505634997920]] }]; + ctx.ctrl.panel.valueName = 'last_time'; + ctx.ctrl.panel.format = 'dateTimeAsIso'; + ctx.setIsUtc(true); + }); + + it('should set formatted value', function() { + expect(ctx.data.valueFormatted).to.be(moment.utc(1505634997920).format('YYYY-MM-DD HH:mm:ss')); + }); + }); + singleStatScenario('showing last us time instead of value', function(ctx) { ctx.setup(function() { ctx.data = [{ target: 'test.cpu1', datapoints: [[10, 12], [20, 1505634997920]] }]; @@ -99,6 +112,19 @@ describe('SingleStatCtrl', function() { }); }); + singleStatScenario('showing last us time instead of value (in UTC)', function(ctx) { + ctx.setup(function() { + ctx.data = [{ target: 'test.cpu1', datapoints: [[10, 12], [20, 1505634997920]] }]; + ctx.ctrl.panel.valueName = 'last_time'; + ctx.ctrl.panel.format = 'dateTimeAsUS'; + ctx.setIsUtc(true); + }); + + it('should set formatted value', function() { + expect(ctx.data.valueFormatted).to.be(moment.utc(1505634997920).format('MM/DD/YYYY h:mm:ss a')); + }); + }); + singleStatScenario('showing last time from now instead of value', function(ctx) { beforeEach(() => { clock = sinon.useFakeTimers(epoch); @@ -124,6 +150,27 @@ describe('SingleStatCtrl', function() { }); }); + singleStatScenario('showing last time from now instead of value (in UTC)', function(ctx) { + beforeEach(() => { + clock = sinon.useFakeTimers(epoch); + }); + + ctx.setup(function() { + ctx.data = [{ target: 'test.cpu1', datapoints: [[10, 12], [20, 1505634997920]] }]; + ctx.ctrl.panel.valueName = 'last_time'; + ctx.ctrl.panel.format = 'dateTimeFromNow'; + ctx.setIsUtc(true); + }); + + it('should set formatted value', function() { + expect(ctx.data.valueFormatted).to.be('2 days ago'); + }); + + afterEach(() => { + clock.restore(); + }); + }); + singleStatScenario('MainValue should use same number for decimals as displayed when checking thresholds', function( ctx ) { diff --git a/public/test/specs/helpers.ts b/public/test/specs/helpers.ts index ab7fbb5698b..276d9867ec4 100644 --- a/public/test/specs/helpers.ts +++ b/public/test/specs/helpers.ts @@ -23,6 +23,7 @@ export function ControllerTestContext() { }; }, }; + this.isUtc = false; this.providePhase = function(mocks) { return angularMocks.module(function($provide) { @@ -46,6 +47,10 @@ export function ControllerTestContext() { self.$q = $q; self.panel = new PanelModel({ type: 'test' }); self.dashboard = { meta: {} }; + self.isUtc = false; + self.dashboard.isTimezoneUtc = function() { + return self.isUtc; + }; $rootScope.appEvent = sinon.spy(); $rootScope.onAppEvent = sinon.spy(); @@ -93,6 +98,10 @@ export function ControllerTestContext() { }); }); }; + + this.setIsUtc = function(isUtc = false) { + self.isUtc = isUtc; + }; } export function ServiceTestContext() { From 5377b82612b9e2a3fb60ea68bda2e016ca43e988 Mon Sep 17 00:00:00 2001 From: Adrian Muraru Date: Tue, 8 May 2018 17:05:22 +0300 Subject: [PATCH 10/21] Phantom render.js is incorrectly retrieving number of active panels (#11100) Fixes #11099 --- tools/phantomjs/render.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/phantomjs/render.js b/tools/phantomjs/render.js index 77527585589..5e2e8f781ea 100644 --- a/tools/phantomjs/render.js +++ b/tools/phantomjs/render.js @@ -57,7 +57,7 @@ var rootScope = body.injector().get('$rootScope'); if (!rootScope) {return false;} - var panels = angular.element('div.panel:visible').length; + var panels = angular.element('plugin-component').length; return rootScope.panelsRendered >= panels; }); From 77421531d078b1b78f0cc57e6295a1c69802bb04 Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Tue, 8 May 2018 16:18:54 +0200 Subject: [PATCH 11/21] changelog: add notes about closing #10338 [skip ci] --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index adc52560155..55e23a88e82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * **InfluxDB**: Support SELECT queries in templating query, [#5013](https://github.com/grafana/grafana/issues/5013) * **Dashboard**: JSON Model under dashboard settings can now be updated & changes saved, [#1429](https://github.com/grafana/grafana/issues/1429), thx [@jereksel](https://github.com/jereksel) * **Security**: Fix XSS vulnerabilities in dashboard links [#11813](https://github.com/grafana/grafana/pull/11813) +* **Singlestat**: Fix "time of last point" shows local time when dashboard timezone set to UTC [#10338](https://github.com/grafana/grafana/issues/10338) # 5.1.1 (2018-05-07) @@ -56,7 +57,6 @@ * **Cloudwatch**: Add dimension filtering to CloudWatch `dimension_values()` [#10029](https://github.com/grafana/grafana/issues/10029), thx [@willyhutw](https://github.com/willyhutw) * **Units**: Second to HH:mm:ss formatter [#11107](https://github.com/grafana/grafana/issues/11107), thx [@gladdiologist](https://github.com/gladdiologist) * **Singlestat**: Add color to prefix and postfix in singlestat panel [#11143](https://github.com/grafana/grafana/pull/11143), thx [@ApsOps](https://github.com/ApsOps) -* **Singlestat**: Fix "time of last point" shows local time when dashboard timezone set to UTC [#10338](https://github.com/grafana/grafana/issues/10338) * **Dashboards**: Version cleanup fails on old databases with many entries [#11278](https://github.com/grafana/grafana/issues/11278) * **Server**: Adjust permissions of unix socket [#11343](https://github.com/grafana/grafana/pull/11343), thx [@corny](https://github.com/corny) * **Shortcuts**: Add shortcut for duplicate panel [#11102](https://github.com/grafana/grafana/issues/11102) From ef60d89742b2133381a5ea3ae32ad0560bffe02e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Podlipsk=C3=BD?= Date: Tue, 8 May 2018 21:25:45 +0200 Subject: [PATCH 12/21] Update dashboard.md --- docs/sources/reference/dashboard.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/sources/reference/dashboard.md b/docs/sources/reference/dashboard.md index 30581968743..6be12600da5 100644 --- a/docs/sources/reference/dashboard.md +++ b/docs/sources/reference/dashboard.md @@ -50,6 +50,7 @@ When a user creates a new dashboard, a new dashboard JSON object is initialized "annotations": { "list": [] }, + "refresh": "5s", "schemaVersion": 16, "version": 0, "links": [] @@ -71,6 +72,7 @@ Each field in the dashboard JSON is explained below with its usage: | **timepicker** | timepicker metadata, see [timepicker section](#timepicker) for details | | **templating** | templating metadata, see [templating section](#templating) for details | | **annotations** | annotations metadata, see [annotations section](#annotations) for details | +| **refresh** | auto-refresh interval | **schemaVersion** | version of the JSON schema (integer), incremented each time a Grafana update brings changes to said schema | | **version** | version of the dashboard (integer), incremented each time the dashboard is updated | | **panels** | panels array, see below for detail. | From 4565676233e4f48da1baab0fa90133112ef77067 Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Tue, 8 May 2018 22:18:58 +0200 Subject: [PATCH 13/21] Fix dependencies on Node v10 --- yarn.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yarn.lock b/yarn.lock index f23d44867f5..742754069f7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11048,8 +11048,8 @@ unzip-response@^2.0.1: resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-2.0.1.tgz#d2f0f737d16b0615e72a6935ed04214572d56f97" upath@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/upath/-/upath-1.0.4.tgz#ee2321ba0a786c50973db043a50b7bcba822361d" + version "1.0.5" + resolved "https://registry.yarnpkg.com/upath/-/upath-1.0.5.tgz#02cab9ecebe95bbec6d5fc2566325725ab6d1a73" update-notifier@^2.3.0: version "2.5.0" From 4dfaab4c5bc30e23e12444fe9d366ae841f68298 Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Wed, 9 May 2018 10:45:40 +0200 Subject: [PATCH 14/21] changelog: add notes about closing #11862, #11656 [skip ci] --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55e23a88e82..146520d13a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ * **Security**: Fix XSS vulnerabilities in dashboard links [#11813](https://github.com/grafana/grafana/pull/11813) * **Singlestat**: Fix "time of last point" shows local time when dashboard timezone set to UTC [#10338](https://github.com/grafana/grafana/issues/10338) +# 5.1.2 (2018-05-09) + +* **Database**: Fix MySql migration issue [#11862](https://github.com/grafana/grafana/issues/11862) +* **Google Analytics**: Enable Google Analytics anonymizeIP setting for GDPR [#11656](https://github.com/grafana/grafana/pull/11656) + # 5.1.1 (2018-05-07) * **LDAP**: LDAP login with MariaDB/MySQL database and dn>100 chars not possible [#11754](https://github.com/grafana/grafana/issues/11754) From 486aaca109d62c700aeb6d916db7f38ba1aab990 Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Wed, 9 May 2018 14:03:22 +0200 Subject: [PATCH 15/21] docs: update installation instructions targeting v5.1.2 stable --- docs/sources/installation/debian.md | 6 +++--- docs/sources/installation/rpm.md | 10 +++++----- docs/sources/installation/windows.md | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/sources/installation/debian.md b/docs/sources/installation/debian.md index 83d26351295..f0ad89a8e88 100644 --- a/docs/sources/installation/debian.md +++ b/docs/sources/installation/debian.md @@ -15,7 +15,7 @@ weight = 1 Description | Download ------------ | ------------- -Stable for Debian-based Linux | [grafana_5.1.1_amd64.deb](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.1.1_amd64.deb) +Stable for Debian-based Linux | [grafana_5.1.2_amd64.deb](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.1.2_amd64.deb) @@ -27,9 +27,9 @@ installation. ```bash -wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.1.1_amd64.deb +wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.1.2_amd64.deb sudo apt-get install -y adduser libfontconfig -sudo dpkg -i grafana_5.1.1_amd64.deb +sudo dpkg -i grafana_5.1.2_amd64.deb ``` @@ -28,7 +28,7 @@ installation. You can install Grafana using Yum directly. ```bash -$ sudo yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.1.1-1.x86_64.rpm +$ sudo yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.1.2-1.x86_64.rpm ```