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

@@ -51,16 +51,26 @@
</li> </li>
</ul> </ul>
<!-- IT Service editor -->
<ul class="tight-form-list" role="menu" ng-show="target.ITService"> <ul class="tight-form-list" role="menu" ng-show="target.ITService">
<!-- Select IT Service --> <li class="tight-form-item input-small">IT Service</li>
<li class="tight-form-item input-small" style="width: 5em">IT Service</li>
<li> <li>
<input type="text" <select class="tight-form-input input-large"
class="tight-form-input input-medium" ng-change="selectITService()"
ng-model="target.itservice" ng-model="target.itservice"
spellcheck='false' bs-tooltip="target.itservice.name.length > 25 ? target.itservice.name : ''"
placeholder="IT Service" ng-options="itservice.name for itservice in itserviceList track by itservice.name">
ng-blur="targetBlur()"> <option value="">-- Select IT service --</option>
</select>
</li>
<li class="tight-form-item input-small">SLA property</li>
<li>
<select class="tight-form-input input-medium"
ng-change="selectSLAProperty()"
ng-model="target.slaProperty"
ng-options="slaProperty for slaProperty in slaPropertyList track by slaProperty">
<option value="">-- SLA property --</option>
</select>
</li> </li>
</ul> </ul>

View File

@@ -13,6 +13,16 @@ function (angular, _) {
$scope.init = function() { $scope.init = function() {
$scope.targetLetters = targetLetters; $scope.targetLetters = targetLetters;
if ($scope.target.ITService) {
$scope.slaPropertyList = [
"sla",
"okTime",
"problemTime",
"downtimeTime"
];
$scope.itserviceList = [{name: "test"}];
$scope.updateITServiceList();
} else {
$scope.metric = { $scope.metric = {
hostGroupList: [], hostGroupList: [],
hostList: [{name: '*', visible_name: 'All'}], hostList: [{name: '*', visible_name: 'All'}],
@@ -27,6 +37,7 @@ function (angular, _) {
$scope.updateItemList(); $scope.updateItemList();
setItemAlias(); setItemAlias();
}
$scope.target.errors = validateTarget($scope.target); $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 * Call when host group selected
*/ */
@@ -116,6 +138,17 @@ function (angular, _) {
// SUGGESTION QUERIES // 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 * Update list of host groups
*/ */