From 038e5a2492eb908a1641438fbc38472a2976f3a4 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Sun, 17 Jan 2016 20:00:07 +0300 Subject: [PATCH] Removed unused code. --- plugins/datasource-zabbix/queryCtrl.js | 125 ------------------------- 1 file changed, 125 deletions(-) diff --git a/plugins/datasource-zabbix/queryCtrl.js b/plugins/datasource-zabbix/queryCtrl.js index 0ef8401..4837d95 100644 --- a/plugins/datasource-zabbix/queryCtrl.js +++ b/plugins/datasource-zabbix/queryCtrl.js @@ -247,60 +247,6 @@ define([ } }; - /** - * Call when host group selected - */ - $scope.selectHostGroup = function () { - $scope.updateHostList(); - $scope.updateAppList(); - $scope.updateItemList(); - - $scope.target.errors = validateTarget($scope.target); - if (!_.isEqual($scope.oldTarget, $scope.target) && _.isEmpty($scope.target.errors)) { - $scope.oldTarget = angular.copy($scope.target); - $scope.get_data(); - } - }; - - /** - * Call when host selected - */ - $scope.selectHost = function () { - $scope.updateAppList(); - $scope.updateItemList(); - - $scope.target.errors = validateTarget($scope.target); - if (!_.isEqual($scope.oldTarget, $scope.target) && _.isEmpty($scope.target.errors)) { - $scope.oldTarget = angular.copy($scope.target); - $scope.get_data(); - } - }; - - /** - * Call when application selected - */ - $scope.selectApplication = function () { - $scope.updateItemList(); - - $scope.target.errors = validateTarget($scope.target); - if (!_.isEqual($scope.oldTarget, $scope.target) && _.isEmpty($scope.target.errors)) { - $scope.oldTarget = angular.copy($scope.target); - $scope.get_data(); - } - }; - - /** - * Call when item selected - */ - $scope.selectItem = function () { - setItemAlias(); - $scope.target.errors = validateTarget($scope.target); - if (!_.isEqual($scope.oldTarget, $scope.target) && _.isEmpty($scope.target.errors)) { - $scope.oldTarget = angular.copy($scope.target); - $scope.get_data(); - } - }; - $scope.duplicate = function () { var clone = angular.copy($scope.target); $scope.panel.targets.push(clone); @@ -310,10 +256,6 @@ define([ _.move($scope.panel.targets, fromIndex, toIndex); }; - ////////////////////////////// - // SUGGESTION QUERIES - ////////////////////////////// - /** * Update list of IT services */ @@ -324,73 +266,6 @@ define([ }); }; - /** - * Update list of host groups - */ - $scope.updateGroupList = function () { - $scope.datasource.zabbixAPI.performHostGroupSuggestQuery().then(function (groups) { - $scope.metric.groupList = [{name: '*', visible_name: 'All'}]; - addTemplatedVariables($scope.metric.groupList); - $scope.metric.groupList = $scope.metric.groupList.concat(groups); - }); - }; - - /** - * Update list of hosts - */ - $scope.updateHostList = function () { - var groups = $scope.target.group ? zabbixHelperSrv.splitMetrics(templateSrv.replace($scope.target.group.name)) : undefined; - if (groups) { - $scope.datasource.zabbixAPI.hostFindQuery(groups).then(function (hosts) { - $scope.metric.hostList = [{name: '*', visible_name: 'All'}]; - addTemplatedVariables($scope.metric.hostList); - $scope.metric.hostList = $scope.metric.hostList.concat(hosts); - }); - } - }; - - /** - * Update list of host applications - */ - $scope.updateAppList = function () { - var groups = $scope.target.group ? zabbixHelperSrv.splitMetrics(templateSrv.replace($scope.target.group.name)) : undefined; - var hosts = $scope.target.host ? zabbixHelperSrv.splitMetrics(templateSrv.replace($scope.target.host.name)) : undefined; - if (groups && hosts) { - $scope.datasource.zabbixAPI.appFindQuery(hosts, groups).then(function (apps) { - apps = _.map(_.uniq(_.map(apps, 'name')), function (appname) { - return {name: appname}; - }); - $scope.metric.applicationList = [{name: '*', visible_name: 'All'}]; - addTemplatedVariables($scope.metric.applicationList); - $scope.metric.applicationList = $scope.metric.applicationList.concat(apps); - }); - } - }; - - /** - * Update list of items - */ - $scope.updateItemList = function () { - var groups = $scope.target.group ? zabbixHelperSrv.splitMetrics(templateSrv.replace($scope.target.group.name)) : undefined; - var hosts = $scope.target.host ? zabbixHelperSrv.splitMetrics(templateSrv.replace($scope.target.host.name)) : undefined; - var apps = $scope.target.application ? - zabbixHelperSrv.splitMetrics(templateSrv.replace($scope.target.application.name)) : undefined; - var itemtype = $scope.target.mode === 2 ? "text" : "numeric"; - if (groups && hosts && apps) { - $scope.datasource.zabbixAPI.itemFindQuery(groups, hosts, apps, itemtype).then(function (items) { - // Show only unique item names - var uniq_items = _.map(_.uniq(items, function (item) { - return zabbixHelperSrv.expandItemName(item); - }), function (item) { - return {name: zabbixHelperSrv.expandItemName(item)}; - }); - $scope.metric.itemList = [{name: 'All'}]; - addTemplatedVariables($scope.metric.itemList); - $scope.metric.itemList = $scope.metric.itemList.concat(uniq_items); - }); - } - }; - /** * Add templated variables to list of available metrics *