[icinga-checkins] icinga.org: icinga-web/jmosshammer/default: * Added pending states ( #ref 371)

git at icinga.org git at icinga.org
Mon Sep 13 16:46:47 CEST 2010


Module: icinga-web
Branch: jmosshammer/default
Commit: ac15553ff70f5ba6d95d27f5d048328972f07a9f
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=ac15553ff70f5ba6d95d27f5d048328972f07a9f

Author: jmosshammer <jmosshammer at ws-jmosshammer.(none)>
Date:   Mon Sep 13 16:45:56 2010 +0200

* Added pending states (#ref 371)

---

 .../Cronks/data/xml/grid/icinga-host-template.xml  |    1 +
 .../xml/grid/icinga-open-problems-template.xml     |    3 ++-
 .../data/xml/grid/icinga-service-template.xml      |    3 ++-
 app/modules/Cronks/lib/js/grid/ColumnRenderer.js   |    8 ++++++++
 .../models/System/StatusOverallModel.class.php     |    3 +++
 app/modules/Web/lib/js/StatusData.js               |    8 +++++++-
 pub/styles/icinga.css                              |    9 +++++++++
 7 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/app/modules/Cronks/data/xml/grid/icinga-host-template.xml b/app/modules/Cronks/data/xml/grid/icinga-host-template.xml
index 78ea1af..4d1fd54 100644
--- a/app/modules/Cronks/data/xml/grid/icinga-host-template.xml
+++ b/app/modules/Cronks/data/xml/grid/icinga-host-template.xml
@@ -260,6 +260,7 @@
        	<parameter name="additional_fields">
        		<parameter name="max_attempt">HOST_MAX_CHECK_ATTEMPTS</parameter>
        		<parameter name="instance_id">HOST_INSTANCE_ID</parameter>
+			<parameter name="host_is_pending">HOST_IS_PENDING</parameter>
        	</parameter>
        	
        	<parameter name="additional_filter_fields">
diff --git a/app/modules/Cronks/data/xml/grid/icinga-open-problems-template.xml b/app/modules/Cronks/data/xml/grid/icinga-open-problems-template.xml
index 70bbf16..fc0b095 100644
--- a/app/modules/Cronks/data/xml/grid/icinga-open-problems-template.xml
+++ b/app/modules/Cronks/data/xml/grid/icinga-open-problems-template.xml
@@ -164,7 +164,8 @@
        		<parameter name="max_attempt_host">HOST_MAX_CHECK_ATTEMPTS</parameter>
 			<parameter name="max_attempt_service">SERVICE_MAX_CHECK_ATTEMPTS</parameter>
        		<parameter name="instance_id">HOST_INSTANCE_ID</parameter>
-
+			<parameter name="service_is_pending">SERVICE_IS_PENDING</parameter>
+			<parameter name="host_is_pending">HOST_IS_PENDING</parameter>
        	</parameter>
        	
        	<parameter name="additional_filter_fields">
diff --git a/app/modules/Cronks/data/xml/grid/icinga-service-template.xml b/app/modules/Cronks/data/xml/grid/icinga-service-template.xml
index 29c59e0..2acafb3 100644
--- a/app/modules/Cronks/data/xml/grid/icinga-service-template.xml
+++ b/app/modules/Cronks/data/xml/grid/icinga-service-template.xml
@@ -237,7 +237,8 @@
        	<parameter name="additional_fields">
        		<parameter name="service_max_attempt">SERVICE_MAX_CHECK_ATTEMPTS</parameter>
        		<parameter name="instance_id">SERVICE_INSTANCE_ID</parameter>
-       	</parameter>
+			<parameter name="service_is_pending">SERVICE_IS_PENDING</parameter>
+		</parameter>
        	
        	<parameter name="additional_filter_fields">
        		<parameter name="servicegroup_object_id">SERVICEGROUP_OBJECT_ID</parameter>
diff --git a/app/modules/Cronks/lib/js/grid/ColumnRenderer.js b/app/modules/Cronks/lib/js/grid/ColumnRenderer.js
index 9670f2e..8417166 100755
--- a/app/modules/Cronks/lib/js/grid/ColumnRenderer.js
+++ b/app/modules/Cronks/lib/js/grid/ColumnRenderer.js
@@ -111,6 +111,9 @@ Cronk.grid.ColumnRenderer = {
 	
 	serviceStatus : function(cfg) {
 		return function(value, metaData, record, rowIndex, colIndex, store) {
+			if(Ext.isDefined(record.json.service_is_pending))
+				if(record.json.servce_is_pending == 1)
+					value=99;
 			if(!value)
 				return "";
 			return Icinga.StatusData.wrapElement('service', value);
@@ -119,6 +122,11 @@ Cronk.grid.ColumnRenderer = {
 	
 	hostStatus : function(cfg) {
 		return function(value, metaData, record, rowIndex, colIndex, store) {
+			if(Ext.isDefined(record.json.host_is_pending))
+				if(record.json.host_is_pending == 1)
+					value=99;
+			if(!value)
+				return "";
 			return Icinga.StatusData.wrapElement('host', value);
 		}
 	},
diff --git a/app/modules/Cronks/models/System/StatusOverallModel.class.php b/app/modules/Cronks/models/System/StatusOverallModel.class.php
index 92603f4..ca8d5fa 100644
--- a/app/modules/Cronks/models/System/StatusOverallModel.class.php
+++ b/app/modules/Cronks/models/System/StatusOverallModel.class.php
@@ -28,7 +28,9 @@ class Cronks_System_StatusOverallModel extends CronksBaseModel {
 		$target = array ();
 
 		foreach ($sources as $stype=>$tarray) {
+			$type = explode("_",strtoupper($stype));
 			$search = $this->api->createSearch()->setSearchTarget($stype);
+			$search->setSearchFilter($type[0]."_IS_PENDING","0","=");
 			IcingaPrincipalTargetTool::applyApiSecurityPrincipals($search);
 			$this->buildDataArray($search, $tarray[0], $tarray[1], $target);
 		}
@@ -49,6 +51,7 @@ class Cronks_System_StatusOverallModel extends CronksBaseModel {
 
 	private function buildDataArray(IcingaApiSearch &$search, $type, array $states, array &$target) {
 		$data = $search->setResultType(IcingaApi::RESULT_ARRAY)->fetch()->getAll();
+
 		$field = sprintf('%s_STATE', strtoupper($type));
 		$data = $this->normalizeData($data, $field);
 		$sum = 0;
diff --git a/app/modules/Web/lib/js/StatusData.js b/app/modules/Web/lib/js/StatusData.js
index 8a98977..6849ea5 100755
--- a/app/modules/Web/lib/js/StatusData.js
+++ b/app/modules/Web/lib/js/StatusData.js
@@ -33,11 +33,13 @@ Icinga.DEFAULTS.STATUS_DATA = {
 	HOST_UP : 0,
 	HOST_DOWN: 1,
 	HOST_UNREACHABLE: 2,
-	
+	HOST_PENDING: 99,
+
 	hoststatusText : {
 		0: _('UP'),
 		1: _('DOWN'),
 		2: _('UNREACHABLE'),
+		99: _('PENDING'),
 		100: _('IN TOTAL')
 	},
 	
@@ -45,6 +47,7 @@ Icinga.DEFAULTS.STATUS_DATA = {
 		0: 'icinga-status-up',
 		1: 'icinga-status-down',
 		2: 'icinga-status-unreachable',
+		99:'icinga-status-pending',
 		100: 'icinga-status-all'
 	},
 	
@@ -52,12 +55,14 @@ Icinga.DEFAULTS.STATUS_DATA = {
 	SERVICE_WARNING : 1,
 	SERVICE_CRITICAL : 2,
 	SERVICE_UNKNOWN : 3,
+	SERVICE_PENDING: 99,
 	
 	servicestatusText : {
 		0: _('OK'),
 		1: _('WARNING'),
 		2: _('CRITICAL'),
 		3: _('UNKNOWN'),
+		99: _('PENDING'),
 		100: _('IN TOTAL')
 	},
 	
@@ -66,6 +71,7 @@ Icinga.DEFAULTS.STATUS_DATA = {
 		1: 'icinga-status-warning',
 		2: 'icinga-status-critical',
 		3: 'icinga-status-unknown',
+		99:'icinga-status-pending',
 		100: 'icinga-status-all'
 	}
 };
diff --git a/pub/styles/icinga.css b/pub/styles/icinga.css
index 273ac06..3b218a3 100644
--- a/pub/styles/icinga.css
+++ b/pub/styles/icinga.css
@@ -329,6 +329,15 @@ span.icinga-status-unknown {
 	color: #ff8000;
 }
 
+span.icinga-status-pending {
+	color: #aa3377;
+}
+
+div.icinga-status-pending {
+	background-color: #aa2277;
+}
+
+
 div.icinga-status-all {
 	background-color: #a0a0a0;
 }





More information about the icinga-checkins mailing list