diff --git a/zabbix/partials/query.editor.html b/zabbix/partials/query.editor.html index fe8a516..e7f2916 100644 --- a/zabbix/partials/query.editor.html +++ b/zabbix/partials/query.editor.html @@ -51,16 +51,26 @@ + diff --git a/zabbix/queryCtrl.js b/zabbix/queryCtrl.js index 0a02a58..bca12e5 100644 --- a/zabbix/queryCtrl.js +++ b/zabbix/queryCtrl.js @@ -13,20 +13,31 @@ function (angular, _) { $scope.init = function() { $scope.targetLetters = targetLetters; - $scope.metric = { - hostGroupList: [], - hostList: [{name: '*', visible_name: 'All'}], - applicationList: [{name: '*', visible_name: 'All'}], - itemList: [{name: 'All'}] - }; + if ($scope.target.ITService) { + $scope.slaPropertyList = [ + "sla", + "okTime", + "problemTime", + "downtimeTime" + ]; + $scope.itserviceList = [{name: "test"}]; + $scope.updateITServiceList(); + } else { + $scope.metric = { + hostGroupList: [], + hostList: [{name: '*', visible_name: 'All'}], + applicationList: [{name: '*', visible_name: 'All'}], + itemList: [{name: 'All'}] + }; - // Update host group, host, application and item lists - $scope.updateGroupList(); - $scope.updateHostList(); - $scope.updateAppList(); - $scope.updateItemList(); + // Update host group, host, application and item lists + $scope.updateGroupList(); + $scope.updateHostList(); + $scope.updateAppList(); + $scope.updateItemList(); - setItemAlias(); + setItemAlias(); + } $scope.target.errors = validateTarget($scope.target); }; @@ -49,6 +60,17 @@ function (angular, _) { } }; + /** + * Call when IT service is selected. + */ + $scope.selectITService = function() { + $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 group selected */ @@ -116,6 +138,17 @@ function (angular, _) { // SUGGESTION QUERIES ////////////////////////////// + + /** + * Update list of IT services + */ + $scope.updateITServiceList = function() { + $scope.datasource.zabbixAPI.getITService().then(function (iteservices) { + $scope.itserviceList = []; + $scope.itserviceList = $scope.itserviceList.concat(iteservices); + }); + }; + /** * Update list of host groups */