Просмотр исходного кода

feat(plugins): upgraded influxdb to new plugin format

Torkel Ödegaard 10 лет назад
Родитель
Сommit
6fae264222

+ 1 - 1
package.json

@@ -70,7 +70,7 @@
     "lodash": "^2.4.1",
     "sinon": "1.16.1",
     "systemjs-builder": "^0.14.15",
-    "tslint": "^5.2.0",
+    "tslint": "^3.2.1",
     "typescript": "^1.7.5"
   }
 }

+ 7 - 3
public/app/plugins/datasource/grafana/module.ts

@@ -5,10 +5,14 @@ import {GrafanaDatasource} from './datasource';
 
 var module = angular.module('grafana.directives');
 
-module.directive('metricQueryEditorGrafana', function() {
+function grafanaMetricsQueryEditor() {
   return {templateUrl: 'app/plugins/datasource/grafana/partials/query.editor.html'};
-});
+}
 
 
-export {GrafanaDatasource, GrafanaDatasource as Datasource};
+export {
+  GrafanaDatasource,
+  GrafanaDatasource as Datasource,
+  grafanaMetricsQueryEditor as metricsQueryEditor
+};
 

+ 14 - 13
public/app/plugins/datasource/influxdb/module.js

@@ -1,29 +1,30 @@
 define([
-  'angular',
   './datasource',
 ],
-function (angular, InfluxDatasource) {
+function (InfluxDatasource) {
   'use strict';
 
-  var module = angular.module('grafana.directives');
-
-  module.directive('metricQueryEditorInfluxdb', function() {
+  function influxMetricsQueryEditor() {
     return {controller: 'InfluxQueryCtrl', templateUrl: 'app/plugins/datasource/influxdb/partials/query.editor.html'};
-  });
+  }
 
-  module.directive('metricQueryOptionsInfluxdb', function() {
+  function influxMetricsQueryOptions() {
     return {templateUrl: 'app/plugins/datasource/influxdb/partials/query.options.html'};
-  });
+  }
 
-  module.directive('annotationsQueryEditorInfluxdb', function() {
+  function influxAnnotationsQueryEditor() {
     return {templateUrl: 'app/plugins/datasource/influxdb/partials/annotations.editor.html'};
-  });
+  }
 
-  module.directive('datasourceCustomSettingsViewInfluxdb', function() {
+  function influxConfigView() {
     return {templateUrl: 'app/plugins/datasource/influxdb/partials/config.html'};
-  });
+  }
 
   return {
-    Datasource: InfluxDatasource
+    Datasource:               InfluxDatasource,
+    metricsQueryEditor:       influxMetricsQueryEditor,
+    metricsQueryOptions:      influxMetricsQueryOptions,
+    annotationsQueryEditor:   influxAnnotationsQueryEditor,
+    configView:               influxConfigView,
   };
 });

+ 4 - 4
public/app/plugins/datasource/influxdb/partials/annotations.editor.html

@@ -2,7 +2,7 @@
 	<div class="section">
 		<h5>InfluxDB Query <tip>Example: select text from events where $timeFilter</tip></h5>
 		<div class="editor-option">
-			<input type="text" class="span10" ng-model='currentAnnotation.query' placeholder="select text from events where $timeFilter"></input>
+			<input type="text" class="span10" ng-model='annotation.query' placeholder="select text from events where $timeFilter"></input>
 		</div>
 	</div>
 </div>
@@ -12,17 +12,17 @@
 		<h5>Column mappings <tip>If your influxdb query returns more than one column you need to specify the column names below. An annotation event is composed of a title, tags, and an additional text field.</tip></h5>
 		<div class="editor-option">
 			<label class="small">Title</label>
-			<input type="text" class="input-small" ng-model='currentAnnotation.titleColumn' placeholder=""></input>
+			<input type="text" class="input-small" ng-model='annotation.titleColumn' placeholder=""></input>
 		</div>
 
 		<div class="editor-option">
 			<label class="small">Tags</label>
-			<input type="text" class="input-small" ng-model='currentAnnotation.tagsColumn' placeholder=""></input>
+			<input type="text" class="input-small" ng-model='annotation.tagsColumn' placeholder=""></input>
 		</div>
 
 		<div class="editor-option">
 			<label class="small">Text</label>
-			<input type="text" class="input-small" ng-model='currentAnnotation.textColumn' placeholder=""></input>
+			<input type="text" class="input-small" ng-model='annotation.textColumn' placeholder=""></input>
 		</div>
 	</div>
 </div>