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] 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';