diff --git a/zabbix/datasource.js b/zabbix/datasource.js index 0afa562..447d827 100644 --- a/zabbix/datasource.js +++ b/zabbix/datasource.js @@ -1,12 +1,13 @@ define([ 'angular', 'lodash', - 'kbn', + 'app/core/utils/datemath', + './directives', './zabbixAPIWrapper', './helperFunctions', './queryCtrl' ], -function (angular, _, kbn) { +function (angular, _, dateMath) { 'use strict'; var module = angular.module('grafana.services'); @@ -93,9 +94,9 @@ function (angular, _, kbn) { ZabbixAPIDatasource.prototype.query = function(options) { // get from & to in seconds - var from = Math.ceil(kbn.parseDate(options.range.from).getTime() / 1000); - var to = Math.ceil(kbn.parseDate(options.range.to).getTime() / 1000); - var useTrendsFrom = Math.ceil(kbn.parseDate('now-' + this.trendsFrom).getTime() / 1000); + var from = Math.ceil(dateMath.parse(options.range.from) / 1000); + var to = Math.ceil(dateMath.parse(options.range.to) / 1000); + var useTrendsFrom = Math.ceil(dateMath.parse('now-' + this.trendsFrom) / 1000); // Create request for each target var promises = _.map(options.targets, function(target) { @@ -336,8 +337,8 @@ function (angular, _, kbn) { ///////////////// ZabbixAPIDatasource.prototype.annotationQuery = function(annotation, rangeUnparsed) { - var from = Math.ceil(kbn.parseDate(rangeUnparsed.from).getTime() / 1000); - var to = Math.ceil(kbn.parseDate(rangeUnparsed.to).getTime() / 1000); + var from = Math.ceil(dateMath.parse(rangeUnparsed.from) / 1000); + var to = Math.ceil(dateMath.parse(rangeUnparsed.to) / 1000); var self = this; var params = { diff --git a/zabbix/directives.js b/zabbix/directives.js new file mode 100644 index 0000000..95bb491 --- /dev/null +++ b/zabbix/directives.js @@ -0,0 +1,17 @@ +define([ + 'angular' + ], + function (angular) { + 'use strict'; + + var module = angular.module('grafana.directives'); + + module.directive('metricQueryEditorZabbix', function() { + return {controller: 'ZabbixAPIQueryCtrl', templateUrl: 'app/plugins/datasource/zabbix/partials/query.editor.html'}; + }); + + module.directive('metricQueryOptionsZabbix', function() { + return {templateUrl: 'app/plugins/datasource/zabbix/partials/query.options.html'}; + }); + + }); diff --git a/zabbix/partials/query.editor.html b/zabbix/partials/query.editor.html index 26e2ea5..5a85dc5 100644 --- a/zabbix/partials/query.editor.html +++ b/zabbix/partials/query.editor.html @@ -1,318 +1,227 @@ -
- Select "IT services" in targets menu to activate IT services mode. -
-+ Select "IT services" in targets menu to activate IT services mode. +
+