iss #19 - Getting list of IT services and SLA property selection.

This commit is contained in:
Alexander Zobnin
2015-07-25 17:04:44 +03:00
parent add7ed0f0f
commit 0202949c2d
2 changed files with 63 additions and 20 deletions

View File

@@ -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
*/