[icinga-checkins] icinga.org: icinga-web/jmosshammer/default: * Overall status only coloured if objects available

git at icinga.org git at icinga.org
Tue Sep 28 11:49:08 CEST 2010


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

Author: Marius Hein <marius.hein at netways.de>
Date:   Thu Sep 23 10:43:24 2010 +0200

* Overall status only coloured if objects available

---

 .../templates/System/StatusOverallSuccess.php      |    9 ++++++++-
 app/modules/Web/lib/js/StatusData.js               |   10 +++++++---
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/app/modules/Cronks/templates/System/StatusOverallSuccess.php b/app/modules/Cronks/templates/System/StatusOverallSuccess.php
index 3076f97..2188eca 100644
--- a/app/modules/Cronks/templates/System/StatusOverallSuccess.php
+++ b/app/modules/Cronks/templates/System/StatusOverallSuccess.php
@@ -4,7 +4,14 @@ Cronk.util.initEnvironment("<?php echo $rd->getParameter('parentid'); ?>", funct
 	var statusOverallRenderer = {
 		prepareData: function(data, recordIndex, record) {
 			data.state_org = data.state;
-			data.state = Icinga.StatusData.wrapElement(data.type, data.state, data.count + ' {0}' );
+			
+			if (data.count == 0) {
+				data.state = Icinga.StatusData.wrapElement(data.type, data.state, data.count + ' {0}', Icinga.DEFAULTS.STATUS_DATA.servicestatusClass[100]);
+			}
+			else {
+				data.state = Icinga.StatusData.wrapElement(data.type, data.state, data.count + ' {0}');
+			}
+			
 			return data;
 		}
 	};
diff --git a/app/modules/Web/lib/js/StatusData.js b/app/modules/Web/lib/js/StatusData.js
index 6849ea5..f50b517 100755
--- a/app/modules/Web/lib/js/StatusData.js
+++ b/app/modules/Web/lib/js/StatusData.js
@@ -83,7 +83,7 @@ Icinga.StatusData = (function() {
 	var elementTemplate = new Ext.Template('<div class="icinga-status {cls}"><span>{text}</span></div>');
 	elementTemplate.compile();
 	
-	var elementWrapper = function(type, statusid, format) {
+	var elementWrapper = function(type, statusid, format, cls) {
 		format = (format || '{0}');
 		
 		var c = '';
@@ -94,6 +94,10 @@ Icinga.StatusData = (function() {
 			c = pub.servicestatusClass[statusid];
 		}
 		
+		if (!Ext.isEmpty(cls)) {
+			c = cls;
+		}
+		
 		var t = '';
 		if (type == 'host') {
 			t = pub.hoststatusText[statusid];
@@ -110,8 +114,8 @@ Icinga.StatusData = (function() {
 	
 	Ext.apply(pub, {
 		
-		wrapElement : function(type, statusid, format) {
-			return elementTemplate.apply(elementWrapper(type, statusid, format));
+		wrapElement : function(type, statusid, format, cls) {
+			return elementTemplate.apply(elementWrapper(type, statusid, format, cls));
 		},
 		
 		wrapText : function(type, statusid, format) {





More information about the icinga-checkins mailing list