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>
</ul>
<!-- IT Service editor -->
<ul class="tight-form-list" role="menu" ng-show="target.ITService">
<!-- Select IT Service -->
<li class="tight-form-item input-small" style="width: 5em">IT Service</li>
<li class="tight-form-item input-small">IT Service</li>
<li>
<input type="text"
class="tight-form-input input-medium"
<select class="tight-form-input input-large"
ng-change="selectITService()"
ng-model="target.itservice"
spellcheck='false'
placeholder="IT Service"
ng-blur="targetBlur()">
bs-tooltip="target.itservice.name.length > 25 ? target.itservice.name : ''"
ng-options="itservice.name for itservice in itserviceList track by itservice.name">
<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>
</ul>

View File

@@ -13,6 +13,16 @@ function (angular, _) {
$scope.init = function() {
$scope.targetLetters = targetLetters;
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'}],
@@ -27,6 +37,7 @@ function (angular, _) {
$scope.updateItemList();
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
*/