From 9f766557f1275f46f9bca0139d5249fdd73a5cdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 15 Dec 2014 17:30:01 +0100 Subject: [PATCH 01/22] Dashboard: fixed minor issue when trying to aborting dashboard delete from search list, Fixes #1233 --- src/app/controllers/dashboardNavCtrl.js | 1 + src/app/controllers/search.js | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/app/controllers/dashboardNavCtrl.js b/src/app/controllers/dashboardNavCtrl.js index 3e3321b7d0d..14a914821b1 100644 --- a/src/app/controllers/dashboardNavCtrl.js +++ b/src/app/controllers/dashboardNavCtrl.js @@ -107,6 +107,7 @@ function (angular, _, moment, config, store) { $scope.deleteDashboardConfirmed = function(options) { var id = options.id; $scope.db.deleteDashboard(id).then(function(id) { + $scope.appEvent('dashboard-deleted', id); $scope.appEvent('alert-success', ['Dashboard Deleted', id + ' has been deleted']); }, function(err) { $scope.appEvent('alert-error', ['Deleted failed', err]); diff --git a/src/app/controllers/search.js b/src/app/controllers/search.js index 4977ced75af..3abcf4ec0a3 100644 --- a/src/app/controllers/search.js +++ b/src/app/controllers/search.js @@ -19,6 +19,9 @@ function (angular, _, config, $) { $scope.db = datasourceSrv.getGrafanaDB(); $scope.currentSearchId = 0; + // events + $scope.onAppEvent('dashboard-deleted', $scope.dashboardDeleted); + $timeout(function() { $scope.giveSearchFocus = $scope.giveSearchFocus + 1; $scope.query.query = 'title:'; @@ -123,6 +126,10 @@ function (angular, _, config, $) { $scope.deleteDashboard = function(dash, evt) { evt.stopPropagation(); $scope.appEvent('delete-dashboard', { id: dash.id, title: dash.title }); + }; + + $scope.dashboardDeleted = function(evt, id) { + var dash = _.findWhere($scope.results.dashboards, {id: id}); $scope.results.dashboards = _.without($scope.results.dashboards, dash); }; From f79588c19137219f5dfec8db407a670bd74f5295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 16 Dec 2014 15:47:10 +0100 Subject: [PATCH 02/22] Annotations: mini fix for annotations editor and the list of annotations --- CHANGELOG.md | 2 +- src/app/partials/annotations_editor.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d832a6e076d..b860b20c42c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # 1.9.1 (unreleased) **Enhancements** -- [Issue #1028](https://github.com/grafana/grafana/issues/1028). Graph: New legend option ``hideEmtpy`` to hide series with only null values +- [Issue #1028](https://github.com/grafana/grafana/issues/1028). Graph: New legend option ``hideEmtpy`` to hide series with only null values from legend **Fixes** - [Issue #1199](https://github.com/grafana/grafana/issues/1199). Graph: fix for series tooltip when one series is hidden/disabled diff --git a/src/app/partials/annotations_editor.html b/src/app/partials/annotations_editor.html index a470dcb082e..cec67e28e66 100644 --- a/src/app/partials/annotations_editor.html +++ b/src/app/partials/annotations_editor.html @@ -16,7 +16,7 @@
-
+
No annotations defined
From 5a46c2397b5a0b8c4cd507a33031eba9d9b08e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 17 Dec 2014 13:34:52 +0100 Subject: [PATCH 03/22] OpenTSDB: Downsample query field now supports interval template variable, Closes #1242 --- CHANGELOG.md | 1 + src/app/services/opentsdb/opentsdbDatasource.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b860b20c42c..e451b7bf50a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ **Enhancements** - [Issue #1028](https://github.com/grafana/grafana/issues/1028). Graph: New legend option ``hideEmtpy`` to hide series with only null values from legend +- [Issue #1242](https://github.com/grafana/grafana/issues/1242). OpenTSDB: Downsample query field now supports interval template variable **Fixes** - [Issue #1199](https://github.com/grafana/grafana/issues/1199). Graph: fix for series tooltip when one series is hidden/disabled diff --git a/src/app/services/opentsdb/opentsdbDatasource.js b/src/app/services/opentsdb/opentsdbDatasource.js index 96784cbc992..976f5c84cba 100644 --- a/src/app/services/opentsdb/opentsdbDatasource.js +++ b/src/app/services/opentsdb/opentsdbDatasource.js @@ -148,7 +148,7 @@ function (angular, _, kbn) { } if (target.shouldDownsample) { - query.downsample = target.downsampleInterval + "-" + target.downsampleAggregator; + query.downsample = templateSrv.replace(target.downsampleInterval) + "-" + target.downsampleAggregator; } query.tags = angular.copy(target.tags); From a58330f4d8f0954f3d5455e274523ff499be588d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 17 Dec 2014 14:14:24 +0100 Subject: [PATCH 04/22] InfluxDB: Support more than 10 series name segments when using alias patterns, Closes #1126 --- CHANGELOG.md | 1 + src/app/services/influxdb/influxSeries.js | 26 ++++++++++++----------- src/test/specs/influxSeries-specs.js | 21 ++++++++++++++++++ 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e451b7bf50a..70bd5222a91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ **Enhancements** - [Issue #1028](https://github.com/grafana/grafana/issues/1028). Graph: New legend option ``hideEmtpy`` to hide series with only null values from legend - [Issue #1242](https://github.com/grafana/grafana/issues/1242). OpenTSDB: Downsample query field now supports interval template variable +- [Issue #1126](https://github.com/grafana/grafana/issues/1126). InfluxDB: Support more than 10 series name segments when using alias ``$number`` patterns **Fixes** - [Issue #1199](https://github.com/grafana/grafana/issues/1199). Graph: fix for series tooltip when one series is hidden/disabled diff --git a/src/app/services/influxdb/influxSeries.js b/src/app/services/influxdb/influxSeries.js index ff6906dd087..bca6ca7a865 100644 --- a/src/app/services/influxdb/influxSeries.js +++ b/src/app/services/influxdb/influxSeries.js @@ -106,21 +106,23 @@ function (_) { }; p.createNameForSeries = function(seriesName, groupByColValue) { - var name = this.alias - .replace('$s', seriesName); - + var regex = /\$(\w+)/g; var segments = seriesName.split('.'); - for (var i = 0; i < segments.length; i++) { - if (segments[i].length > 0) { - name = name.replace('$' + i, segments[i]); + + return this.alias.replace(regex, function(match, group) { + if (group === 's') { + return seriesName; } - } + else if (group === 'g') { + return groupByColValue; + } + var index = parseInt(group); + if (_.isNumber(index) && index < segments.length) { + return segments[index]; + } + return match; + }); - if (this.groupByField) { - name = name.replace('$g', groupByColValue); - } - - return name; }; return InfluxSeries; diff --git a/src/test/specs/influxSeries-specs.js b/src/test/specs/influxSeries-specs.js index ee632748966..9a38eb7f46d 100644 --- a/src/test/specs/influxSeries-specs.js +++ b/src/test/specs/influxSeries-specs.js @@ -80,6 +80,27 @@ define([ }); + describe('given an alias format and many segments', function() { + var series = new InfluxSeries({ + seriesList: [ + { + columns: ['time', 'mean', 'sequence_number'], + name: 'a0.a1.a2.a3.a4.a5.a6.a7.a8.a9.a10.a11.a12', + points: [[1402596000, 10, 1], [1402596001, 12, 2]] + } + ], + alias: '$5.$11.mean' + }); + + var result = series.getTimeSeries(); + + it('should generate correct series name', function() { + expect(result[0].target).to.be('a5.a11.mean'); + }); + + }); + + describe('given an alias format with group by field', function() { var series = new InfluxSeries({ seriesList: [ From fed06ef97dcaf8e9025bbfceab521e0c87ef7c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 18 Dec 2014 08:44:47 +0100 Subject: [PATCH 05/22] Graph: Fix for y axis and scaled units (GiB etc) caused rounding, for example 400 GiB instead of 378 GiB, Fixes #1251 --- CHANGELOG.md | 1 + src/app/components/kbn.js | 2 +- src/test/specs/kbn-format-specs.js | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70bd5222a91..58b08eacb4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - [Issue #1126](https://github.com/grafana/grafana/issues/1126). InfluxDB: Support more than 10 series name segments when using alias ``$number`` patterns **Fixes** +- [Issue #1251](https://github.com/grafana/grafana/issues/1251). Graph: Fix for y axis and scaled units (GiB etc) caused rounding, for example 400 GiB instead of 378 GiB - [Issue #1199](https://github.com/grafana/grafana/issues/1199). Graph: fix for series tooltip when one series is hidden/disabled - [Issue #1207](https://github.com/grafana/grafana/issues/1207). Graphite: movingAverage / movingMedian parameter type impovement, now handles int and interval parameter diff --git a/src/app/components/kbn.js b/src/app/components/kbn.js index ecef4bd164e..aedfbb90f17 100644 --- a/src/app/components/kbn.js +++ b/src/app/components/kbn.js @@ -339,7 +339,7 @@ function($, _, moment) { return ""; } - var factor = decimals ? Math.pow(10, decimals) : 1; + var factor = decimals ? Math.pow(10, Math.max(0, decimals)) : 1; var formatted = String(Math.round(value * factor) / factor); // if exponent return directly diff --git a/src/test/specs/kbn-format-specs.js b/src/test/specs/kbn-format-specs.js index e92e6d0ceec..785d9376411 100644 --- a/src/test/specs/kbn-format-specs.js +++ b/src/test/specs/kbn-format-specs.js @@ -29,6 +29,13 @@ define([ describeValueFormat('ns', 25, 1, 0, '25 ns'); describeValueFormat('ns', 2558, 50, 0, '2.56 µs'); + describe('kbn.toFixed and negative decimals', function() { + it('should treat as zero decimals', function() { + var str = kbn.toFixed(186.123, -2); + expect(str).to.be('186'); + }); + }); + describe('calculateInterval', function() { it('1h 100 resultion', function() { var range = { from: kbn.parseDate('now-1h'), to: kbn.parseDate('now') }; From 731bb6ba03cebddac34213550cce6a729b51ecd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 18 Dec 2014 09:12:36 +0100 Subject: [PATCH 06/22] Graph: hover tooltip and axis format units fix, bug introduced last week --- src/app/panels/graph/graph.tooltip.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/app/panels/graph/graph.tooltip.js b/src/app/panels/graph/graph.tooltip.js index 9100fed47cf..9e750cb6a9c 100644 --- a/src/app/panels/graph/graph.tooltip.js +++ b/src/app/panels/graph/graph.tooltip.js @@ -70,7 +70,11 @@ function ($) { for (i = 0; i < seriesList.length; i++) { series = seriesList[i]; - if (!series.data.length) { continue; } + + if (!series.data.length) { + results.push({ hidden: true }); + continue; + } if (scope.panel.stack) { if (scope.panel.tooltip.value_type === 'individual') { @@ -99,9 +103,9 @@ function ($) { lasthoverIndex = hoverIndex; } - results.push({ value: value, hoverIndex: newhoverIndex, series: series }); + results.push({ value: value, hoverIndex: newhoverIndex}); } else { - results.push({ value: value, hoverIndex: hoverIndex, series: series }); + results.push({ value: value, hoverIndex: hoverIndex}); } } @@ -150,7 +154,12 @@ function ($) { for (i = 0; i < seriesHoverInfo.length; i++) { hoverInfo = seriesHoverInfo[i]; - series = hoverInfo.series; + + if (hoverInfo.hidden) { + continue; + } + + series = seriesList[i]; value = series.formatValue(hoverInfo.value); seriesHtml += '
'; From 1b3bddd6225b1cad328e68814e1ef6d7270fc902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 19 Dec 2014 08:39:23 +0100 Subject: [PATCH 07/22] Graph: graph spinner should not stop until annotation request is complete, #1235 --- src/app/panels/graph/module.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/panels/graph/module.js b/src/app/panels/graph/module.js index 90b6957b8b5..335fd4e52a3 100644 --- a/src/app/panels/graph/module.js +++ b/src/app/panels/graph/module.js @@ -146,10 +146,9 @@ function (angular, app, $, _, kbn, moment, TimeSeries, PanelMeta) { }; $scope.dataHandler = function(results) { - $scope.panelMeta.loading = false; - // png renderer returns just a url if (_.isString(results)) { + $scope.panelMeta.loading = false; $scope.render(results); return; } @@ -164,9 +163,11 @@ function (angular, app, $, _, kbn, moment, TimeSeries, PanelMeta) { $scope.annotationsPromise .then(function(annotations) { + $scope.panelMeta.loading = false; $scope.seriesList.annotations = annotations; $scope.render($scope.seriesList); }, function() { + $scope.panelMeta.loading = false; $scope.render($scope.seriesList); }); }; From 32ae0ea13e537ba58a845fdc7ee63cf46046c91f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 23 Dec 2014 11:31:49 +0100 Subject: [PATCH 08/22] Plugins: Custom datasource example adapted to return timestamps in millieseconds, Fixes #1263 --- src/plugins/datasource.example.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/datasource.example.js b/src/plugins/datasource.example.js index fcc160ec569..1861474e1a3 100644 --- a/src/plugins/datasource.example.js +++ b/src/plugins/datasource.example.js @@ -21,8 +21,8 @@ function (angular, _, kbn) { CustomDatasource.prototype.query = function(options) { // get from & to in seconds - var from = kbn.parseDate(options.range.from).getTime() / 1000; - var to = kbn.parseDate(options.range.to).getTime() / 1000; + var from = kbn.parseDate(options.range.from).getTime(); + var to = kbn.parseDate(options.range.to).getTime(); var series = []; var stepInSeconds = (to - from) / options.maxDataPoints; From 85e50ece2ef6f59ac56541dddeb3ec7d444e415f Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Tue, 23 Dec 2014 12:01:50 -0800 Subject: [PATCH 09/22] Allow for plugin testing. With this change in place you can include plugin specs in `grunt test` by creating a `src/config.js` like that includes something like this: ```js plugins: { // list of plugin panels panels: [], // requirejs modules in plugins folder that should be loaded // for example custom datasources dependencies: ['grafana-plugins/atlasDatasource'], specs: ['grafana-plugins/specs/atlasDatasource-specs'] } ``` --- src/test/specs/graph-ctrl-specs.js | 2 +- src/test/specs/graph-specs.js | 2 +- src/test/specs/graphiteDatasource-specs.js | 2 +- src/test/specs/graphiteTargetCtrl-specs.js | 2 +- src/test/specs/influxdb-datasource-specs.js | 2 +- src/test/specs/row-ctrl-specs.js | 2 +- src/test/specs/seriesOverridesCtrl-specs.js | 2 +- src/test/specs/sharePanelCtrl-specs.js | 2 +- src/test/specs/templateValuesSrv-specs.js | 2 +- src/test/specs/timeSrv-specs.js | 2 +- src/test/test-main.js | 17 ++++++++++++----- tasks/options/jscs.js | 1 + 12 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/test/specs/graph-ctrl-specs.js b/src/test/specs/graph-ctrl-specs.js index fded5b93ee2..13cd56857f5 100644 --- a/src/test/specs/graph-ctrl-specs.js +++ b/src/test/specs/graph-ctrl-specs.js @@ -1,5 +1,5 @@ define([ - './helpers', + 'helpers', 'panels/graph/module' ], function(helpers) { 'use strict'; diff --git a/src/test/specs/graph-specs.js b/src/test/specs/graph-specs.js index 71c04084e91..98968adaa09 100644 --- a/src/test/specs/graph-specs.js +++ b/src/test/specs/graph-specs.js @@ -1,5 +1,5 @@ define([ - './helpers', + 'helpers', 'angular', 'jquery', 'components/timeSeries', diff --git a/src/test/specs/graphiteDatasource-specs.js b/src/test/specs/graphiteDatasource-specs.js index f112492aebc..2d0ff4be118 100644 --- a/src/test/specs/graphiteDatasource-specs.js +++ b/src/test/specs/graphiteDatasource-specs.js @@ -1,5 +1,5 @@ define([ - './helpers', + 'helpers', 'services/graphite/graphiteDatasource' ], function(helpers) { 'use strict'; diff --git a/src/test/specs/graphiteTargetCtrl-specs.js b/src/test/specs/graphiteTargetCtrl-specs.js index 3e321c9e4a4..c62cea5e37e 100644 --- a/src/test/specs/graphiteTargetCtrl-specs.js +++ b/src/test/specs/graphiteTargetCtrl-specs.js @@ -1,5 +1,5 @@ define([ - './helpers', + 'helpers', 'services/graphite/gfunc', 'controllers/graphiteTarget' ], function(helpers, gfunc) { diff --git a/src/test/specs/influxdb-datasource-specs.js b/src/test/specs/influxdb-datasource-specs.js index c0d25e1e81f..11d8a9e80c4 100644 --- a/src/test/specs/influxdb-datasource-specs.js +++ b/src/test/specs/influxdb-datasource-specs.js @@ -1,5 +1,5 @@ define([ - './helpers', + 'helpers', 'services/influxdb/influxdbDatasource' ], function(helpers) { 'use strict'; diff --git a/src/test/specs/row-ctrl-specs.js b/src/test/specs/row-ctrl-specs.js index 41543784f40..bfb61c1ab9b 100644 --- a/src/test/specs/row-ctrl-specs.js +++ b/src/test/specs/row-ctrl-specs.js @@ -1,5 +1,5 @@ define([ - './helpers', + 'helpers', 'controllers/row' ], function(helpers) { 'use strict'; diff --git a/src/test/specs/seriesOverridesCtrl-specs.js b/src/test/specs/seriesOverridesCtrl-specs.js index 6a96c77416d..0542e613a34 100644 --- a/src/test/specs/seriesOverridesCtrl-specs.js +++ b/src/test/specs/seriesOverridesCtrl-specs.js @@ -1,5 +1,5 @@ define([ - './helpers', + 'helpers', 'panels/graph/seriesOverridesCtrl' ], function(helpers) { 'use strict'; diff --git a/src/test/specs/sharePanelCtrl-specs.js b/src/test/specs/sharePanelCtrl-specs.js index 8c83f008ed5..7bab63adc3a 100644 --- a/src/test/specs/sharePanelCtrl-specs.js +++ b/src/test/specs/sharePanelCtrl-specs.js @@ -1,5 +1,5 @@ define([ - './helpers', + 'helpers', 'controllers/sharePanelCtrl' ], function(helpers) { 'use strict'; diff --git a/src/test/specs/templateValuesSrv-specs.js b/src/test/specs/templateValuesSrv-specs.js index bc0de36e959..8ca5e6a87ae 100644 --- a/src/test/specs/templateValuesSrv-specs.js +++ b/src/test/specs/templateValuesSrv-specs.js @@ -1,6 +1,6 @@ define([ 'mocks/dashboard-mock', - './helpers', + 'helpers', 'moment', 'services/templateValuesSrv' ], function(dashboardMock, helpers, moment) { diff --git a/src/test/specs/timeSrv-specs.js b/src/test/specs/timeSrv-specs.js index 1d8a158e27e..86ee37ebac4 100644 --- a/src/test/specs/timeSrv-specs.js +++ b/src/test/specs/timeSrv-specs.js @@ -1,6 +1,6 @@ define([ 'mocks/dashboard-mock', - './helpers', + 'helpers', 'lodash', 'services/timeSrv' ], function(dashboardMock, helpers, _) { diff --git a/src/test/test-main.js b/src/test/test-main.js index 0bd14949b33..5783b885d59 100644 --- a/src/test/test-main.js +++ b/src/test/test-main.js @@ -4,7 +4,8 @@ require.config({ paths: { specs: '../test/specs', mocks: '../test/mocks', - config: '../config.sample', + helpers: '../test/specs/helpers', + config: ['../config', '../config.sample'], kbn: 'components/kbn', store: 'components/store', @@ -96,9 +97,10 @@ require.config({ require([ 'angular', + 'config', 'angularMocks', 'app', -], function(angular) { +], function(angular, config) { 'use strict'; for (var file in window.__karma__.files) { @@ -113,7 +115,7 @@ require([ angular.module('grafana.panels', []); angular.module('grafana.filters', []); - require([ + var specs = [ 'specs/lexer-specs', 'specs/parser-specs', 'specs/gfunc-specs', @@ -135,9 +137,14 @@ require([ 'specs/kbn-format-specs', 'specs/dashboardSrv-specs', 'specs/dashboardViewStateSrv-specs' - ], function () { - window.__karma__.start(); + ]; + + var pluginSpecs = (config.plugins.specs || []).map(function (spec) { + return '../plugins/' + spec; }); + require(specs.concat(pluginSpecs), function () { + window.__karma__.start(); + }); }); diff --git a/tasks/options/jscs.js b/tasks/options/jscs.js index 313893b440d..7a5dee05778 100644 --- a/tasks/options/jscs.js +++ b/tasks/options/jscs.js @@ -3,6 +3,7 @@ module.exports = function(config) { src: [ 'Gruntfile.js', '<%= srcDir %>/app/**/*.js', + '<%= srcDir %>/plugins/**/*.js', '!<%= srcDir %>/app/panels/*/{lib,leaflet}/*', '!<%= srcDir %>/app/dashboards/*' ], From 6cb4b4061ca9c9015ce5304586442163c4010c0f Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Tue, 23 Dec 2014 18:12:04 -0800 Subject: [PATCH 10/22] Bring panel alert to front and move tooltip to top. This makes the panel a lot easier to mouse over without odd visual effects. --- src/app/directives/grafanaPanel.js | 2 +- src/css/less/panel.less | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/directives/grafanaPanel.js b/src/app/directives/grafanaPanel.js index 9e3c87fde3d..5709c1dddf2 100644 --- a/src/app/directives/grafanaPanel.js +++ b/src/app/directives/grafanaPanel.js @@ -18,7 +18,7 @@ function (angular, $, config) { '
'+ '' + - '' + + '' + '' + '' + '' + diff --git a/src/css/less/panel.less b/src/css/less/panel.less index 7d00e2d9cec..8ff4a50c01b 100644 --- a/src/css/less/panel.less +++ b/src/css/less/panel.less @@ -62,6 +62,7 @@ left: 0; padding: 0px 17px 6px 5px; top: 0; + z-index: 10; i { position: relative; top: -2px; From f5e8f9334be707c54f2080a2df3cb0f20e4d995a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 26 Dec 2014 11:50:59 +0100 Subject: [PATCH 11/22] Fixed test failing in chrome --- src/test/specs/dashboardSrv-specs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/specs/dashboardSrv-specs.js b/src/test/specs/dashboardSrv-specs.js index 18eb13d3a18..6dc19b1a2ce 100644 --- a/src/test/specs/dashboardSrv-specs.js +++ b/src/test/specs/dashboardSrv-specs.js @@ -95,7 +95,7 @@ define([ beforeEach(module('grafana.services')); beforeEach(inject(function(dashboardSrv) { model = dashboardSrv.create({ - services: { filter: { time: { from: 'now-1d', to: 'now'}, list: [1] }}, + services: { filter: { time: { from: 'now-1d', to: 'now'}, list: [{}] }}, pulldowns: [ { type: 'filtering', @@ -135,7 +135,7 @@ define([ it('should move time and filtering list', function() { expect(model.time.from).to.be('now-1d'); - expect(model.templating.list[0]).to.be(1); + expect(model.templating.list[0].allFormat).to.be('glob'); }); it('graphite panel should change name too graph', function() { From 656ec9c48f3ec420a252978e91b9d624fc99a908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 29 Dec 2014 10:51:59 +0100 Subject: [PATCH 12/22] SinglestatPanel: added more fontsize options, Closes #1187 --- src/app/panels/singlestat/editor.html | 6 +++--- src/app/panels/singlestat/module.js | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/panels/singlestat/editor.html b/src/app/panels/singlestat/editor.html index 67df1405682..88fc438c39f 100644 --- a/src/app/panels/singlestat/editor.html +++ b/src/app/panels/singlestat/editor.html @@ -23,15 +23,15 @@
Big value font size
- +
- +
- +
diff --git a/src/app/panels/singlestat/module.js b/src/app/panels/singlestat/module.js index 69d758f0ee3..788db3c6229 100644 --- a/src/app/panels/singlestat/module.js +++ b/src/app/panels/singlestat/module.js @@ -22,6 +22,8 @@ function (angular, app, _, TimeSeries, kbn, PanelMeta) { metricsEditor: true }); + $scope.fontSizes = ['20%', '30%','50%','70%','80%','100%', '110%', '120%', '150%', '170%', '200%']; + $scope.panelMeta.addEditorTab('Options', 'app/panels/singlestat/editor.html'); // Set and populate defaults From 38f348e642ef42f7719e71eeb314a7dc33e4b16a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 29 Dec 2014 11:21:25 +0100 Subject: [PATCH 13/22] Updated version to 1.9.1 --- CHANGELOG.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58b08eacb4f..1e460999994 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 1.9.1 (unreleased) +# 1.9.1 (2014-12-29) **Enhancements** - [Issue #1028](https://github.com/grafana/grafana/issues/1028). Graph: New legend option ``hideEmtpy`` to hide series with only null values from legend diff --git a/package.json b/package.json index 90983011688..ba7a4c9324a 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "company": "Coding Instinct AB" }, "name": "grafana", - "version": "1.9.0", + "version": "1.9.1", "repository": { "type": "git", "url": "http://github.com/torkelo/grafana.git" From d9386cc2c359ef81424eceafa04d21f01fecb05f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 29 Dec 2014 11:24:14 +0100 Subject: [PATCH 14/22] Updated lastest.json --- latest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/latest.json b/latest.json index 1757a561809..90189fabeca 100644 --- a/latest.json +++ b/latest.json @@ -1,4 +1,4 @@ { - "version": "1.9.0", - "url": "http://grafanarel.s3.amazonaws.com/grafana-1.9.0.tar.gz" + "version": "1.9.1", + "url": "http://grafanarel.s3.amazonaws.com/grafana-1.9.1.tar.gz" } From 599a77c776cf28d4f7578116668f20bcc0fee2b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 30 Dec 2014 11:05:24 +0100 Subject: [PATCH 15/22] Added karma test step to build/relase grunt task --- tasks/build_task.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/build_task.js b/tasks/build_task.js index c8008379b5d..4b576b0c0c3 100644 --- a/tasks/build_task.js +++ b/tasks/build_task.js @@ -4,6 +4,7 @@ module.exports = function(grunt) { grunt.registerTask('build', [ 'jshint:source', 'jshint:tests', + 'karma:test', 'clean:on_start', 'less:src', 'concat:cssDark', From 0a4ccdcef28866709a150cc0ee0e7bb409ea4d29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 30 Dec 2014 20:49:04 +0100 Subject: [PATCH 16/22] moved all graphite code into features/graphite --- src/app/controllers/all.js | 1 - src/app/directives/addGraphiteFunc.js | 2 +- src/app/features/all.js | 1 + .../graphite/datasource.js} | 7 ++++--- src/app/{services => features}/graphite/gfunc.js | 0 src/app/{services => features}/graphite/lexer.js | 0 src/app/{services => features}/graphite/parser.js | 0 .../graphite/partials/annotations.editor.html} | 0 .../graphite/partials/query.editor.html} | 2 +- .../graphiteTarget.js => features/graphite/queryCtrl.js} | 6 +++--- src/app/services/datasourceSrv.js | 1 - src/test/specs/gfunc-specs.js | 2 +- src/test/specs/graphiteDatasource-specs.js | 2 +- src/test/specs/graphiteTargetCtrl-specs.js | 8 ++++---- src/test/specs/lexer-specs.js | 2 +- src/test/specs/parser-specs.js | 2 +- 16 files changed, 18 insertions(+), 18 deletions(-) rename src/app/{services/graphite/graphiteDatasource.js => features/graphite/datasource.js} (97%) rename src/app/{services => features}/graphite/gfunc.js (100%) rename src/app/{services => features}/graphite/lexer.js (100%) rename src/app/{services => features}/graphite/parser.js (100%) rename src/app/{partials/graphite/annotation_editor.html => features/graphite/partials/annotations.editor.html} (100%) rename src/app/{partials/graphite/editor.html => features/graphite/partials/query.editor.html} (99%) rename src/app/{controllers/graphiteTarget.js => features/graphite/queryCtrl.js} (98%) diff --git a/src/app/controllers/all.js b/src/app/controllers/all.js index 75b05efb3d1..0765b82d1aa 100644 --- a/src/app/controllers/all.js +++ b/src/app/controllers/all.js @@ -7,7 +7,6 @@ define([ './pulldown', './search', './metricKeys', - './graphiteTarget', './graphiteImport', './influxTargetCtrl', './playlistCtrl', diff --git a/src/app/directives/addGraphiteFunc.js b/src/app/directives/addGraphiteFunc.js index b585e7d003f..cf2d5069962 100644 --- a/src/app/directives/addGraphiteFunc.js +++ b/src/app/directives/addGraphiteFunc.js @@ -3,7 +3,7 @@ define([ 'app', 'lodash', 'jquery', - '../services/graphite/gfunc', + '../features/graphite/gfunc', ], function (angular, app, _, $, gfunc) { 'use strict'; diff --git a/src/app/features/all.js b/src/app/features/all.js index 5e11ae038f6..64ae3fdf794 100644 --- a/src/app/features/all.js +++ b/src/app/features/all.js @@ -1,3 +1,4 @@ define([ './panellinkeditor/module', + './graphite/datasource', ], function () {}); diff --git a/src/app/services/graphite/graphiteDatasource.js b/src/app/features/graphite/datasource.js similarity index 97% rename from src/app/services/graphite/graphiteDatasource.js rename to src/app/features/graphite/datasource.js index cfaca71aa3d..1041703d0fc 100644 --- a/src/app/services/graphite/graphiteDatasource.js +++ b/src/app/features/graphite/datasource.js @@ -4,7 +4,8 @@ define([ 'jquery', 'config', 'kbn', - 'moment' + 'moment', + './queryCtrl', ], function (angular, _, $, config, kbn, moment) { 'use strict'; @@ -17,12 +18,12 @@ function (angular, _, $, config, kbn, moment) { this.type = 'graphite'; this.basicAuth = datasource.basicAuth; this.url = datasource.url; - this.editorSrc = 'app/partials/graphite/editor.html'; + this.editorSrc = 'app/features/graphite/partials/query.editor.html'; this.name = datasource.name; this.render_method = datasource.render_method || 'POST'; this.supportAnnotations = true; this.supportMetrics = true; - this.annotationEditorSrc = 'app/partials/graphite/annotation_editor.html'; + this.annotationEditorSrc = 'app/features/graphite/partials/annotation.editor.html'; this.cacheTimeout = datasource.cacheTimeout; this.withCredentials = datasource.withCredentials; } diff --git a/src/app/services/graphite/gfunc.js b/src/app/features/graphite/gfunc.js similarity index 100% rename from src/app/services/graphite/gfunc.js rename to src/app/features/graphite/gfunc.js diff --git a/src/app/services/graphite/lexer.js b/src/app/features/graphite/lexer.js similarity index 100% rename from src/app/services/graphite/lexer.js rename to src/app/features/graphite/lexer.js diff --git a/src/app/services/graphite/parser.js b/src/app/features/graphite/parser.js similarity index 100% rename from src/app/services/graphite/parser.js rename to src/app/features/graphite/parser.js diff --git a/src/app/partials/graphite/annotation_editor.html b/src/app/features/graphite/partials/annotations.editor.html similarity index 100% rename from src/app/partials/graphite/annotation_editor.html rename to src/app/features/graphite/partials/annotations.editor.html diff --git a/src/app/partials/graphite/editor.html b/src/app/features/graphite/partials/query.editor.html similarity index 99% rename from src/app/partials/graphite/editor.html rename to src/app/features/graphite/partials/query.editor.html index 4e63cc1a0a8..d57184c16fd 100755 --- a/src/app/partials/graphite/editor.html +++ b/src/app/features/graphite/partials/query.editor.html @@ -3,7 +3,7 @@
diff --git a/src/app/controllers/graphiteTarget.js b/src/app/features/graphite/queryCtrl.js similarity index 98% rename from src/app/controllers/graphiteTarget.js rename to src/app/features/graphite/queryCtrl.js index 480d7023ed4..e270c555aa6 100644 --- a/src/app/controllers/graphiteTarget.js +++ b/src/app/features/graphite/queryCtrl.js @@ -2,8 +2,8 @@ define([ 'angular', 'lodash', 'config', - '../services/graphite/gfunc', - '../services/graphite/parser' + './gfunc', + './parser' ], function (angular, _, config, gfunc, Parser) { 'use strict'; @@ -11,7 +11,7 @@ function (angular, _, config, gfunc, Parser) { var module = angular.module('grafana.controllers'); var targetLetters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O']; - module.controller('GraphiteTargetCtrl', function($scope, $sce, templateSrv) { + module.controller('GraphiteQueryCtrl', function($scope, $sce, templateSrv) { $scope.init = function() { $scope.target.target = $scope.target.target || ''; diff --git a/src/app/services/datasourceSrv.js b/src/app/services/datasourceSrv.js index effb3d1a7dc..1a924afb485 100644 --- a/src/app/services/datasourceSrv.js +++ b/src/app/services/datasourceSrv.js @@ -2,7 +2,6 @@ define([ 'angular', 'lodash', 'config', - './graphite/graphiteDatasource', './influxdb/influxdbDatasource', './opentsdb/opentsdbDatasource', './elasticsearch/es-datasource', diff --git a/src/test/specs/gfunc-specs.js b/src/test/specs/gfunc-specs.js index fdfb1051217..c5dc05552b5 100644 --- a/src/test/specs/gfunc-specs.js +++ b/src/test/specs/gfunc-specs.js @@ -1,5 +1,5 @@ define([ - 'services/graphite/gfunc' + 'features/graphite/gfunc' ], function(gfunc) { 'use strict'; diff --git a/src/test/specs/graphiteDatasource-specs.js b/src/test/specs/graphiteDatasource-specs.js index 2d0ff4be118..e23f0e89d4c 100644 --- a/src/test/specs/graphiteDatasource-specs.js +++ b/src/test/specs/graphiteDatasource-specs.js @@ -1,6 +1,6 @@ define([ 'helpers', - 'services/graphite/graphiteDatasource' + 'features/graphite/datasource' ], function(helpers) { 'use strict'; diff --git a/src/test/specs/graphiteTargetCtrl-specs.js b/src/test/specs/graphiteTargetCtrl-specs.js index c62cea5e37e..d6c47783e91 100644 --- a/src/test/specs/graphiteTargetCtrl-specs.js +++ b/src/test/specs/graphiteTargetCtrl-specs.js @@ -1,16 +1,16 @@ define([ 'helpers', - 'services/graphite/gfunc', - 'controllers/graphiteTarget' + 'features/graphite/gfunc', + 'features/graphite/queryCtrl' ], function(helpers, gfunc) { 'use strict'; - describe('GraphiteTargetCtrl', function() { + describe('GraphiteQueryCtrl', function() { var ctx = new helpers.ControllerTestContext(); beforeEach(module('grafana.controllers')); beforeEach(ctx.providePhase()); - beforeEach(ctx.createControllerPhase('GraphiteTargetCtrl')); + beforeEach(ctx.createControllerPhase('GraphiteQueryCtrl')); beforeEach(function() { ctx.scope.target = { diff --git a/src/test/specs/lexer-specs.js b/src/test/specs/lexer-specs.js index 65260d2e013..e1ab867476c 100644 --- a/src/test/specs/lexer-specs.js +++ b/src/test/specs/lexer-specs.js @@ -1,5 +1,5 @@ define([ - 'services/graphite/lexer' + 'features/graphite/lexer' ], function(Lexer) { 'use strict'; diff --git a/src/test/specs/parser-specs.js b/src/test/specs/parser-specs.js index f1b216f3f2f..8c24bcd3d19 100644 --- a/src/test/specs/parser-specs.js +++ b/src/test/specs/parser-specs.js @@ -1,5 +1,5 @@ define([ - 'services/graphite/parser' + 'features/graphite/parser' ], function(Parser) { 'use strict'; From f9b0a01c74d1f5196be26a2726d9b4ae5a49d672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 30 Dec 2014 21:08:48 +0100 Subject: [PATCH 17/22] restructuring --- src/app/controllers/all.js | 1 - src/app/directives/all.js | 3 --- src/app/features/all.js | 1 + .../graphite}/addGraphiteFunc.js | 2 +- src/app/features/graphite/datasource.js | 13 ++++++++----- .../graphite/funcEditor.js} | 0 .../influxdb/datasource.js} | 10 ++++++---- .../influxdb/funcEditor.js} | 0 .../{services => features}/influxdb/influxSeries.js | 0 .../influxdb/partials/annotations.editor.html} | 0 .../influxdb/partials/query.editor.html} | 2 +- .../influxdb/queryBuilder.js} | 0 .../influxdb/queryCtrl.js} | 2 +- src/app/services/datasourceSrv.js | 1 - src/test/specs/influxQueryBuilder-specs.js | 4 ++-- src/test/specs/influxSeries-specs.js | 2 +- src/test/specs/influxdb-datasource-specs.js | 2 +- 17 files changed, 22 insertions(+), 21 deletions(-) rename src/app/{directives => features/graphite}/addGraphiteFunc.js (98%) rename src/app/{directives/graphiteFuncEditor.js => features/graphite/funcEditor.js} (100%) rename src/app/{services/influxdb/influxdbDatasource.js => features/influxdb/datasource.js} (98%) rename src/app/{directives/influxdbFuncEditor.js => features/influxdb/funcEditor.js} (100%) rename src/app/{services => features}/influxdb/influxSeries.js (100%) rename src/app/{partials/influxdb/annotation_editor.html => features/influxdb/partials/annotations.editor.html} (100%) rename src/app/{partials/influxdb/editor.html => features/influxdb/partials/query.editor.html} (99%) rename src/app/{services/influxdb/influxQueryBuilder.js => features/influxdb/queryBuilder.js} (100%) rename src/app/{controllers/influxTargetCtrl.js => features/influxdb/queryCtrl.js} (97%) diff --git a/src/app/controllers/all.js b/src/app/controllers/all.js index 0765b82d1aa..09cce803f55 100644 --- a/src/app/controllers/all.js +++ b/src/app/controllers/all.js @@ -8,7 +8,6 @@ define([ './search', './metricKeys', './graphiteImport', - './influxTargetCtrl', './playlistCtrl', './inspectCtrl', './opentsdbTargetCtrl', diff --git a/src/app/directives/all.js b/src/app/directives/all.js index d75410f3d33..879b61e2512 100644 --- a/src/app/directives/all.js +++ b/src/app/directives/all.js @@ -12,11 +12,8 @@ define([ './spectrumPicker', './bootstrap-tagsinput', './bodyClass', - './addGraphiteFunc', - './graphiteFuncEditor', './templateParamSelector', './graphiteSegment', './grafanaVersionCheck', './dropdown.typeahead', - './influxdbFuncEditor' ], function () {}); diff --git a/src/app/features/all.js b/src/app/features/all.js index 64ae3fdf794..93d986b90d4 100644 --- a/src/app/features/all.js +++ b/src/app/features/all.js @@ -1,4 +1,5 @@ define([ './panellinkeditor/module', './graphite/datasource', + './influxdb/datasource', ], function () {}); diff --git a/src/app/directives/addGraphiteFunc.js b/src/app/features/graphite/addGraphiteFunc.js similarity index 98% rename from src/app/directives/addGraphiteFunc.js rename to src/app/features/graphite/addGraphiteFunc.js index cf2d5069962..5ea45618ce1 100644 --- a/src/app/directives/addGraphiteFunc.js +++ b/src/app/features/graphite/addGraphiteFunc.js @@ -3,7 +3,7 @@ define([ 'app', 'lodash', 'jquery', - '../features/graphite/gfunc', + './gfunc', ], function (angular, app, _, $, gfunc) { 'use strict'; diff --git a/src/app/features/graphite/datasource.js b/src/app/features/graphite/datasource.js index 1041703d0fc..74fc47cd7a5 100644 --- a/src/app/features/graphite/datasource.js +++ b/src/app/features/graphite/datasource.js @@ -6,6 +6,8 @@ define([ 'kbn', 'moment', './queryCtrl', + './funcEditor', + './addGraphiteFunc', ], function (angular, _, $, config, kbn, moment) { 'use strict'; @@ -18,14 +20,15 @@ function (angular, _, $, config, kbn, moment) { this.type = 'graphite'; this.basicAuth = datasource.basicAuth; this.url = datasource.url; - this.editorSrc = 'app/features/graphite/partials/query.editor.html'; this.name = datasource.name; - this.render_method = datasource.render_method || 'POST'; - this.supportAnnotations = true; - this.supportMetrics = true; - this.annotationEditorSrc = 'app/features/graphite/partials/annotation.editor.html'; this.cacheTimeout = datasource.cacheTimeout; this.withCredentials = datasource.withCredentials; + this.render_method = datasource.render_method || 'POST'; + + this.supportAnnotations = true; + this.supportMetrics = true; + this.editorSrc = 'app/features/graphite/partials/query.editor.html'; + this.annotationEditorSrc = 'app/features/graphite/partials/annotation.editor.html'; } GraphiteDatasource.prototype.query = function(options) { diff --git a/src/app/directives/graphiteFuncEditor.js b/src/app/features/graphite/funcEditor.js similarity index 100% rename from src/app/directives/graphiteFuncEditor.js rename to src/app/features/graphite/funcEditor.js diff --git a/src/app/services/influxdb/influxdbDatasource.js b/src/app/features/influxdb/datasource.js similarity index 98% rename from src/app/services/influxdb/influxdbDatasource.js rename to src/app/features/influxdb/datasource.js index c30f950e51b..dc542ec3cfd 100644 --- a/src/app/services/influxdb/influxdbDatasource.js +++ b/src/app/features/influxdb/datasource.js @@ -3,7 +3,9 @@ define([ 'lodash', 'kbn', './influxSeries', - './influxQueryBuilder' + './queryBuilder', + './queryCtrl', + './funcEditor', ], function (angular, _, kbn, InfluxSeries, InfluxQueryBuilder) { 'use strict'; @@ -14,20 +16,20 @@ function (angular, _, kbn, InfluxSeries, InfluxQueryBuilder) { function InfluxDatasource(datasource) { this.type = 'influxDB'; - this.editorSrc = 'app/partials/influxdb/editor.html'; this.urls = datasource.urls; this.username = datasource.username; this.password = datasource.password; this.name = datasource.name; this.basicAuth = datasource.basicAuth; + this.grafanaDB = datasource.grafanaDB; this.saveTemp = _.isUndefined(datasource.save_temp) ? true : datasource.save_temp; this.saveTempTTL = _.isUndefined(datasource.save_temp_ttl) ? '30d' : datasource.save_temp_ttl; - this.grafanaDB = datasource.grafanaDB; this.supportAnnotations = true; this.supportMetrics = true; - this.annotationEditorSrc = 'app/partials/influxdb/annotation_editor.html'; + this.editorSrc = 'app/features/influxdb/partials/query.editor.html'; + this.annotationEditorSrc = 'app/features/influxdb/partials/annotations.editor.html'; } InfluxDatasource.prototype.query = function(options) { diff --git a/src/app/directives/influxdbFuncEditor.js b/src/app/features/influxdb/funcEditor.js similarity index 100% rename from src/app/directives/influxdbFuncEditor.js rename to src/app/features/influxdb/funcEditor.js diff --git a/src/app/services/influxdb/influxSeries.js b/src/app/features/influxdb/influxSeries.js similarity index 100% rename from src/app/services/influxdb/influxSeries.js rename to src/app/features/influxdb/influxSeries.js diff --git a/src/app/partials/influxdb/annotation_editor.html b/src/app/features/influxdb/partials/annotations.editor.html similarity index 100% rename from src/app/partials/influxdb/annotation_editor.html rename to src/app/features/influxdb/partials/annotations.editor.html diff --git a/src/app/partials/influxdb/editor.html b/src/app/features/influxdb/partials/query.editor.html similarity index 99% rename from src/app/partials/influxdb/editor.html rename to src/app/features/influxdb/partials/query.editor.html index 7fe41c1d268..44d19c80d89 100644 --- a/src/app/partials/influxdb/editor.html +++ b/src/app/features/influxdb/partials/query.editor.html @@ -3,7 +3,7 @@
diff --git a/src/app/services/influxdb/influxQueryBuilder.js b/src/app/features/influxdb/queryBuilder.js similarity index 100% rename from src/app/services/influxdb/influxQueryBuilder.js rename to src/app/features/influxdb/queryBuilder.js diff --git a/src/app/controllers/influxTargetCtrl.js b/src/app/features/influxdb/queryCtrl.js similarity index 97% rename from src/app/controllers/influxTargetCtrl.js rename to src/app/features/influxdb/queryCtrl.js index e2b1a5234d4..0d33445117b 100644 --- a/src/app/controllers/influxTargetCtrl.js +++ b/src/app/features/influxdb/queryCtrl.js @@ -9,7 +9,7 @@ function (angular, _) { var seriesList = null; - module.controller('InfluxTargetCtrl', function($scope, $timeout) { + module.controller('InfluxQueryCtrl', function($scope, $timeout) { $scope.init = function() { var target = $scope.target; diff --git a/src/app/services/datasourceSrv.js b/src/app/services/datasourceSrv.js index 1a924afb485..0fb1c6f4acf 100644 --- a/src/app/services/datasourceSrv.js +++ b/src/app/services/datasourceSrv.js @@ -2,7 +2,6 @@ define([ 'angular', 'lodash', 'config', - './influxdb/influxdbDatasource', './opentsdb/opentsdbDatasource', './elasticsearch/es-datasource', ], diff --git a/src/test/specs/influxQueryBuilder-specs.js b/src/test/specs/influxQueryBuilder-specs.js index b4e052a23af..47e3a317c36 100644 --- a/src/test/specs/influxQueryBuilder-specs.js +++ b/src/test/specs/influxQueryBuilder-specs.js @@ -1,5 +1,5 @@ define([ - 'services/influxdb/influxQueryBuilder' + 'features/influxdb/queryBuilder' ], function(InfluxQueryBuilder) { 'use strict'; @@ -68,7 +68,7 @@ define([ var query = builder.build(); expect(query).to.be('select mean(value) from "merge.google.test" where $timeFilter ' + - 'group by time($interval) order asc'); + 'group by time($interval) order asc'); }); }); diff --git a/src/test/specs/influxSeries-specs.js b/src/test/specs/influxSeries-specs.js index 9a38eb7f46d..1c3d079797b 100644 --- a/src/test/specs/influxSeries-specs.js +++ b/src/test/specs/influxSeries-specs.js @@ -1,5 +1,5 @@ define([ - 'services/influxdb/influxSeries' + 'features/influxdb/influxSeries' ], function(InfluxSeries) { 'use strict'; diff --git a/src/test/specs/influxdb-datasource-specs.js b/src/test/specs/influxdb-datasource-specs.js index 11d8a9e80c4..f8b545e7db2 100644 --- a/src/test/specs/influxdb-datasource-specs.js +++ b/src/test/specs/influxdb-datasource-specs.js @@ -1,6 +1,6 @@ define([ 'helpers', - 'services/influxdb/influxdbDatasource' + 'features/influxdb/datasource' ], function(helpers) { 'use strict'; From 8268c65c57a79435c7d99dc9467c77cbff56163a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 30 Dec 2014 21:24:55 +0100 Subject: [PATCH 18/22] Trying to organize code more around features than the standard controllers, services structure --- src/app/controllers/all.js | 1 - src/app/features/all.js | 2 ++ .../elasticsearch/datasource.js} | 2 +- .../elasticsearch/partials/annotations.editor.html} | 0 src/app/features/graphite/datasource.js | 2 +- .../opentsdb/datasource.js} | 5 +++-- .../opentsdb/partials/query.editor.html} | 2 +- .../opentsdbTargetCtrl.js => features/opentsdb/queryCtrl.js} | 2 +- src/app/services/datasourceSrv.js | 2 -- 9 files changed, 9 insertions(+), 9 deletions(-) rename src/app/{services/elasticsearch/es-datasource.js => features/elasticsearch/datasource.js} (99%) rename src/app/{partials/elasticsearch/annotation_editor.html => features/elasticsearch/partials/annotations.editor.html} (100%) rename src/app/{services/opentsdb/opentsdbDatasource.js => features/opentsdb/datasource.js} (97%) rename src/app/{partials/opentsdb/editor.html => features/opentsdb/partials/query.editor.html} (99%) rename src/app/{controllers/opentsdbTargetCtrl.js => features/opentsdb/queryCtrl.js} (97%) diff --git a/src/app/controllers/all.js b/src/app/controllers/all.js index 09cce803f55..c7836b8d744 100644 --- a/src/app/controllers/all.js +++ b/src/app/controllers/all.js @@ -10,7 +10,6 @@ define([ './graphiteImport', './playlistCtrl', './inspectCtrl', - './opentsdbTargetCtrl', './annotationsEditorCtrl', './templateEditorCtrl', './sharePanelCtrl', diff --git a/src/app/features/all.js b/src/app/features/all.js index 93d986b90d4..e2868f92b30 100644 --- a/src/app/features/all.js +++ b/src/app/features/all.js @@ -2,4 +2,6 @@ define([ './panellinkeditor/module', './graphite/datasource', './influxdb/datasource', + './opentsdb/datasource', + './elasticsearch/datasource', ], function () {}); diff --git a/src/app/services/elasticsearch/es-datasource.js b/src/app/features/elasticsearch/datasource.js similarity index 99% rename from src/app/services/elasticsearch/es-datasource.js rename to src/app/features/elasticsearch/datasource.js index 843bf8addf3..3c82d98f8d2 100644 --- a/src/app/services/elasticsearch/es-datasource.js +++ b/src/app/features/elasticsearch/datasource.js @@ -24,7 +24,7 @@ function (angular, _, config, kbn, moment) { this.saveTemp = _.isUndefined(datasource.save_temp) ? true : datasource.save_temp; this.saveTempTTL = _.isUndefined(datasource.save_temp_ttl) ? '30d' : datasource.save_temp_ttl; - this.annotationEditorSrc = 'app/partials/elasticsearch/annotation_editor.html'; + this.annotationEditorSrc = 'app/features/elasticsearch/partials/annotations.editor.html'; this.supportAnnotations = true; this.supportMetrics = false; } diff --git a/src/app/partials/elasticsearch/annotation_editor.html b/src/app/features/elasticsearch/partials/annotations.editor.html similarity index 100% rename from src/app/partials/elasticsearch/annotation_editor.html rename to src/app/features/elasticsearch/partials/annotations.editor.html diff --git a/src/app/features/graphite/datasource.js b/src/app/features/graphite/datasource.js index 74fc47cd7a5..68fd9a2890f 100644 --- a/src/app/features/graphite/datasource.js +++ b/src/app/features/graphite/datasource.js @@ -28,7 +28,7 @@ function (angular, _, $, config, kbn, moment) { this.supportAnnotations = true; this.supportMetrics = true; this.editorSrc = 'app/features/graphite/partials/query.editor.html'; - this.annotationEditorSrc = 'app/features/graphite/partials/annotation.editor.html'; + this.annotationEditorSrc = 'app/features/graphite/partials/annotations.editor.html'; } GraphiteDatasource.prototype.query = function(options) { diff --git a/src/app/services/opentsdb/opentsdbDatasource.js b/src/app/features/opentsdb/datasource.js similarity index 97% rename from src/app/services/opentsdb/opentsdbDatasource.js rename to src/app/features/opentsdb/datasource.js index 976f5c84cba..d5bdd011dcf 100644 --- a/src/app/services/opentsdb/opentsdbDatasource.js +++ b/src/app/features/opentsdb/datasource.js @@ -2,7 +2,8 @@ define([ 'angular', 'lodash', 'kbn', - 'moment' + 'moment', + './queryCtrl', ], function (angular, _, kbn) { 'use strict'; @@ -13,7 +14,7 @@ function (angular, _, kbn) { function OpenTSDBDatasource(datasource) { this.type = 'opentsdb'; - this.editorSrc = 'app/partials/opentsdb/editor.html'; + this.editorSrc = 'app/features/opentsdb/partials/query.editor.html'; this.url = datasource.url; this.name = datasource.name; this.supportMetrics = true; diff --git a/src/app/partials/opentsdb/editor.html b/src/app/features/opentsdb/partials/query.editor.html similarity index 99% rename from src/app/partials/opentsdb/editor.html rename to src/app/features/opentsdb/partials/query.editor.html index 51a575d933c..1b8cc3cee0a 100644 --- a/src/app/partials/opentsdb/editor.html +++ b/src/app/features/opentsdb/partials/query.editor.html @@ -2,7 +2,7 @@
diff --git a/src/app/controllers/opentsdbTargetCtrl.js b/src/app/features/opentsdb/queryCtrl.js similarity index 97% rename from src/app/controllers/opentsdbTargetCtrl.js rename to src/app/features/opentsdb/queryCtrl.js index 993ed8d3da6..a19b0211a9e 100644 --- a/src/app/controllers/opentsdbTargetCtrl.js +++ b/src/app/features/opentsdb/queryCtrl.js @@ -8,7 +8,7 @@ function (angular, _, kbn) { var module = angular.module('grafana.controllers'); - module.controller('OpenTSDBTargetCtrl', function($scope, $timeout) { + module.controller('OpenTSDBQueryCtrl', function($scope, $timeout) { $scope.init = function() { $scope.target.errors = validateTarget($scope.target); diff --git a/src/app/services/datasourceSrv.js b/src/app/services/datasourceSrv.js index 0fb1c6f4acf..d3ade0569a7 100644 --- a/src/app/services/datasourceSrv.js +++ b/src/app/services/datasourceSrv.js @@ -2,8 +2,6 @@ define([ 'angular', 'lodash', 'config', - './opentsdb/opentsdbDatasource', - './elasticsearch/es-datasource', ], function (angular, _, config) { 'use strict'; From 8d7390e7653cf1b07e86087557a7ffaae9b5fdc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 31 Dec 2014 09:28:30 +0100 Subject: [PATCH 19/22] moved annotation editor and service to features folder --- src/app/controllers/all.js | 1 - src/app/features/all.js | 1 + src/app/{services => features/annotations}/annotationsSrv.js | 3 ++- .../annotations/editorCtrl.js} | 0 .../annotations/partials/editor.html} | 0 src/app/panels/graph/module.js | 2 -- src/app/partials/submenu.html | 2 +- src/app/services/all.js | 1 - 8 files changed, 4 insertions(+), 6 deletions(-) rename src/app/{services => features/annotations}/annotationsSrv.js (98%) rename src/app/{controllers/annotationsEditorCtrl.js => features/annotations/editorCtrl.js} (100%) rename src/app/{partials/annotations_editor.html => features/annotations/partials/editor.html} (100%) diff --git a/src/app/controllers/all.js b/src/app/controllers/all.js index c7836b8d744..04e3fd36da9 100644 --- a/src/app/controllers/all.js +++ b/src/app/controllers/all.js @@ -10,7 +10,6 @@ define([ './graphiteImport', './playlistCtrl', './inspectCtrl', - './annotationsEditorCtrl', './templateEditorCtrl', './sharePanelCtrl', './jsonEditorCtrl', diff --git a/src/app/features/all.js b/src/app/features/all.js index e2868f92b30..37e738b4bb1 100644 --- a/src/app/features/all.js +++ b/src/app/features/all.js @@ -1,5 +1,6 @@ define([ './panellinkeditor/module', + './annotations/annotationsSrv', './graphite/datasource', './influxdb/datasource', './opentsdb/datasource', diff --git a/src/app/services/annotationsSrv.js b/src/app/features/annotations/annotationsSrv.js similarity index 98% rename from src/app/services/annotationsSrv.js rename to src/app/features/annotations/annotationsSrv.js index 68b5c85b5dd..2dd6da740e2 100644 --- a/src/app/services/annotationsSrv.js +++ b/src/app/features/annotations/annotationsSrv.js @@ -1,7 +1,8 @@ define([ 'angular', 'lodash', - 'moment' + 'moment', + './editorCtrl' ], function (angular, _, moment) { 'use strict'; diff --git a/src/app/controllers/annotationsEditorCtrl.js b/src/app/features/annotations/editorCtrl.js similarity index 100% rename from src/app/controllers/annotationsEditorCtrl.js rename to src/app/features/annotations/editorCtrl.js diff --git a/src/app/partials/annotations_editor.html b/src/app/features/annotations/partials/editor.html similarity index 100% rename from src/app/partials/annotations_editor.html rename to src/app/features/annotations/partials/editor.html diff --git a/src/app/panels/graph/module.js b/src/app/panels/graph/module.js index 335fd4e52a3..2f82dafcd3d 100644 --- a/src/app/panels/graph/module.js +++ b/src/app/panels/graph/module.js @@ -8,8 +8,6 @@ define([ 'components/timeSeries', 'components/panelmeta', 'services/panelSrv', - 'services/annotationsSrv', - 'services/datasourceSrv', './seriesOverridesCtrl', './graph', './legend', diff --git a/src/app/partials/submenu.html b/src/app/partials/submenu.html index e82e2505afb..19a56e57a63 100644 --- a/src/app/partials/submenu.html +++ b/src/app/partials/submenu.html @@ -10,7 +10,7 @@
diff --git a/src/app/services/all.js b/src/app/services/all.js index efb8c79fb15..fcc76edf482 100644 --- a/src/app/services/all.js +++ b/src/app/services/all.js @@ -8,7 +8,6 @@ define([ './panelSrv', './timer', './keyboardManager', - './annotationsSrv', './popoverSrv', './playlistSrv', './unsavedChangesSrv', From 2f811375bb369e65484015b1f0fcc9a6b2716dca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 31 Dec 2014 09:34:54 +0100 Subject: [PATCH 20/22] Moving templating to feature to feature folder --- src/app/controllers/all.js | 1 - src/app/features/all.js | 1 + .../templateEditorCtrl.js => features/templating/editorCtrl.js} | 0 src/app/{services => features/templating}/templateSrv.js | 2 ++ src/app/{services => features/templating}/templateValuesSrv.js | 0 src/app/services/all.js | 2 -- src/test/specs/templateSrv-specs.js | 2 +- src/test/specs/templateValuesSrv-specs.js | 2 +- 8 files changed, 5 insertions(+), 5 deletions(-) rename src/app/{controllers/templateEditorCtrl.js => features/templating/editorCtrl.js} (100%) rename src/app/{services => features/templating}/templateSrv.js (98%) rename src/app/{services => features/templating}/templateValuesSrv.js (100%) diff --git a/src/app/controllers/all.js b/src/app/controllers/all.js index 04e3fd36da9..6e052ee445e 100644 --- a/src/app/controllers/all.js +++ b/src/app/controllers/all.js @@ -10,7 +10,6 @@ define([ './graphiteImport', './playlistCtrl', './inspectCtrl', - './templateEditorCtrl', './sharePanelCtrl', './jsonEditorCtrl', ], function () {}); diff --git a/src/app/features/all.js b/src/app/features/all.js index 37e738b4bb1..6860e3de932 100644 --- a/src/app/features/all.js +++ b/src/app/features/all.js @@ -1,6 +1,7 @@ define([ './panellinkeditor/module', './annotations/annotationsSrv', + './templating/templateSrv', './graphite/datasource', './influxdb/datasource', './opentsdb/datasource', diff --git a/src/app/controllers/templateEditorCtrl.js b/src/app/features/templating/editorCtrl.js similarity index 100% rename from src/app/controllers/templateEditorCtrl.js rename to src/app/features/templating/editorCtrl.js diff --git a/src/app/services/templateSrv.js b/src/app/features/templating/templateSrv.js similarity index 98% rename from src/app/services/templateSrv.js rename to src/app/features/templating/templateSrv.js index c201147becf..c44ff0a5669 100644 --- a/src/app/services/templateSrv.js +++ b/src/app/features/templating/templateSrv.js @@ -1,6 +1,8 @@ define([ 'angular', 'lodash', + './editorCtrl', + './templateValuesSrv', ], function (angular, _) { 'use strict'; diff --git a/src/app/services/templateValuesSrv.js b/src/app/features/templating/templateValuesSrv.js similarity index 100% rename from src/app/services/templateValuesSrv.js rename to src/app/features/templating/templateValuesSrv.js diff --git a/src/app/services/all.js b/src/app/services/all.js index fcc76edf482..daf889d1cd3 100644 --- a/src/app/services/all.js +++ b/src/app/services/all.js @@ -3,8 +3,6 @@ define([ './utilSrv', './datasourceSrv', './timeSrv', - './templateSrv', - './templateValuesSrv', './panelSrv', './timer', './keyboardManager', diff --git a/src/test/specs/templateSrv-specs.js b/src/test/specs/templateSrv-specs.js index f740ef6d544..bb85b9a1c98 100644 --- a/src/test/specs/templateSrv-specs.js +++ b/src/test/specs/templateSrv-specs.js @@ -1,7 +1,7 @@ define([ 'mocks/dashboard-mock', 'lodash', - 'services/templateSrv' + 'features/templating/templateSrv' ], function(dashboardMock) { 'use strict'; diff --git a/src/test/specs/templateValuesSrv-specs.js b/src/test/specs/templateValuesSrv-specs.js index 8ca5e6a87ae..0fe00fd9e68 100644 --- a/src/test/specs/templateValuesSrv-specs.js +++ b/src/test/specs/templateValuesSrv-specs.js @@ -2,7 +2,7 @@ define([ 'mocks/dashboard-mock', 'helpers', 'moment', - 'services/templateValuesSrv' + 'features/templating/templateValuesSrv' ], function(dashboardMock, helpers, moment) { 'use strict'; From 39f3cfc1ebc19f8c869ef43878c099a3c2edf578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 31 Dec 2014 11:05:19 +0100 Subject: [PATCH 21/22] moved dashboard stuff into a feature folder, not sure about this, but need better structure and better way to organize dependencies --- src/app/controllers/all.js | 6 ------ src/app/features/all.js | 1 + src/app/features/dashboard/all.js | 14 ++++++++++++++ .../dashboard}/dashboardCtrl.js | 0 .../dashboard}/dashboardNavCtrl.js | 0 .../dashboard/dashboardSrv.js | 1 - .../dashboard/keybindings.js} | 0 .../{services => features/dashboard}/panelSrv.js | 0 .../dashboard}/playlistCtrl.js | 0 .../dashboard}/playlistSrv.js | 0 .../row.js => features/dashboard/rowCtrl.js} | 0 .../dashboard}/sharePanelCtrl.js | 0 .../dashboard}/submenuCtrl.js | 0 .../{services => features/dashboard}/timeSrv.js | 0 .../dashboard}/unsavedChangesSrv.js | 0 .../dashboard/viewStateSrv.js} | 0 src/app/panels/graph/module.js | 1 - src/app/panels/singlestat/module.js | 1 - src/app/services/all.js | 7 ------- src/test/specs/dashboardSrv-specs.js | 2 +- src/test/specs/dashboardViewStateSrv-specs.js | 2 +- src/test/specs/graph-ctrl-specs.js | 1 + src/test/specs/row-ctrl-specs.js | 2 +- src/test/specs/sharePanelCtrl-specs.js | 2 +- src/test/specs/timeSrv-specs.js | 3 ++- src/test/test-main.js | 1 - 26 files changed, 22 insertions(+), 22 deletions(-) create mode 100644 src/app/features/dashboard/all.js rename src/app/{controllers => features/dashboard}/dashboardCtrl.js (100%) rename src/app/{controllers => features/dashboard}/dashboardNavCtrl.js (100%) rename src/app/{services => features}/dashboard/dashboardSrv.js (99%) rename src/app/{services/dashboard/dashboardKeyBindings.js => features/dashboard/keybindings.js} (100%) rename src/app/{services => features/dashboard}/panelSrv.js (100%) rename src/app/{controllers => features/dashboard}/playlistCtrl.js (100%) rename src/app/{services => features/dashboard}/playlistSrv.js (100%) rename src/app/{controllers/row.js => features/dashboard/rowCtrl.js} (100%) rename src/app/{controllers => features/dashboard}/sharePanelCtrl.js (100%) rename src/app/{controllers => features/dashboard}/submenuCtrl.js (100%) rename src/app/{services => features/dashboard}/timeSrv.js (100%) rename src/app/{services => features/dashboard}/unsavedChangesSrv.js (100%) rename src/app/{services/dashboard/dashboardViewStateSrv.js => features/dashboard/viewStateSrv.js} (100%) diff --git a/src/app/controllers/all.js b/src/app/controllers/all.js index 6e052ee445e..8703cf0f2bf 100644 --- a/src/app/controllers/all.js +++ b/src/app/controllers/all.js @@ -1,15 +1,9 @@ define([ './grafanaCtrl', - './dashboardCtrl', - './dashboardNavCtrl', - './row', - './submenuCtrl', './pulldown', './search', './metricKeys', './graphiteImport', - './playlistCtrl', './inspectCtrl', - './sharePanelCtrl', './jsonEditorCtrl', ], function () {}); diff --git a/src/app/features/all.js b/src/app/features/all.js index 6860e3de932..55f7f607131 100644 --- a/src/app/features/all.js +++ b/src/app/features/all.js @@ -6,4 +6,5 @@ define([ './influxdb/datasource', './opentsdb/datasource', './elasticsearch/datasource', + './dashboard/all', ], function () {}); diff --git a/src/app/features/dashboard/all.js b/src/app/features/dashboard/all.js new file mode 100644 index 00000000000..74c2fa0bb80 --- /dev/null +++ b/src/app/features/dashboard/all.js @@ -0,0 +1,14 @@ +define([ + './dashboardCtrl', + './dashboardNavCtrl', + './playlistCtrl', + './rowCtrl', + './sharePanelCtrl', + './submenuCtrl', + './dashboardSrv', + './keybindings', + './viewStateSrv', + './playlistSrv', + './panelSrv', + './timeSrv', +], function () {}); diff --git a/src/app/controllers/dashboardCtrl.js b/src/app/features/dashboard/dashboardCtrl.js similarity index 100% rename from src/app/controllers/dashboardCtrl.js rename to src/app/features/dashboard/dashboardCtrl.js diff --git a/src/app/controllers/dashboardNavCtrl.js b/src/app/features/dashboard/dashboardNavCtrl.js similarity index 100% rename from src/app/controllers/dashboardNavCtrl.js rename to src/app/features/dashboard/dashboardNavCtrl.js diff --git a/src/app/services/dashboard/dashboardSrv.js b/src/app/features/dashboard/dashboardSrv.js similarity index 99% rename from src/app/services/dashboard/dashboardSrv.js rename to src/app/features/dashboard/dashboardSrv.js index 21789fc1740..94448265cca 100644 --- a/src/app/services/dashboard/dashboardSrv.js +++ b/src/app/features/dashboard/dashboardSrv.js @@ -4,7 +4,6 @@ define([ 'kbn', 'lodash', 'moment', - '../timer', ], function (angular, $, kbn, _, moment) { 'use strict'; diff --git a/src/app/services/dashboard/dashboardKeyBindings.js b/src/app/features/dashboard/keybindings.js similarity index 100% rename from src/app/services/dashboard/dashboardKeyBindings.js rename to src/app/features/dashboard/keybindings.js diff --git a/src/app/services/panelSrv.js b/src/app/features/dashboard/panelSrv.js similarity index 100% rename from src/app/services/panelSrv.js rename to src/app/features/dashboard/panelSrv.js diff --git a/src/app/controllers/playlistCtrl.js b/src/app/features/dashboard/playlistCtrl.js similarity index 100% rename from src/app/controllers/playlistCtrl.js rename to src/app/features/dashboard/playlistCtrl.js diff --git a/src/app/services/playlistSrv.js b/src/app/features/dashboard/playlistSrv.js similarity index 100% rename from src/app/services/playlistSrv.js rename to src/app/features/dashboard/playlistSrv.js diff --git a/src/app/controllers/row.js b/src/app/features/dashboard/rowCtrl.js similarity index 100% rename from src/app/controllers/row.js rename to src/app/features/dashboard/rowCtrl.js diff --git a/src/app/controllers/sharePanelCtrl.js b/src/app/features/dashboard/sharePanelCtrl.js similarity index 100% rename from src/app/controllers/sharePanelCtrl.js rename to src/app/features/dashboard/sharePanelCtrl.js diff --git a/src/app/controllers/submenuCtrl.js b/src/app/features/dashboard/submenuCtrl.js similarity index 100% rename from src/app/controllers/submenuCtrl.js rename to src/app/features/dashboard/submenuCtrl.js diff --git a/src/app/services/timeSrv.js b/src/app/features/dashboard/timeSrv.js similarity index 100% rename from src/app/services/timeSrv.js rename to src/app/features/dashboard/timeSrv.js diff --git a/src/app/services/unsavedChangesSrv.js b/src/app/features/dashboard/unsavedChangesSrv.js similarity index 100% rename from src/app/services/unsavedChangesSrv.js rename to src/app/features/dashboard/unsavedChangesSrv.js diff --git a/src/app/services/dashboard/dashboardViewStateSrv.js b/src/app/features/dashboard/viewStateSrv.js similarity index 100% rename from src/app/services/dashboard/dashboardViewStateSrv.js rename to src/app/features/dashboard/viewStateSrv.js diff --git a/src/app/panels/graph/module.js b/src/app/panels/graph/module.js index 2f82dafcd3d..a1ae2bf2b4f 100644 --- a/src/app/panels/graph/module.js +++ b/src/app/panels/graph/module.js @@ -7,7 +7,6 @@ define([ 'moment', 'components/timeSeries', 'components/panelmeta', - 'services/panelSrv', './seriesOverridesCtrl', './graph', './legend', diff --git a/src/app/panels/singlestat/module.js b/src/app/panels/singlestat/module.js index 788db3c6229..3568cc53c64 100644 --- a/src/app/panels/singlestat/module.js +++ b/src/app/panels/singlestat/module.js @@ -5,7 +5,6 @@ define([ 'components/timeSeries', 'kbn', 'components/panelmeta', - 'services/panelSrv', './singleStatPanel', ], function (angular, app, _, TimeSeries, kbn, PanelMeta) { diff --git a/src/app/services/all.js b/src/app/services/all.js index daf889d1cd3..bd9150a3b8f 100644 --- a/src/app/services/all.js +++ b/src/app/services/all.js @@ -2,15 +2,8 @@ define([ './alertSrv', './utilSrv', './datasourceSrv', - './timeSrv', - './panelSrv', './timer', './keyboardManager', './popoverSrv', - './playlistSrv', - './unsavedChangesSrv', - './dashboard/dashboardKeyBindings', - './dashboard/dashboardSrv', - './dashboard/dashboardViewStateSrv', ], function () {}); diff --git a/src/test/specs/dashboardSrv-specs.js b/src/test/specs/dashboardSrv-specs.js index 6dc19b1a2ce..739d66871bc 100644 --- a/src/test/specs/dashboardSrv-specs.js +++ b/src/test/specs/dashboardSrv-specs.js @@ -1,5 +1,5 @@ define([ - 'services/dashboard/dashboardSrv' + 'features/dashboard/dashboardSrv' ], function() { 'use strict'; diff --git a/src/test/specs/dashboardViewStateSrv-specs.js b/src/test/specs/dashboardViewStateSrv-specs.js index 1ade349610d..056ab8c9152 100644 --- a/src/test/specs/dashboardViewStateSrv-specs.js +++ b/src/test/specs/dashboardViewStateSrv-specs.js @@ -1,5 +1,5 @@ define([ - 'services/dashboard/dashboardViewStateSrv' + 'features/dashboard/viewStateSrv' ], function() { 'use strict'; diff --git a/src/test/specs/graph-ctrl-specs.js b/src/test/specs/graph-ctrl-specs.js index 13cd56857f5..a1a372006a3 100644 --- a/src/test/specs/graph-ctrl-specs.js +++ b/src/test/specs/graph-ctrl-specs.js @@ -1,5 +1,6 @@ define([ 'helpers', + 'features/dashboard/panelSrv', 'panels/graph/module' ], function(helpers) { 'use strict'; diff --git a/src/test/specs/row-ctrl-specs.js b/src/test/specs/row-ctrl-specs.js index bfb61c1ab9b..b64f5cd1065 100644 --- a/src/test/specs/row-ctrl-specs.js +++ b/src/test/specs/row-ctrl-specs.js @@ -1,6 +1,6 @@ define([ 'helpers', - 'controllers/row' + 'features/dashboard/rowCtrl' ], function(helpers) { 'use strict'; diff --git a/src/test/specs/sharePanelCtrl-specs.js b/src/test/specs/sharePanelCtrl-specs.js index 7bab63adc3a..6cb0a732d6e 100644 --- a/src/test/specs/sharePanelCtrl-specs.js +++ b/src/test/specs/sharePanelCtrl-specs.js @@ -1,6 +1,6 @@ define([ 'helpers', - 'controllers/sharePanelCtrl' + 'features/dashboard/sharePanelCtrl' ], function(helpers) { 'use strict'; diff --git a/src/test/specs/timeSrv-specs.js b/src/test/specs/timeSrv-specs.js index 86ee37ebac4..231f50afeb8 100644 --- a/src/test/specs/timeSrv-specs.js +++ b/src/test/specs/timeSrv-specs.js @@ -2,7 +2,8 @@ define([ 'mocks/dashboard-mock', 'helpers', 'lodash', - 'services/timeSrv' + 'services/timer', + 'features/dashboard/timeSrv' ], function(dashboardMock, helpers, _) { 'use strict'; diff --git a/src/test/test-main.js b/src/test/test-main.js index 5783b885d59..0caba61ae03 100644 --- a/src/test/test-main.js +++ b/src/test/test-main.js @@ -109,7 +109,6 @@ require([ } } - angular.module('grafana', ['ngRoute']); angular.module('grafana.services', ['ngRoute', '$strap.directives']); angular.module('grafana.panels', []); From d1e33ec071e43c92e18ed8388123d9184803485b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 31 Dec 2014 11:48:15 +0100 Subject: [PATCH 22/22] Moved routes --- src/app/app.js | 3 +-- src/app/routes/all.js | 7 ------ src/app/routes/dashboard-default.js | 20 ---------------- src/app/routes/standalone/default.js | 23 +++++++++++++++++++ .../fromDB.js} | 0 .../fromFile.js} | 0 .../fromScript.js} | 0 tasks/options/requirejs.js | 2 +- 8 files changed, 25 insertions(+), 30 deletions(-) delete mode 100644 src/app/routes/all.js delete mode 100644 src/app/routes/dashboard-default.js create mode 100644 src/app/routes/standalone/default.js rename src/app/routes/{dashboard-from-db.js => standalone/fromDB.js} (100%) rename src/app/routes/{dashboard-from-file.js => standalone/fromFile.js} (100%) rename src/app/routes/{dashboard-from-script.js => standalone/fromScript.js} (100%) diff --git a/src/app/app.js b/src/app/app.js index 86e5c8e3bcc..b1429f02550 100644 --- a/src/app/app.js +++ b/src/app/app.js @@ -50,7 +50,6 @@ function (angular, $, _, appLevelRequire, config) { }; app.config(function ($routeProvider, $controllerProvider, $compileProvider, $filterProvider, $provide) { - $routeProvider.otherwise({ redirectTo: config.default_route }); // this is how the internet told me to dynamically add modules :/ register_fns.controller = $controllerProvider.register; @@ -86,7 +85,7 @@ function (angular, $, _, appLevelRequire, config) { 'directives/all', 'filters/all', 'components/partials', - 'routes/all', + 'routes/standalone/default', ]; _.each(config.plugins.dependencies, function(dep) { diff --git a/src/app/routes/all.js b/src/app/routes/all.js deleted file mode 100644 index 5342515d545..00000000000 --- a/src/app/routes/all.js +++ /dev/null @@ -1,7 +0,0 @@ -define([ - './dashboard-from-db', - './dashboard-from-file', - './dashboard-from-script', - './dashboard-default', -], -function () {}); diff --git a/src/app/routes/dashboard-default.js b/src/app/routes/dashboard-default.js deleted file mode 100644 index 6721525b9e4..00000000000 --- a/src/app/routes/dashboard-default.js +++ /dev/null @@ -1,20 +0,0 @@ -define([ - 'angular', - 'config', - 'store' -], -function (angular, config, store) { - "use strict"; - - var module = angular.module('grafana.routes'); - - module.config(function($routeProvider) { - $routeProvider - .when('/', { - redirectTo: function() { - return store.get('grafanaDashboardDefault') || config.default_route; - } - }); - }); - -}); diff --git a/src/app/routes/standalone/default.js b/src/app/routes/standalone/default.js new file mode 100644 index 00000000000..6edd50369eb --- /dev/null +++ b/src/app/routes/standalone/default.js @@ -0,0 +1,23 @@ +define([ + 'angular', + 'config', + 'store', + './fromDB', + './fromFile', + './fromScript', +], +function (angular, config, store) { + 'use strict'; + + var module = angular.module('grafana.routes'); + + module.config(function($routeProvider) { + $routeProvider + .when('/', { + redirectTo: function() { + return store.get('grafanaDashboardDefault') || config.default_route; + } + }); + }); + +}); diff --git a/src/app/routes/dashboard-from-db.js b/src/app/routes/standalone/fromDB.js similarity index 100% rename from src/app/routes/dashboard-from-db.js rename to src/app/routes/standalone/fromDB.js diff --git a/src/app/routes/dashboard-from-file.js b/src/app/routes/standalone/fromFile.js similarity index 100% rename from src/app/routes/dashboard-from-file.js rename to src/app/routes/standalone/fromFile.js diff --git a/src/app/routes/dashboard-from-script.js b/src/app/routes/standalone/fromScript.js similarity index 100% rename from src/app/routes/dashboard-from-script.js rename to src/app/routes/standalone/fromScript.js diff --git a/tasks/options/requirejs.js b/tasks/options/requirejs.js index a889b9fd154..49830d90087 100644 --- a/tasks/options/requirejs.js +++ b/tasks/options/requirejs.js @@ -62,7 +62,7 @@ module.exports = function(config,grunt) { 'directives/all', 'filters/all', 'controllers/all', - 'routes/all', + 'routes/standalone/default', 'components/partials', ] }