From bde138177d7e2425840a82ea294a56c6658f1d3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 15 Nov 2014 10:38:01 +0100 Subject: [PATCH 01/19] Singlestat: fixed decimal issue when value was 1, Fixes #1066 --- src/app/panels/singlestat/module.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/panels/singlestat/module.js b/src/app/panels/singlestat/module.js index c17b5afea38..91dd019c4b7 100644 --- a/src/app/panels/singlestat/module.js +++ b/src/app/panels/singlestat/module.js @@ -125,7 +125,7 @@ function (angular, app, _, TimeSeries, kbn, PanelMeta) { $scope.getDecimalsForValue = function(value) { var opts = {}; - if (value === 0) { + if (value === 0 || value === 1) { return { decimals: 0, scaledDecimals: 0 }; } From 02e1ac12b22efd89d6414c673fb528e15741091b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 17 Nov 2014 07:09:21 +0100 Subject: [PATCH 02/19] InfluxDB: fixed annotations, broken after switch to millisecond resolution, Fixes #1061 --- src/app/services/influxdb/influxSeries.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/services/influxdb/influxSeries.js b/src/app/services/influxdb/influxSeries.js index e9c8304d1f0..03b8c1cee71 100644 --- a/src/app/services/influxdb/influxSeries.js +++ b/src/app/services/influxdb/influxSeries.js @@ -69,6 +69,7 @@ function (_) { p.getAnnotations = function () { var list = []; var self = this; + console.log(this.seriesList); _.each(this.seriesList, function (series) { var titleCol = null; @@ -88,7 +89,7 @@ function (_) { _.each(series.points, function (point) { var data = { annotation: self.annotation, - time: point[timeCol] * 1000, + time: point[timeCol], title: point[titleCol], tags: point[tagsCol], text: point[textCol] From f45797ec4b84a551359340b51e0057476834cc9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 17 Nov 2014 09:11:54 +0100 Subject: [PATCH 03/19] trying out panel actions buttons --- src/app/directives/panelMenu.js | 9 +++++-- src/app/panels/graph/graph.js | 3 ++- src/app/panels/singlestat/singleStatPanel.js | 1 + src/app/partials/submenu.html | 13 ++++++++++ src/css/less/panel.less | 25 ++++++++++++++++++++ 5 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/app/directives/panelMenu.js b/src/app/directives/panelMenu.js index a4eb3bd210d..e727b57467f 100644 --- a/src/app/directives/panelMenu.js +++ b/src/app/directives/panelMenu.js @@ -13,6 +13,11 @@ function (angular, $, _) { '' + '{{panel.title | interpolateTemplateVars}}' + '' + + '' + + '' + + 'View' + + 'Edit' + + ''; ''; function createMenuTemplate($scope) { @@ -119,7 +124,7 @@ function (angular, $, _) { $menu = $(menuTemplate); $menu.css('left', menuLeftPos); $menu.mouseleave(function() { - dismiss(1000); + //dismiss(1000); }); menuScope = $scope.$new(); @@ -134,7 +139,7 @@ function (angular, $, _) { $(".panel-container").removeClass('panel-highlight'); $panelContainer.toggleClass('panel-highlight'); - dismiss(2500); + //dismiss(2500); }; if ($scope.panelMeta.titlePos && $scope.panel.title) { diff --git a/src/app/panels/graph/graph.js b/src/app/panels/graph/graph.js index e0ddfc76402..aba28e6f5ec 100755 --- a/src/app/panels/graph/graph.js +++ b/src/app/panels/graph/graph.js @@ -72,10 +72,11 @@ function (angular, $, kbn, moment, _, GraphTooltip) { height = parseInt(height.replace('px', ''), 10); } + height -= 5; // padding height -= scope.panel.title ? 24 : 9; // subtract panel title bar if (scope.panel.legend.show && !scope.panel.legend.rightSide) { - height = height - 21; // subtract one line legend + height = height - 26; // subtract one line legend } elem.css('height', height + 'px'); diff --git a/src/app/panels/singlestat/singleStatPanel.js b/src/app/panels/singlestat/singleStatPanel.js index d1131f29e94..3bd9ce54465 100644 --- a/src/app/panels/singlestat/singleStatPanel.js +++ b/src/app/panels/singlestat/singleStatPanel.js @@ -29,6 +29,7 @@ function (angular, app, _, $) { height = parseInt(height.replace('px', ''), 10); } + height -= 5; // padding height -= panel.title ? 24 : 9; // subtract panel title bar elem.css('height', height + 'px'); diff --git a/src/app/partials/submenu.html b/src/app/partials/submenu.html index e82e2505afb..d103d62ad9a 100644 --- a/src/app/partials/submenu.html +++ b/src/app/partials/submenu.html @@ -36,6 +36,19 @@ + +
diff --git a/src/css/less/panel.less b/src/css/less/panel.less index 5c3dd93c6cf..3c64013d499 100644 --- a/src/css/less/panel.less +++ b/src/css/less/panel.less @@ -10,6 +10,11 @@ background: @grafanaPanelBackground; margin: 5px; position: relative; + &:hover { + .panel-actions { + display: block; + } + } } .panel-content { @@ -27,6 +32,8 @@ font-weight: bold; position: relative; cursor: context-menu; + width: 100%; + display: block; &.has-panel-links { .panel-title-text:after { @@ -124,3 +131,21 @@ border: 1px solid @grayDark; } } + +.panel-actions { + display: none; + position: absolute; + right: 0; + top: -2px; + width: 112px; + a { + opacity: 0.35; + border: 1px solid black; + padding: 5px 10px; + font-size: 75%; + background: @grafanaTargetFuncBackground; + &:hover { + opacity: 1; + } + } +} From 7ba0099fa9ca3e6b93810816ff590e6f2acf4c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 17 Nov 2014 09:59:37 +0100 Subject: [PATCH 04/19] Panel: fixes to panel menu when in edito/fullscreen mode, Fixes #1069 --- src/app/components/panelmeta.js | 8 ++--- src/app/directives/panelMenu.js | 29 ++++++++------- src/app/services/influxdb/influxSeries.js | 1 - src/css/less/grafana.less | 22 ------------ src/css/less/panel.less | 44 ++++++++++++++--------- src/test/specs/influxSeries-specs.js | 4 +-- 6 files changed, 50 insertions(+), 58 deletions(-) diff --git a/src/app/components/panelmeta.js b/src/app/components/panelmeta.js index 4fd97e9d02d..9b2b2d90104 100644 --- a/src/app/components/panelmeta.js +++ b/src/app/components/panelmeta.js @@ -12,12 +12,12 @@ function () { this.extendedMenu = []; if (options.fullscreen) { - this.addMenuItem('view', 'icon-eye-open', 'toggleFullscreen(false)'); + this.addMenuItem('view', 'icon-eye-open', 'toggleFullscreen(false); dismiss();'); } - this.addMenuItem('edit', 'icon-cog', 'editPanel()'); + this.addMenuItem('edit', 'icon-cog', 'editPanel(); dismiss();'); this.addMenuItem('duplicate', 'icon-copy', 'duplicatePanel()'); - this.addMenuItem('share', 'icon-share', 'sharePanel()'); + this.addMenuItem('share', 'icon-share', 'sharePanel(); dismiss();'); this.addEditorTab('General', 'app/partials/panelgeneral.html'); @@ -25,7 +25,7 @@ function () { this.addEditorTab('Metrics', 'app/partials/metrics.html'); } - this.addExtendedMenuItem('Panel JSON', '', 'editPanelJson()'); + this.addExtendedMenuItem('Panel JSON', '', 'editPanelJson(); dismiss();'); } PanelMeta.prototype.addMenuItem = function(text, icon, click) { diff --git a/src/app/directives/panelMenu.js b/src/app/directives/panelMenu.js index e727b57467f..4b3970fba39 100644 --- a/src/app/directives/panelMenu.js +++ b/src/app/directives/panelMenu.js @@ -13,11 +13,6 @@ function (angular, $, _) { '' + '{{panel.title | interpolateTemplateVars}}' + '' + - '' + - '' + - 'View' + - 'Edit' + - ''; ''; function createMenuTemplate($scope) { @@ -77,7 +72,7 @@ function (angular, $, _) { $link.toggleClass('has-panel-links', showIcon); }); - function dismiss(time) { + function dismiss(time, force) { clearTimeout(timeout); timeout = null; @@ -87,9 +82,11 @@ function (angular, $, _) { } // if hovering or draging pospone close - if ($menu.is(':hover') || $scope.dashboard.$$panelDragging) { - dismiss(2500); - return; + if (force !== true) { + if ($menu.is(':hover') || $scope.dashboard.$$panelDragging) { + dismiss(2200); + return; + } } if (menuScope) { @@ -102,7 +99,12 @@ function (angular, $, _) { } } - var showMenu = function() { + var showMenu = function(e) { + // if menu item is clicked and menu was just removed from dom ignore this event + if (!$.contains(document, e.target)) { + return; + } + if ($menu) { dismiss(); return; @@ -124,11 +126,14 @@ function (angular, $, _) { $menu = $(menuTemplate); $menu.css('left', menuLeftPos); $menu.mouseleave(function() { - //dismiss(1000); + dismiss(1000); }); menuScope = $scope.$new(); menuScope.extendedMenu = getExtendedMenu($scope); + menuScope.dismiss = function() { + dismiss(null, true); + }; $('.panel-menu').remove(); elem.append($menu); @@ -139,7 +144,7 @@ function (angular, $, _) { $(".panel-container").removeClass('panel-highlight'); $panelContainer.toggleClass('panel-highlight'); - //dismiss(2500); + dismiss(2200); }; if ($scope.panelMeta.titlePos && $scope.panel.title) { diff --git a/src/app/services/influxdb/influxSeries.js b/src/app/services/influxdb/influxSeries.js index 03b8c1cee71..ff6906dd087 100644 --- a/src/app/services/influxdb/influxSeries.js +++ b/src/app/services/influxdb/influxSeries.js @@ -69,7 +69,6 @@ function (_) { p.getAnnotations = function () { var list = []; var self = this; - console.log(this.seriesList); _.each(this.seriesList, function (series) { var titleCol = null; diff --git a/src/css/less/grafana.less b/src/css/less/grafana.less index c174fd46a59..0c099c1fee4 100644 --- a/src/css/less/grafana.less +++ b/src/css/less/grafana.less @@ -110,28 +110,6 @@ font-size: 12px; } -.panel-fullscreen { - z-index: 100; - display: block; - position: fixed; - left: 0px; - right: 0px; - top: 51px; - height: 100%; - padding: 0 10px; - background: @grafanaPanelBackground; - overflow-y: scroll; - height: 100%; - - .panel-content { - padding-bottom: 130px; - } - - .dropdown-menu { - margin-bottom: 70px; - } -} - .dashboard-fullscreen { .main-view-container { overflow: hidden; diff --git a/src/css/less/panel.less b/src/css/less/panel.less index 3c64013d499..7d00e2d9cec 100644 --- a/src/css/less/panel.less +++ b/src/css/less/panel.less @@ -79,6 +79,32 @@ bottom: 0; } +.panel-fullscreen { + z-index: 100; + display: block; + position: fixed; + left: 0px; + right: 0px; + top: 51px; + height: 100%; + padding: 0 10px; + background: @grafanaPanelBackground; + overflow-y: scroll; + height: 100%; + + .panel-content { + padding-bottom: 130px; + } + + .dropdown-menu { + margin-bottom: 70px; + } + + .panel-menu { + top: 0px; + } +} + .panel-menu { z-index: 1000; position: absolute; @@ -132,20 +158,4 @@ } } -.panel-actions { - display: none; - position: absolute; - right: 0; - top: -2px; - width: 112px; - a { - opacity: 0.35; - border: 1px solid black; - padding: 5px 10px; - font-size: 75%; - background: @grafanaTargetFuncBackground; - &:hover { - opacity: 1; - } - } -} + diff --git a/src/test/specs/influxSeries-specs.js b/src/test/specs/influxSeries-specs.js index 591e8a9d8f4..ee632748966 100644 --- a/src/test/specs/influxSeries-specs.js +++ b/src/test/specs/influxSeries-specs.js @@ -146,7 +146,7 @@ define([ { columns: ['time', 'text', 'sequence_number', 'title', 'tags'], name: 'events1', - points: [[1402596000, 'some text', 1, 'Hello', 'B'], [1402596001, 'asd', 2, 'Hello2', 'B']] + points: [[1402596000000, 'some text', 1, 'Hello', 'B'], [1402596001000, 'asd', 2, 'Hello2', 'B']] } ], annotation: { @@ -176,7 +176,7 @@ define([ { columns: ['time', 'text', 'sequence_number'], name: 'events1', - points: [[1402596000, 'some text', 1]] + points: [[1402596000000, 'some text', 1]] } ], annotation: { query: 'select' } From e197163019653c7abbbc2b7d624eee09cdc67bf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 17 Nov 2014 11:12:15 +0100 Subject: [PATCH 05/19] Changed version to 1.9-rc1 --- latest.json | 4 ++-- package.json | 2 +- src/app/partials/submenu.html | 13 ------------- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/latest.json b/latest.json index 30dd2d3127b..3573579f26f 100644 --- a/latest.json +++ b/latest.json @@ -1,4 +1,4 @@ { - "version": "1.8.1", - "url": "http://grafanarel.s3.amazonaws.com/grafana-1.8.1.tar.gz" + "version": "1.9.0-rc1", + "url": "http://grafanarel.s3.amazonaws.com/grafana-1.9.0-rc1.tar.gz" } diff --git a/package.json b/package.json index 90983011688..a6d7f0c905f 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "company": "Coding Instinct AB" }, "name": "grafana", - "version": "1.9.0", + "version": "1.9.0-rc1", "repository": { "type": "git", "url": "http://github.com/torkelo/grafana.git" diff --git a/src/app/partials/submenu.html b/src/app/partials/submenu.html index d103d62ad9a..e82e2505afb 100644 --- a/src/app/partials/submenu.html +++ b/src/app/partials/submenu.html @@ -36,19 +36,6 @@ - -
From 4f674c8d194e4b58ea1d2777b7a143efab0f5a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 17 Nov 2014 15:21:43 +0100 Subject: [PATCH 06/19] Updated changelog with RC1 release date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 090af032f30..bb2a4ef3354 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 1.9.0 (unreleased) +# 1.9.0-rc1 (2014-11-17) **UI Improvements* - [Issue #770](https://github.com/grafana/grafana/issues/770). UI: Panel dropdown menu replaced with a new panel menu From a677a4fefffc9b055c75260e4655ab46c89a4a88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 17 Nov 2014 16:13:47 +0100 Subject: [PATCH 07/19] Updated changelog with share panel feature, #864, it was missing --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb2a4ef3354..c0cf8ff4582 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - [Issue #951](https://github.com/grafana/grafana/issues/951). SingleStat: New singlestat panel **Misc** +- [Issue #864](https://github.com/grafana/grafana/issues/846). Panel: Share panel feature, get a link to panel with the current time range - [Issue #938](https://github.com/grafana/grafana/issues/938). Panel: Plugin panels now reside outside of app/panels directory - [Issue #952](https://github.com/grafana/grafana/issues/952). Help: Shortcut "?" to open help modal with list of all shortcuts - [Issue #991](https://github.com/grafana/grafana/issues/991). ScriptedDashboard: datasource services are now available in scripted dashboards, you can query datasource for metric keys, generate dashboards, and even save them in a scripted dashboard (see scripted_gen_and_save.js for example) From 6c0f5329aa94e6749cd985ce13c718c1a2b21ce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 17 Nov 2014 19:20:27 +0100 Subject: [PATCH 08/19] Graph: improved decimal precision in legend and graph hover when graph ticks use single decimal point, now graph legend and tooltip always use one more decimal precision than axis ticks (if axis ticks has decimals), Fixes #1072 --- src/app/panels/graph/graph.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/panels/graph/graph.js b/src/app/panels/graph/graph.js index aba28e6f5ec..837196660a6 100755 --- a/src/app/panels/graph/graph.js +++ b/src/app/panels/graph/graph.js @@ -115,7 +115,12 @@ function (angular, $, kbn, moment, _, GraphTooltip) { var series = data[i]; var axis = yaxis[series.yaxis - 1]; var formater = kbn.valueFormats[scope.panel.y_formats[series.yaxis - 1]]; - series.updateLegendValues(formater, axis.tickDecimals, axis.scaledDecimals + 2); + + // legend and tooltip gets one more decimal precision + // than graph legend ticks + var tickDecimals = (axis.tickDecimals || -1) + 1; + + series.updateLegendValues(formater, tickDecimals, axis.scaledDecimals + 2); if(!scope.$$phase) { scope.$digest(); } } } From a9d7823186fe4312f9c2668d6683a353201a235d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 18 Nov 2014 08:27:38 +0100 Subject: [PATCH 09/19] Singlestat: only show thresholds options when coloring option is checked, Fixes #1077 --- src/app/panels/singlestat/editor.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/panels/singlestat/editor.html b/src/app/panels/singlestat/editor.html index 885b1f20077..3265b3961d7 100644 --- a/src/app/panels/singlestat/editor.html +++ b/src/app/panels/singlestat/editor.html @@ -42,12 +42,12 @@
Coloring
-
+
-
- +
+ From 0c6618d2f6c01695d476ac7e814d85e7175a66f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 18 Nov 2014 16:58:26 +0100 Subject: [PATCH 10/19] Small tweaks --- src/app/controllers/row.js | 2 +- src/app/panels/graph/module.html | 4 +++- src/css/less/grafana.less | 2 -- src/css/less/variables.dark.less | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/controllers/row.js b/src/app/controllers/row.js index c92155d8d7e..dfd602751fb 100644 --- a/src/app/controllers/row.js +++ b/src/app/controllers/row.js @@ -107,7 +107,7 @@ function (angular, app, _) { var _as = 12 - $scope.dashboard.rowSpan($scope.row); $scope.panel = { - title: 'no title [click here]', + title: 'no title (click here)', error : false, span : _as < defaultSpan && _as > 0 ? _as : defaultSpan, editable: true, diff --git a/src/app/panels/graph/module.html b/src/app/panels/graph/module.html index dd9459ab6f9..65fbb00b1f7 100644 --- a/src/app/panels/graph/module.html +++ b/src/app/panels/graph/module.html @@ -4,7 +4,9 @@
- No datapoints Can be caused by timezone mismatch between browser and graphite server + + No datapoints No datapoints returned from metric query + Datapoints outside time range Can be caused by timezone mismatch between browser and graphite server
diff --git a/src/css/less/grafana.less b/src/css/less/grafana.less index 0c099c1fee4..55b86dccbe5 100644 --- a/src/css/less/grafana.less +++ b/src/css/less/grafana.less @@ -439,8 +439,6 @@ select.grafana-target-segment-input { line-height: 14px; } - - .grafana-tooltip hr { padding: 2px; color: #c8c8c8; diff --git a/src/css/less/variables.dark.less b/src/css/less/variables.dark.less index 42ab0bba861..dc0e2ba4da0 100644 --- a/src/css/less/variables.dark.less +++ b/src/css/less/variables.dark.less @@ -277,7 +277,7 @@ // Tooltips and popovers // ------------------------- @tooltipColor: #fff; -@tooltipBackground: @heroUnitBackground; +@tooltipBackground: rgb(58, 57, 57); @tooltipArrowWidth: 5px; @tooltipArrowColor: @tooltipBackground; From 1e425244d225ddd9515cb2a7e5d6b29bcac9a83c Mon Sep 17 00:00:00 2001 From: Jeff Klukas Date: Tue, 18 Nov 2014 14:15:15 -0600 Subject: [PATCH 11/19] Refactor timspan default in scripted examples. --- src/app/dashboards/scripted.js | 4 ++-- src/app/dashboards/scripted_async.js | 4 ++-- src/app/dashboards/scripted_templated.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/dashboards/scripted.js b/src/app/dashboards/scripted.js index f4a438b7854..6559a356aa5 100644 --- a/src/app/dashboards/scripted.js +++ b/src/app/dashboards/scripted.js @@ -23,7 +23,7 @@ var dashboard, timspan; var ARGS; // Set a default timespan if one isn't specified -timspan = '1d'; +timspan = ARGS.from || 'now-1d'; // Intialize a skeleton with nothing but a rows array and service object dashboard = { @@ -33,7 +33,7 @@ dashboard = { // Set a title dashboard.title = 'Scripted dash'; dashboard.time = { - from: "now-" + (ARGS.from || timspan), + from: timspan, to: "now" }; diff --git a/src/app/dashboards/scripted_async.js b/src/app/dashboards/scripted_async.js index 31d23f2dde2..0a50aa44d5e 100644 --- a/src/app/dashboards/scripted_async.js +++ b/src/app/dashboards/scripted_async.js @@ -25,7 +25,7 @@ return function(callback) { var dashboard, timspan; // Set a default timespan if one isn't specified - timspan = '1d'; + timspan = ARGS.from || 'now-1d'; // Intialize a skeleton with nothing but a rows array and service object dashboard = { @@ -36,7 +36,7 @@ return function(callback) { // Set a title dashboard.title = 'Scripted dash'; dashboard.time = { - from: "now-" + (ARGS.from || timspan), + from: timspan, to: "now" }; diff --git a/src/app/dashboards/scripted_templated.js b/src/app/dashboards/scripted_templated.js index 0ca4ea1fde8..9ce145f4606 100644 --- a/src/app/dashboards/scripted_templated.js +++ b/src/app/dashboards/scripted_templated.js @@ -23,7 +23,7 @@ var dashboard, timspan; var ARGS; // Set a default timespan if one isn't specified -timspan = '1d'; +timspan = ARGS.from || 'now-1d'; // Intialize a skeleton with nothing but a rows array and service object dashboard = { @@ -33,7 +33,7 @@ dashboard = { // Set a title dashboard.title = 'Scripted dash'; dashboard.time = { - from: "now-" + (ARGS.from || timspan), + from: timspan, to: "now" }; dashboard.templating = { From e16872c864b6595775eee2414046dbde221b4d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 19 Nov 2014 11:55:18 +0100 Subject: [PATCH 12/19] Updated angular-dragdrop to fix issue with IE9, Fixes #1087 --- src/app/app.js | 2 +- src/vendor/angular/angular-dragdrop.js | 70 ++++++++++++++++++++------ 2 files changed, 56 insertions(+), 16 deletions(-) diff --git a/src/app/app.js b/src/app/app.js index bb03d47686d..bc5ece75eda 100644 --- a/src/app/app.js +++ b/src/app/app.js @@ -62,7 +62,7 @@ function (angular, $, _, appLevelRequire, config) { var apps_deps = [ 'ngRoute', '$strap.directives', - 'ngDragDrop', + 'ang-drag-drop', 'grafana', 'pasvaz.bindonce' ]; diff --git a/src/vendor/angular/angular-dragdrop.js b/src/vendor/angular/angular-dragdrop.js index eb982ca0c8e..40fb1c9e814 100644 --- a/src/vendor/angular/angular-dragdrop.js +++ b/src/vendor/angular/angular-dragdrop.js @@ -6,13 +6,14 @@ * To change this template use File | Settings | File Templates. */ -(function(){ +(function(angular){ function isDnDsSupported(){ - return 'draggable' in document.createElement("span"); + return 'ondrag' in document.createElement("a"); } if(!isDnDsSupported()){ + angular.module("ang-drag-drop", []); return; } @@ -22,7 +23,7 @@ if (window.jQuery && (-1 == window.jQuery.event.props.indexOf("dataTransfer"))) var currentData; -angular.module("ngDragDrop",[]) +angular.module("ang-drag-drop",[]) .directive("uiDraggable", [ '$parse', '$rootScope', @@ -71,13 +72,13 @@ angular.module("ngDragDrop",[]) if (e.dataTransfer && e.dataTransfer.dropEffect !== "none") { if (attrs.onDropSuccess) { var fn = $parse(attrs.onDropSuccess); - scope.$apply(function () { + scope.$evalAsync(function () { fn(scope, {$event: e}); }); } else { if (attrs.onDropFailure) { var fn = $parse(attrs.onDropFailure); - scope.$apply(function () { + scope.$evalAsync(function () { fn(scope, {$event: e}); }); } @@ -101,7 +102,7 @@ angular.module("ngDragDrop",[]) if (dragImage) { var dragImageFn = $parse(attrs.dragImage); - scope.$apply(function() { + scope.$evalAsync(function() { var dragImageParameters = dragImageFn(scope, {$event: e}); if (dragImageParameters) { if (angular.isString(dragImageParameters)) { @@ -116,10 +117,10 @@ angular.module("ngDragDrop",[]) }); } - e.dataTransfer.setData("Text", sendData); + e.dataTransfer.setData("dataToSend", sendData); currentData = angular.fromJson(sendData); e.dataTransfer.effectAllowed = "copyMove"; - $rootScope.$broadcast("ANGULAR_DRAG_START", sendChannel); + $rootScope.$broadcast("ANGULAR_DRAG_START", sendChannel, currentData.data); } else { e.preventDefault(); @@ -138,6 +139,8 @@ angular.module("ngDragDrop",[]) var dragChannel = ""; var dragEnterClass = attr.dragEnterClass || "on-drag-enter"; var dragHoverClass = attr.dragHoverClass || "on-drag-hover"; + var customDragEnterEvent = $parse(attr.onDragEnter); + var customDragLeaveEvent = $parse(attr.onDragLeave); function onDragOver(e) { if (e.preventDefault) { @@ -148,20 +151,57 @@ angular.module("ngDragDrop",[]) e.stopPropagation(); } + var fn = $parse(attr.uiOnDragOver); + scope.$evalAsync(function () { + fn(scope, {$event: e, $channel: dropChannel}); + }); + e.dataTransfer.dropEffect = e.shiftKey ? 'copy' : 'move'; return false; } function onDragLeave(e) { - dragging--; - if (dragging == 0) { - element.removeClass(dragHoverClass); - } + if (e.preventDefault) { + e.preventDefault(); + } + + if (e.stopPropagation) { + e.stopPropagation(); + } + dragging--; + + if (dragging == 0) { + scope.$evalAsync(function () { + customDragEnterEvent(scope, {$event: e}); + }); + element.removeClass(dragHoverClass); + } + + var fn = $parse(attr.uiOnDragLeave); + scope.$evalAsync(function () { + fn(scope, {$event: e, $channel: dropChannel}); + }); } function onDragEnter(e) { + if (e.preventDefault) { + e.preventDefault(); + } + + if (e.stopPropagation) { + e.stopPropagation(); + } dragging++; + + var fn = $parse(attr.uiOnDragEnter); + scope.$evalAsync(function () { + fn(scope, {$event: e, $channel: dropChannel}); + }); + $rootScope.$broadcast("ANGULAR_HOVER", dragChannel); + scope.$evalAsync(function () { + customDragLeaveEvent(scope, {$event: e}); + }); element.addClass(dragHoverClass); } @@ -173,11 +213,11 @@ angular.module("ngDragDrop",[]) e.stopPropagation(); // Necessary. Allows us to drop. } - var sendData = e.dataTransfer.getData("Text"); + var sendData = e.dataTransfer.getData("dataToSend"); sendData = angular.fromJson(sendData); var fn = $parse(attr.uiOnDrop); - scope.$apply(function () { + scope.$evalAsync(function () { fn(scope, {$data: sendData.data, $event: e, $channel: sendData.channel}); }); element.removeClass(dragEnterClass); @@ -338,4 +378,4 @@ angular.module("ngDragDrop",[]) } ]); -}()); +}(angular)); From d0d1c5ea5f2a2476e1922c77bbb3ca3fd6c99fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 19 Nov 2014 11:57:00 +0100 Subject: [PATCH 13/19] updated changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0cf8ff4582..08c0967fba7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 1.9.0 (unreleased) + +**Fixes** +- [Issue #1087](https://github.com/grafana/grafana/issues/1087). Bug: Fixed IE9 crash due to angular drag drop + # 1.9.0-rc1 (2014-11-17) **UI Improvements* From 56321da9c121bd13859bd9c7d7c9b53d69c2db78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 19 Nov 2014 15:26:14 +0100 Subject: [PATCH 14/19] Bug: Fixed position for drilldown link tooltip when dashboard requires scrolling, Fixes #1093 --- CHANGELOG.md | 1 + src/app/panels/singlestat/singleStatPanel.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08c0967fba7..bed1270a7aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ **Fixes** - [Issue #1087](https://github.com/grafana/grafana/issues/1087). Bug: Fixed IE9 crash due to angular drag drop +- [Issue #1093](https://github.com/grafana/grafana/issues/1093). Bug: Fixed position for drilldown link tooltip when dashboard requires scrolling # 1.9.0-rc1 (2014-11-17) diff --git a/src/app/panels/singlestat/singleStatPanel.js b/src/app/panels/singlestat/singleStatPanel.js index 3bd9ce54465..57df1a5eaae 100644 --- a/src/app/panels/singlestat/singleStatPanel.js +++ b/src/app/panels/singlestat/singleStatPanel.js @@ -196,7 +196,7 @@ function (angular, app, _, $) { drilldownTooltip.text('click to go to: ' + panel.links[0].title); - drilldownTooltip.place_tt(e.clientX+20, e.clientY-15); + drilldownTooltip.place_tt(e.pageX+20, e.pageY-15); }); } }; From de10bd4ef644bcc03ea1e0f970566bf84983bba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 19 Nov 2014 15:33:00 +0100 Subject: [PATCH 15/19] DrilldownLink: template variables in params property was not interpolated, Fixes #1095 --- CHANGELOG.md | 5 +++-- src/app/features/panellinkeditor/linkSrv.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bed1270a7aa..f785ad5a0a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ # 1.9.0 (unreleased) **Fixes** -- [Issue #1087](https://github.com/grafana/grafana/issues/1087). Bug: Fixed IE9 crash due to angular drag drop -- [Issue #1093](https://github.com/grafana/grafana/issues/1093). Bug: Fixed position for drilldown link tooltip when dashboard requires scrolling +- [Issue #1087](https://github.com/grafana/grafana/issues/1087). Panel: Fixed IE9 crash due to angular drag drop +- [Issue #1093](https://github.com/grafana/grafana/issues/1093). SingleStatPanel: Fixed position for drilldown link tooltip when dashboard requires scrolling +- [Issue #1095](https://github.com/grafana/grafana/issues/1095). DrilldownLink: template variables in params property was not interpolated # 1.9.0-rc1 (2014-11-17) diff --git a/src/app/features/panellinkeditor/linkSrv.js b/src/app/features/panellinkeditor/linkSrv.js index eacdf1d2c35..8d06b22b99d 100644 --- a/src/app/features/panellinkeditor/linkSrv.js +++ b/src/app/features/panellinkeditor/linkSrv.js @@ -29,7 +29,7 @@ function (angular, kbn) { info.href += '&to=' + range.to; if (link.params) { - info.href += "&" + link.params; + info.href += "&" + templateSrv.replace(link.params); } return info; From dd398f73c2402ea21fb74644bbd3f47937180aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 19 Nov 2014 15:41:16 +0100 Subject: [PATCH 16/19] Css tweak to dark theme, mark submenu carets (ie arrows) white, Fixes #1098 --- src/css/less/bootswatch.dark.less | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/css/less/bootswatch.dark.less b/src/css/less/bootswatch.dark.less index 7de0ab97437..5bd893e0fc7 100644 --- a/src/css/less/bootswatch.dark.less +++ b/src/css/less/bootswatch.dark.less @@ -575,3 +575,12 @@ a:hover { // MEDIA QUERIES // ----------------------------------------------------- + +.caret { + color: @textColor +} + +.dropdown-submenu > a:after { + border-left-color: @textColor; +} + From 91d66413269b6bcdcf4de24005aa311b705a088c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 19 Nov 2014 16:01:04 +0100 Subject: [PATCH 17/19] Graph: fixed issue with shared tooltip when one or more series is hidden, Fixes #1094 --- src/app/panels/graph/graph.tooltip.js | 19 +++++++++++++----- src/test/specs/graph-tooltip-specs.js | 28 +++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/src/app/panels/graph/graph.tooltip.js b/src/app/panels/graph/graph.tooltip.js index e0fede2f62d..4c5f727f919 100644 --- a/src/app/panels/graph/graph.tooltip.js +++ b/src/app/panels/graph/graph.tooltip.js @@ -38,18 +38,26 @@ function ($) { }; this.getMultiSeriesPlotHoverInfo = function(seriesList, pos) { - var value, i, series, hoverIndex; + var value, i, series, hoverIndex, seriesTmp; var results = []; - var pointCount = seriesList[0].data.length; - for (i = 1; i < seriesList.length; i++) { - if (seriesList[i].data.length !== pointCount) { + var pointCount; + for (i = 0; i < seriesList.length; i++) { + seriesTmp = seriesList[i]; + if (!seriesTmp.data.length) { continue; } + + if (!pointCount) { + series = seriesTmp; + pointCount = series.data.length; + continue; + } + + if (seriesTmp.data.length !== pointCount) { results.pointCountMismatch = true; return results; } } - series = seriesList[0]; hoverIndex = this.findHoverIndexFromData(pos.x, series); var lasthoverIndex = 0; if(!scope.panel.steppedLine) { @@ -62,6 +70,7 @@ function ($) { for (i = 0; i < seriesList.length; i++) { series = seriesList[i]; + if (!series.data.length) { continue; } if (scope.panel.stack) { if (scope.panel.tooltip.value_type === 'individual') { diff --git a/src/test/specs/graph-tooltip-specs.js b/src/test/specs/graph-tooltip-specs.js index 6d1b9a40a58..b7def74ac89 100644 --- a/src/test/specs/graph-tooltip-specs.js +++ b/src/test/specs/graph-tooltip-specs.js @@ -59,6 +59,34 @@ define([ }); }); + describeSharedTooltip("point count missmatch", function(ctx) { + ctx.setup(function() { + ctx.data = [ + { data: [[10, 15], [12, 20]], }, + { data: [[10, 2]] } + ]; + ctx.pos = { x: 11 }; + }); + + it('should set pointCountMismatch to true', function() { + expect(ctx.results.pointCountMismatch).to.be(true); + }); + }); + + describeSharedTooltip("one series is hidden", function(ctx) { + ctx.setup(function() { + ctx.data = [ + { data: [[10, 15], [12, 20]], }, + { data: [] } + ]; + ctx.pos = { x: 11 }; + }); + + it('should set pointCountMismatch to false', function() { + expect(ctx.results.pointCountMismatch).to.be(undefined); + }); + }); + describeSharedTooltip("steppedLine false, stack true, individual false", function(ctx) { ctx.setup(function() { ctx.data = [ From 6392d6514e41a6e7eb43187a5716b40ddd60253f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 20 Nov 2014 09:00:30 +0100 Subject: [PATCH 18/19] Graphite: fixed: moving graphite function left/right did not update query, Fixes #1100 --- src/app/directives/graphiteFuncEditor.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/directives/graphiteFuncEditor.js b/src/app/directives/graphiteFuncEditor.js index dff8003f54f..2deef5b5246 100644 --- a/src/app/directives/graphiteFuncEditor.js +++ b/src/app/directives/graphiteFuncEditor.js @@ -206,6 +206,7 @@ function (angular, _, $) { if ($target.hasClass('icon-arrow-left')) { $scope.$apply(function() { _.move($scope.functions, $scope.$index, $scope.$index - 1); + $scope.targetChanged(); }); return; } @@ -213,6 +214,7 @@ function (angular, _, $) { if ($target.hasClass('icon-arrow-right')) { $scope.$apply(function() { _.move($scope.functions, $scope.$index, $scope.$index + 1); + $scope.targetChanged(); }); return; } From 62b58d8bb00ce5f2bf2403faedc3a650ae70cfc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 20 Nov 2014 09:09:59 +0100 Subject: [PATCH 19/19] Updated scripted dashboard example --- src/app/dashboards/scripted.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/dashboards/scripted.js b/src/app/dashboards/scripted.js index 6559a356aa5..8fca0248496 100644 --- a/src/app/dashboards/scripted.js +++ b/src/app/dashboards/scripted.js @@ -22,9 +22,6 @@ var dashboard, timspan; // All url parameters are available via the ARGS object var ARGS; -// Set a default timespan if one isn't specified -timspan = ARGS.from || 'now-1d'; - // Intialize a skeleton with nothing but a rows array and service object dashboard = { rows : [], @@ -32,8 +29,12 @@ dashboard = { // Set a title dashboard.title = 'Scripted dash'; + +// set default time +// time can be overriden in the url using from/to parameteres, but this is +// handled automatically in grafana core during dashboard initialization dashboard.time = { - from: timspan, + from: 'now-6h', to: "now" };