Selaa lähdekoodia

Trying to organize code more around features than the standard controllers, services structure

Torkel Ödegaard 11 vuotta sitten
vanhempi
commit
8268c65c57

+ 0 - 1
src/app/controllers/all.js

@@ -10,7 +10,6 @@ define([
   './graphiteImport',
   './playlistCtrl',
   './inspectCtrl',
-  './opentsdbTargetCtrl',
   './annotationsEditorCtrl',
   './templateEditorCtrl',
   './sharePanelCtrl',

+ 2 - 0
src/app/features/all.js

@@ -2,4 +2,6 @@ define([
   './panellinkeditor/module',
   './graphite/datasource',
   './influxdb/datasource',
+  './opentsdb/datasource',
+  './elasticsearch/datasource',
 ], function () {});

+ 1 - 1
src/app/services/elasticsearch/es-datasource.js → 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;
     }

+ 0 - 0
src/app/partials/elasticsearch/annotation_editor.html → src/app/features/elasticsearch/partials/annotations.editor.html


+ 1 - 1
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) {

+ 3 - 2
src/app/services/opentsdb/opentsdbDatasource.js → 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;

+ 1 - 1
src/app/partials/opentsdb/editor.html → src/app/features/opentsdb/partials/query.editor.html

@@ -2,7 +2,7 @@
   <div  ng-repeat="target in panel.targets"
         class="grafana-target"
         ng-class="{'grafana-target-hidden': target.hide}"
-        ng-controller="OpenTSDBTargetCtrl"
+        ng-controller="OpenTSDBQueryCtrl"
         ng-init="init()">
 
     <div class="grafana-target-inner-wrapper">

+ 1 - 1
src/app/controllers/opentsdbTargetCtrl.js → 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);

+ 0 - 2
src/app/services/datasourceSrv.js

@@ -2,8 +2,6 @@ define([
   'angular',
   'lodash',
   'config',
-  './opentsdb/opentsdbDatasource',
-  './elasticsearch/es-datasource',
 ],
 function (angular, _, config) {
   'use strict';