From 5e02025eaf32f2c0326e04129c8e2119bcc6eeda Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Mon, 27 Jul 2015 17:07:51 +0300 Subject: [PATCH] iss #19 - Added status request for IT service. --- zabbix/helperFunctions.js | 24 +++++++++++++++++------- zabbix/queryCtrl.js | 1 + 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/zabbix/helperFunctions.js b/zabbix/helperFunctions.js index a3711f1..4f076b3 100644 --- a/zabbix/helperFunctions.js +++ b/zabbix/helperFunctions.js @@ -119,13 +119,23 @@ function (angular, _) { */ this.handleSLAResponse = function (itservice, slaProperty, slaObject) { var targetSLA = slaObject[itservice.serviceid].sla[0]; - return { - target: itservice.name + ' ' + slaProperty.name, - datapoints: [ - [targetSLA[slaProperty.property], targetSLA.from * 1000], - [targetSLA[slaProperty.property], targetSLA.to * 1000] - ] - }; + if (slaProperty.property === 'status') { + var targetStatus = slaObject[itservice.serviceid].status; + return { + target: itservice.name + ' ' + slaProperty.name, + datapoints: [ + [targetStatus, targetSLA.to * 1000] + ] + }; + } else { + return { + target: itservice.name + ' ' + slaProperty.name, + datapoints: [ + [targetSLA[slaProperty.property], targetSLA.from * 1000], + [targetSLA[slaProperty.property], targetSLA.to * 1000] + ] + }; + } }; /** diff --git a/zabbix/queryCtrl.js b/zabbix/queryCtrl.js index f2b181d..88a3375 100644 --- a/zabbix/queryCtrl.js +++ b/zabbix/queryCtrl.js @@ -15,6 +15,7 @@ define([ $scope.targetLetters = targetLetters; if ($scope.target.ITService) { $scope.slaPropertyList = [ + {name: "Status", property: "status"}, {name: "SLA", property: "sla"}, {name: "OK time", property: "okTime"}, {name: "Problem time", property: "problemTime"},