From 0a13b7c559d778dc8e7ef9e6e917537f6750d4d1 Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Tue, 29 Mar 2016 14:45:25 +0900 Subject: [PATCH 01/12] highlight series name in tooltip when shared tooltip active --- public/app/plugins/panel/graph/graph_tooltip.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/panel/graph/graph_tooltip.js b/public/app/plugins/panel/graph/graph_tooltip.js index 3e2900be4e9..afb473723ae 100644 --- a/public/app/plugins/panel/graph/graph_tooltip.js +++ b/public/app/plugins/panel/graph/graph_tooltip.js @@ -142,11 +142,16 @@ function ($) { continue; } + var highlightStyle = ''; + if (item && i === item.seriesIndex) { + highlightStyle = ' style="font-weight: bold;"'; + } + series = seriesList[i]; value = series.formatValue(hoverInfo.value); - seriesHtml += '
'; + seriesHtml += '
'; seriesHtml += ' ' + series.label + ':
'; seriesHtml += '
' + value + '
'; plot.highlight(i, hoverInfo.hoverIndex); From 1a29a769c6e3f5ef1db78e4a80deec0663bf7120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 8 Apr 2016 17:43:13 -0400 Subject: [PATCH 02/12] fix(series overrides): graph no rerenders with new styles after updating series override, fixes #4621 --- public/app/plugins/panel/graph/module.ts | 12 ++++++++++++ .../app/plugins/panel/graph/series_overrides_ctrl.js | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/panel/graph/module.ts b/public/app/plugins/panel/graph/module.ts index a430be98662..6fce3b5d81a 100644 --- a/public/app/plugins/panel/graph/module.ts +++ b/public/app/plugins/panel/graph/module.ts @@ -219,6 +219,18 @@ class GraphCtrl extends MetricsPanelCtrl { return series; } + seriesOverrideChanged() { + if (!this.seriesList) { + return; + } + + for (let series of this.seriesList) { + series.applySeriesOverrides(this.panel.seriesOverrides); + } + + this.render(); + } + changeSeriesColor(series, color) { series.color = color; this.panel.aliasColors[series.alias] = series.color; diff --git a/public/app/plugins/panel/graph/series_overrides_ctrl.js b/public/app/plugins/panel/graph/series_overrides_ctrl.js index 014c1f6abe7..2789a24923c 100644 --- a/public/app/plugins/panel/graph/series_overrides_ctrl.js +++ b/public/app/plugins/panel/graph/series_overrides_ctrl.js @@ -43,7 +43,7 @@ define([ } $scope.updateCurrentOverrides(); - $scope.ctrl.render(); + $scope.ctrl.seriesOverrideChanged(); }; $scope.colorSelected = function(color) { From 52e2091f2c2fd2f62cb7c784786ece020cbb96b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 8 Apr 2016 18:12:08 -0400 Subject: [PATCH 03/12] fix(): fixed issue with series override color selector when using the mouse to select color option, fixes #4620 --- public/app/core/services/popover_srv.ts | 5 ++++- public/app/plugins/panel/graph/series_overrides_ctrl.js | 3 +++ public/test/specs/seriesOverridesCtrl-specs.js | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/public/app/core/services/popover_srv.ts b/public/app/core/services/popover_srv.ts index 4711dc1b23c..73249a67b5b 100644 --- a/public/app/core/services/popover_srv.ts +++ b/public/app/core/services/popover_srv.ts @@ -46,9 +46,12 @@ function popoverSrv($compile, $rootScope) { drop.on('close', () => { popoverScope.dismiss({fromDropClose: true}); destroyDrop(); + if (options.onClose) { + options.onClose(); + } }); - drop.open(); + setTimeout(() => { drop.open(); }, 10); }; } diff --git a/public/app/plugins/panel/graph/series_overrides_ctrl.js b/public/app/plugins/panel/graph/series_overrides_ctrl.js index 2789a24923c..0ecedde8595 100644 --- a/public/app/plugins/panel/graph/series_overrides_ctrl.js +++ b/public/app/plugins/panel/graph/series_overrides_ctrl.js @@ -60,6 +60,9 @@ define([ template: '', model: { colorSelected: $scope.colorSelected, + }, + onClose: function() { + $scope.ctrl.seriesOverrideChanged(); } }); }; diff --git a/public/test/specs/seriesOverridesCtrl-specs.js b/public/test/specs/seriesOverridesCtrl-specs.js index f83a87d5977..d468b649573 100644 --- a/public/test/specs/seriesOverridesCtrl-specs.js +++ b/public/test/specs/seriesOverridesCtrl-specs.js @@ -22,6 +22,7 @@ define([ ctx.scope.ctrl = { refresh: sinon.spy(), render: sinon.spy(), + seriesOverrideChanged: sinon.spy(), seriesList: [] }; ctx.scope.render = function() {}; From ed62822d442569e7ba287ff63d83a069a596c458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 9 Apr 2016 11:00:35 -0400 Subject: [PATCH 04/12] feat(influxdb): changed multi query encoding in order to support InfluxDB >v0.11, closes #4533 --- CHANGELOG.md | 3 +++ .../app/plugins/datasource/influxdb/datasource.ts | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2399eda7140..4c8790751af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # 3.0.0-beta3 (unreleased) +### Enhancements +* **InfluxDB**: Changed multi query encoding to work with InfluxDB 0.11 & 0.12, closes [#4533](https://github.com/grafana/grafana/issues/4533) + ### Bug fixes * **Postgres**: Fixed page render crash when using postgres, fixes [#4558](https://github.com/grafana/grafana/issues/4558) * **Table panel**: Fixed table panel bug when trying to show annotations in table panel, fixes [#4563](https://github.com/grafana/grafana/issues/4563) diff --git a/public/app/plugins/datasource/influxdb/datasource.ts b/public/app/plugins/datasource/influxdb/datasource.ts index daa6ada3420..f63716e5dd6 100644 --- a/public/app/plugins/datasource/influxdb/datasource.ts +++ b/public/app/plugins/datasource/influxdb/datasource.ts @@ -55,7 +55,7 @@ export default class InfluxDatasource { query = query.replace(/\$interval/g, (target.interval || options.interval)); return query; - }).join("\n"); + }).join(";"); // replace grafana variables allQueries = allQueries.replace(/\$timeFilter/g, timeFilter); @@ -133,6 +133,17 @@ export default class InfluxDatasource { return this._influxRequest('GET', '/query', {q: query, epoch: 'ms'}); } + + serializeParams(params) { + if (!params) { return '';} + + return _.reduce(params, (memo, value, key) => { + if (value === null || value === undefined) { return memo; } + memo.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); + return memo; + }, []).join("&"); + } + testDatasource() { return this.metricFindQuery('SHOW MEASUREMENTS LIMIT 1').then(() => { return { status: "success", message: "Data source is working", title: "Success" }; @@ -166,6 +177,7 @@ export default class InfluxDatasource { data: data, precision: "ms", inspect: { type: 'influxdb' }, + paramSerializer: this.serializeParams, }; options.headers = options.headers || {}; From 5d9c3d595f3347e60da39419abb4c2952f1f1fec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 9 Apr 2016 11:26:48 -0400 Subject: [PATCH 05/12] fix(graph): fixed issue with y-axis labels overlapping with the yaxis, fixes #4626 --- CHANGELOG.md | 1 + public/app/plugins/panel/graph/graph.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c8790751af..1db5ad21057 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * **App Config**: Fixed app config issue showing content of other app config, fixes [#4575](https://github.com/grafana/grafana/issues/4575) * **Graph Panel**: Fixed legend option max not updating, fixes [#4601](https://github.com/grafana/grafana/issues/4601) * **Graph Panel**: Fixed issue where newly added graph panels shared same axes config, fixes [#4582](https://github.com/grafana/grafana/issues/4582) +* **Graph Panel**: Fixed issue with axis labels overlapping Y-axis, fixes [#4626](https://github.com/grafana/grafana/issues/4626) # 3.0.0-beta2 (2016-04-04) diff --git a/public/app/plugins/panel/graph/graph.js b/public/app/plugins/panel/graph/graph.js index 4e948bf8e5b..9e6633b5551 100755 --- a/public/app/plugins/panel/graph/graph.js +++ b/public/app/plugins/panel/graph/graph.js @@ -151,8 +151,10 @@ function (angular, $, moment, _, kbn, GraphTooltip) { } function processOffsetHook(plot, gridMargin) { - if (panel.yaxis) { gridMargin.left = 20; } - if (panel.rightYAxisLabel) { gridMargin.right = 20; } + var left = panel.yaxes[0]; + var right = panel.yaxes[1]; + if (left.show && left.label) { gridMargin.left = 20; } + if (right.show && right.label) { gridMargin.right = 20; } } // Function for rendering panel From 22b11d7d4da4d55d0755c25ee952b380d357078e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 9 Apr 2016 12:45:35 -0400 Subject: [PATCH 06/12] feat(graph panel): changed to PR #4493 and other polish, removed the relative time from graph tooltip, did not think it worked that well --- .../app/plugins/panel/graph/graph_tooltip.js | 19 ++++++++----------- public/sass/_variables.dark.scss | 5 +++-- public/sass/_variables.light.scss | 1 + public/sass/components/_panel_graph.scss | 13 +++++++------ public/sass/components/_tooltip.scss | 7 ------- 5 files changed, 19 insertions(+), 26 deletions(-) diff --git a/public/app/plugins/panel/graph/graph_tooltip.js b/public/app/plugins/panel/graph/graph_tooltip.js index afb473723ae..7f2b83220a8 100644 --- a/public/app/plugins/panel/graph/graph_tooltip.js +++ b/public/app/plugins/panel/graph/graph_tooltip.js @@ -33,9 +33,8 @@ function ($) { return j - 1; }; - this.showTooltip = function(absoluteTime, relativeTime, innerHtml, pos) { - var body = '
'+ absoluteTime + - ' (' + relativeTime + ')
'; + this.showTooltip = function(absoluteTime, innerHtml, pos) { + var body = '
'+ absoluteTime + '
'; body += innerHtml + '
'; $tooltip.html(body).place_tt(pos.pageX + 20, pos.pageY); }; @@ -109,7 +108,7 @@ function ($) { var plot = elem.data().plot; var plotData = plot.getData(); var seriesList = getSeriesFn(); - var group, value, absoluteTime, relativeTime, hoverInfo, i, series, seriesHtml, tooltipFormat; + var group, value, absoluteTime, hoverInfo, i, series, seriesHtml, tooltipFormat; if (panel.tooltip.msResolution) { tooltipFormat = 'YYYY-MM-DD HH:mm:ss.SSS'; @@ -132,7 +131,6 @@ function ($) { seriesHtml = ''; - relativeTime = dashboard.getRelativeTime(seriesHoverInfo.time); absoluteTime = dashboard.formatDate(seriesHoverInfo.time, tooltipFormat); for (i = 0; i < seriesHoverInfo.length; i++) { @@ -142,22 +140,22 @@ function ($) { continue; } - var highlightStyle = ''; + var highlightClass = ''; if (item && i === item.seriesIndex) { - highlightStyle = ' style="font-weight: bold;"'; + highlightClass = 'graph-tooltip-list-item--highlight'; } series = seriesList[i]; value = series.formatValue(hoverInfo.value); - seriesHtml += '
'; + seriesHtml += '
'; seriesHtml += ' ' + series.label + ':
'; seriesHtml += '
' + value + '
'; plot.highlight(i, hoverInfo.hoverIndex); } - self.showTooltip(absoluteTime, relativeTime, seriesHtml, pos); + self.showTooltip(absoluteTime, seriesHtml, pos); } // single series tooltip else if (item) { @@ -174,12 +172,11 @@ function ($) { value = series.formatValue(value); - relativeTime = dashboard.getRelativeTime(item.datapoint[0]); absoluteTime = dashboard.formatDate(item.datapoint[0], tooltipFormat); group += '
' + value + '
'; - self.showTooltip(absoluteTime, relativeTime, group, pos); + self.showTooltip(absoluteTime, group, pos); } // no hit else { diff --git a/public/sass/_variables.dark.scss b/public/sass/_variables.dark.scss index 18b2931373d..3a390e2f883 100644 --- a/public/sass/_variables.dark.scss +++ b/public/sass/_variables.dark.scss @@ -39,6 +39,7 @@ $brand-primary: $orange; $brand-success: $green; $brand-warning: $brand-primary; $brand-danger: $red; +$brand-text-highlight: #f7941d; // Status colors // ------------------------- @@ -242,8 +243,8 @@ $infoBackground: $blue-dark; // Tooltips and popovers // ------------------------- -$tooltipColor: $white; -$tooltipBackground: rgb(58, 57, 57); +$tooltipColor: $text-color; +$tooltipBackground: $dark-4; $tooltipArrowWidth: 5px; $tooltipArrowColor: $tooltipBackground; $tooltipLinkColor: $link-color; diff --git a/public/sass/_variables.light.scss b/public/sass/_variables.light.scss index 8fef6ae72eb..91b42c5c6be 100644 --- a/public/sass/_variables.light.scss +++ b/public/sass/_variables.light.scss @@ -44,6 +44,7 @@ $brand-primary: $orange; $brand-success: $green; $brand-warning: $orange; $brand-danger: $red; +$brand-text-highlight: #f7941d; // Status colors // ------------------------- diff --git a/public/sass/components/_panel_graph.scss b/public/sass/components/_panel_graph.scss index 9837f33a543..c8d68bbdd46 100644 --- a/public/sass/components/_panel_graph.scss +++ b/public/sass/components/_panel_graph.scss @@ -237,27 +237,28 @@ .graph-tooltip-time { text-align: center; - font-weight: $font-weight-semi-bold; position: relative; top: -3px; - } - - .tone-down { - opacity: 0.7; + padding: 0.2rem; } .graph-tooltip-list-item { display: table-row; + + &--highlight { + color: $brand-text-highlight; + } } .graph-tooltip-series-name { display: table-cell; + padding: 0.15rem; } .graph-tooltip-value { display: table-cell; font-weight: bold; - padding-left: 10px; + padding-left: 15px; text-align: right; } } diff --git a/public/sass/components/_tooltip.scss b/public/sass/components/_tooltip.scss index e70e1010bf1..6499d73c0d8 100644 --- a/public/sass/components/_tooltip.scss +++ b/public/sass/components/_tooltip.scss @@ -88,13 +88,6 @@ } } -.grafana-tooltip hr { - padding: 2px; - color: #c8c8c8; - margin: 0px; - border-bottom: 0px solid #c8c8c8; -} - .grafana-tip { padding-left: 5px; } From 262c341bdc7f9e6a6697ae7feb8b13c6269cfc09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 9 Apr 2016 13:09:03 -0400 Subject: [PATCH 07/12] fix(influxdb): fixed annotation queries containting template variables, fixes #4602 --- CHANGELOG.md | 1 + public/app/plugins/datasource/influxdb/datasource.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1db5ad21057..941245a83f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * **Graph Panel**: Fixed legend option max not updating, fixes [#4601](https://github.com/grafana/grafana/issues/4601) * **Graph Panel**: Fixed issue where newly added graph panels shared same axes config, fixes [#4582](https://github.com/grafana/grafana/issues/4582) * **Graph Panel**: Fixed issue with axis labels overlapping Y-axis, fixes [#4626](https://github.com/grafana/grafana/issues/4626) +* **InfluxDB**: Fixed issue with templating query containing template variable, fixes [#4602](https://github.com/grafana/grafana/issues/4602) # 3.0.0-beta2 (2016-04-04) diff --git a/public/app/plugins/datasource/influxdb/datasource.ts b/public/app/plugins/datasource/influxdb/datasource.ts index f63716e5dd6..4037e963bcb 100644 --- a/public/app/plugins/datasource/influxdb/datasource.ts +++ b/public/app/plugins/datasource/influxdb/datasource.ts @@ -107,7 +107,7 @@ export default class InfluxDatasource { var timeFilter = this.getTimeFilter({rangeRaw: options.rangeRaw}); var query = options.annotation.query.replace('$timeFilter', timeFilter); - query = this.templateSrv.replace(query); + query = this.templateSrv.replace(query, null, 'regex'); return this._seriesQuery(query).then(data => { if (!data || !data.results || !data.results[0]) { From 370589d6c09a884477afa9a16bcc8b9f2bc78c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 9 Apr 2016 13:27:06 -0400 Subject: [PATCH 08/12] fix(org switch): fixed issue with switching orgs, fixes #4614 --- pkg/api/api.go | 1 + pkg/api/user.go | 18 ++++++++++++++++++ .../app/core/components/sidemenu/sidemenu.ts | 5 ++--- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/pkg/api/api.go b/pkg/api/api.go index 85f1e2474c3..b1c89e54bc3 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -30,6 +30,7 @@ func Register(r *macaron.Macaron) { // authed views r.Get("/profile/", reqSignedIn, Index) r.Get("/profile/password", reqSignedIn, Index) + r.Get("/profile/switch-org/:id", reqSignedIn, ChangeActiveOrgAndRedirectToHome) r.Get("/org/", reqSignedIn, Index) r.Get("/org/new", reqSignedIn, Index) r.Get("/datasources/", reqSignedIn, Index) diff --git a/pkg/api/user.go b/pkg/api/user.go index 5af243eeb22..8f54feaf6a0 100644 --- a/pkg/api/user.go +++ b/pkg/api/user.go @@ -4,6 +4,7 @@ import ( "github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/middleware" m "github.com/grafana/grafana/pkg/models" + "github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/util" ) @@ -109,6 +110,23 @@ func UserSetUsingOrg(c *middleware.Context) Response { return ApiSuccess("Active organization changed") } +// GET /profile/switch-org/:id +func ChangeActiveOrgAndRedirectToHome(c *middleware.Context) { + orgId := c.ParamsInt64(":id") + + if !validateUsingOrg(c.UserId, orgId) { + NotFoundHandler(c) + } + + cmd := m.SetUsingOrgCommand{UserId: c.UserId, OrgId: orgId} + + if err := bus.Dispatch(&cmd); err != nil { + NotFoundHandler(c) + } + + c.Redirect(setting.AppSubUrl + "/") +} + func ChangeUserPassword(c *middleware.Context, cmd m.ChangeUserPasswordCommand) Response { userQuery := m.GetUserByIdQuery{Id: c.UserId} diff --git a/public/app/core/components/sidemenu/sidemenu.ts b/public/app/core/components/sidemenu/sidemenu.ts index a47704f9d7d..f0a65b0559e 100644 --- a/public/app/core/components/sidemenu/sidemenu.ts +++ b/public/app/core/components/sidemenu/sidemenu.ts @@ -72,9 +72,8 @@ export class SideMenuCtrl { this.orgMenu.push({ text: "Switch to " + org.name, icon: "fa fa-fw fa-random", - click: () => { - this.switchOrg(org.orgId); - } + url: this.getUrl('/profile/switch-org/' + org.orgId), + target: '_self' }); }); From 9f75bda8bed8fff357dbb1448e6d7a81cada793d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 9 Apr 2016 13:28:34 -0400 Subject: [PATCH 09/12] refactor(): minor cleanup in sidemenu component --- public/app/core/components/sidemenu/sidemenu.html | 4 ---- public/app/core/components/sidemenu/sidemenu.ts | 6 ------ 2 files changed, 10 deletions(-) diff --git a/public/app/core/components/sidemenu/sidemenu.html b/public/app/core/components/sidemenu/sidemenu.html index 4ff30c92f47..25aa38c45b8 100644 --- a/public/app/core/components/sidemenu/sidemenu.html +++ b/public/app/core/components/sidemenu/sidemenu.html @@ -21,10 +21,6 @@ {{::menuItem.text}} - - - {{::menuItem.text}} - diff --git a/public/app/core/components/sidemenu/sidemenu.ts b/public/app/core/components/sidemenu/sidemenu.ts index f0a65b0559e..30230586e78 100644 --- a/public/app/core/components/sidemenu/sidemenu.ts +++ b/public/app/core/components/sidemenu/sidemenu.ts @@ -82,12 +82,6 @@ export class SideMenuCtrl { } }); } - - switchOrg(orgId) { - this.backendSrv.post('/api/user/using/' + orgId).then(() => { - window.location.href = `${config.appSubUrl}/`; - }); - }; } export function sideMenuDirective() { From ebb373eedb25e1e8682f9cdf8f63e9eb40bd6cb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 9 Apr 2016 14:37:30 -0400 Subject: [PATCH 10/12] fix(graph): fixed issue with toggling series on and off would loose stacking, fixes #4557 --- CHANGELOG.md | 1 + public/app/plugins/panel/graph/module.ts | 11 +++-------- .../app/plugins/panel/graph/series_overrides_ctrl.js | 4 ++-- public/test/specs/seriesOverridesCtrl-specs.js | 1 - 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 941245a83f4..041381409ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * **Graph Panel**: Fixed issue where newly added graph panels shared same axes config, fixes [#4582](https://github.com/grafana/grafana/issues/4582) * **Graph Panel**: Fixed issue with axis labels overlapping Y-axis, fixes [#4626](https://github.com/grafana/grafana/issues/4626) * **InfluxDB**: Fixed issue with templating query containing template variable, fixes [#4602](https://github.com/grafana/grafana/issues/4602) +* **Graph Panel**: Fixed issue with hiding series and stacking, fixes [#4557](https://github.com/grafana/grafana/issues/4557) # 3.0.0-beta2 (2016-04-04) diff --git a/public/app/plugins/panel/graph/module.ts b/public/app/plugins/panel/graph/module.ts index 6fce3b5d81a..c42bc6e6c46 100644 --- a/public/app/plugins/panel/graph/module.ts +++ b/public/app/plugins/panel/graph/module.ts @@ -116,6 +116,7 @@ class GraphCtrl extends MetricsPanelCtrl { this.colors = $scope.$root.colors; + this.events.on('render', this.onRender.bind(this)); this.events.on('data-received', this.onDataReceived.bind(this)); this.events.on('data-error', this.onDataError.bind(this)); this.events.on('data-snapshot-load', this.onDataSnapshotLoad.bind(this)); @@ -215,20 +216,15 @@ class GraphCtrl extends MetricsPanelCtrl { this.panel.tooltip.msResolution = this.panel.tooltip.msResolution || series.isMsResolutionNeeded(); } - series.applySeriesOverrides(this.panel.seriesOverrides); return series; } - seriesOverrideChanged() { - if (!this.seriesList) { - return; - } + onRender() { + if (!this.seriesList) { return; } for (let series of this.seriesList) { series.applySeriesOverrides(this.panel.seriesOverrides); } - - this.render(); } changeSeriesColor(series, color) { @@ -247,7 +243,6 @@ class GraphCtrl extends MetricsPanelCtrl { } else { this.toggleSeriesExclusiveMode(serie); } - this.render(); } diff --git a/public/app/plugins/panel/graph/series_overrides_ctrl.js b/public/app/plugins/panel/graph/series_overrides_ctrl.js index 0ecedde8595..7a41a650306 100644 --- a/public/app/plugins/panel/graph/series_overrides_ctrl.js +++ b/public/app/plugins/panel/graph/series_overrides_ctrl.js @@ -43,7 +43,7 @@ define([ } $scope.updateCurrentOverrides(); - $scope.ctrl.seriesOverrideChanged(); + $scope.ctrl.render(); }; $scope.colorSelected = function(color) { @@ -62,7 +62,7 @@ define([ colorSelected: $scope.colorSelected, }, onClose: function() { - $scope.ctrl.seriesOverrideChanged(); + $scope.ctrl.render(); } }); }; diff --git a/public/test/specs/seriesOverridesCtrl-specs.js b/public/test/specs/seriesOverridesCtrl-specs.js index d468b649573..f83a87d5977 100644 --- a/public/test/specs/seriesOverridesCtrl-specs.js +++ b/public/test/specs/seriesOverridesCtrl-specs.js @@ -22,7 +22,6 @@ define([ ctx.scope.ctrl = { refresh: sinon.spy(), render: sinon.spy(), - seriesOverrideChanged: sinon.spy(), seriesList: [] }; ctx.scope.render = function() {}; From 781fed1079f54316d3f0c389c0413d4af47bdd7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 9 Apr 2016 14:44:50 -0400 Subject: [PATCH 11/12] fix(mixed data source): fixed issue with mixed data sources in same graph, fixes #4604 --- CHANGELOG.md | 1 + public/app/features/panel/metrics_panel_ctrl.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 041381409ee..a0741e2e0ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ * **Graph Panel**: Fixed issue with axis labels overlapping Y-axis, fixes [#4626](https://github.com/grafana/grafana/issues/4626) * **InfluxDB**: Fixed issue with templating query containing template variable, fixes [#4602](https://github.com/grafana/grafana/issues/4602) * **Graph Panel**: Fixed issue with hiding series and stacking, fixes [#4557](https://github.com/grafana/grafana/issues/4557) +* **Mixed Datasources**: Fixed issue with mixing many datasources in same graph, fixes [#4604](https://github.com/grafana/grafana/issues/4604) # 3.0.0-beta2 (2016-04-04) diff --git a/public/app/features/panel/metrics_panel_ctrl.ts b/public/app/features/panel/metrics_panel_ctrl.ts index 4e610e3ed05..fc98719392e 100644 --- a/public/app/features/panel/metrics_panel_ctrl.ts +++ b/public/app/features/panel/metrics_panel_ctrl.ts @@ -252,8 +252,12 @@ class MetricsPanelCtrl extends PanelCtrl { } addDataQuery(datasource) { - var target = { - }; + var target: any = {}; + + if (datasource) { + target.datasource = datasource.name; + } + this.panel.targets.push(target); } } From e8a209c9b5b7ccc3aa2473ac58d96ad5b7bfac9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 9 Apr 2016 15:00:47 -0400 Subject: [PATCH 12/12] fix(): removed obsolete call to setTimeQueryStart --- public/app/features/panel/metrics_panel_ctrl.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/public/app/features/panel/metrics_panel_ctrl.ts b/public/app/features/panel/metrics_panel_ctrl.ts index fc98719392e..df4e912211e 100644 --- a/public/app/features/panel/metrics_panel_ctrl.ts +++ b/public/app/features/panel/metrics_panel_ctrl.ts @@ -184,7 +184,6 @@ class MetricsPanelCtrl extends PanelCtrl { cacheTimeout: this.panel.cacheTimeout }; - this.setTimeQueryStart(); return datasource.query(metricsQuery); }