[icinga-checkins] icinga.org: icinga-web/mhein/default: * Changelog

git at icinga.org git at icinga.org
Wed Jan 13 14:34:45 CET 2010


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

Author: Marius Hein <marius.hein at netways.de>
Date:   Wed Jan 13 14:34:09 2010 +0100

* Changelog
* More states to status icons
* Status icon files (from org icinga theme)

---

 .../IcingaTemplateDisplayServiceIcons.class.php    |   95 +++++++++++++++++++-
 doc/CHANGELOG                                      |   11 ++-
 pub/images/status/acknowledged.png                 |  Bin 669 -> 560 bytes
 pub/images/status/disabled.png                     |  Bin 0 -> 518 bytes
 pub/images/status/downtime.png                     |  Bin 0 -> 576 bytes
 pub/images/status/flapping.png                     |  Bin 0 -> 603 bytes
 pub/images/status/indowntime.png                   |  Bin 992 -> 0 bytes
 pub/images/status/ndisabled.png                    |  Bin 1339 -> 397 bytes
 pub/images/status/passive.png                      |  Bin 1176 -> 549 bytes
 9 files changed, 101 insertions(+), 5 deletions(-)

diff --git a/app/lib/icinga/tdisplay/IcingaTemplateDisplayServiceIcons.class.php b/app/lib/icinga/tdisplay/IcingaTemplateDisplayServiceIcons.class.php
index 16f8ecb..9e4a09e 100644
--- a/app/lib/icinga/tdisplay/IcingaTemplateDisplayServiceIcons.class.php
+++ b/app/lib/icinga/tdisplay/IcingaTemplateDisplayServiceIcons.class.php
@@ -2,23 +2,45 @@
 
 class IcingaTemplateDisplayServiceIcons extends IcingaTemplateDisplay {
 	
+	/**
+	 * Eval condition return constant
+	 * @var integer
+	 */
 	const COND_ERROR = 0xffff;
 	
+	/**
+	 * The image base path, appended to the web base path
+	 * @var string
+	 */
 	private $image_path = '/images/status';
 	
+	/**
+	 * A list of fields to be used in the conditions map
+	 * @var array
+	 */
 	private static $service_fields = array (
 		'SERVICE_NOTIFICATIONS_ENABLED', 'SERVICE_ACTIVE_CHECKS_ENABLED',
 		'SERVICE_PASSIVE_CHECKS_ENABLED', 'SERVICE_CURRENT_STATE',
-		'SERVICE_PROBLEM_HAS_BEEN_ACKNOWLEDGED'
+		'SERVICE_PROBLEM_HAS_BEEN_ACKNOWLEDGED', 'SERVICE_IS_FLAPPING',
+		'SERVICE_SCHEDULED_DOWNTIME_DEPTH'
 	);
 	
+	
+	/**
+	 * The conditions map, the array key is php logical with
+	 * format parser syntax, all fields defined in the field list
+	 * can be used. Target array keys are true and false which holds
+	 * another array in it, container an image name and its alt 
+	 * description
+	 * @var array
+	 */
 	private static $service_conditions = array (
 		'${field.SERVICE_NOTIFICATIONS_ENABLED}' => array (
 			false	=> array ('ndisabled.png', 'Notifications disabled')
 		),
 		
 		'!${field.SERVICE_ACTIVE_CHECKS_ENABLED} && !${field.SERVICE_PASSIVE_CHECKS_ENABLED}' => array (
-			true	=> array ('off.png', 'Service disabled')
+			true	=> array ('disabled.png', 'Service disabled')
 		),
 		
 		'!${field.SERVICE_ACTIVE_CHECKS_ENABLED} && ${field.SERVICE_PASSIVE_CHECKS_ENABLED}' => array (
@@ -27,22 +49,43 @@ class IcingaTemplateDisplayServiceIcons extends IcingaTemplateDisplay {
 		
 		'${field.SERVICE_CURRENT_STATE} && ${field.SERVICE_PROBLEM_HAS_BEEN_ACKNOWLEDGED}' => array (
 			true	=> array ('acknowledged.png', 'Problem has been acknowledged')
+		),
+		
+		'${field.SERVICE_IS_FLAPPING}' => array (
+			true	=> array ('flapping.png', 'Service is flapping')
+		),
+		
+		'${field.SERVICE_SCHEDULED_DOWNTIME_DEPTH}' => array (
+			true	=> array ('downtime.png', 'Service is flapping')
 		)
 	);
 	
+	/**
+	 * A list of fields to be used in the conditions map
+	 * @var array
+	 */
 	private static $host_fields = array (
 		'HOST_NOTIFICATIONS_ENABLED', 'HOST_ACTIVE_CHECKS_ENABLED',
 		'HOST_PASSIVE_CHECKS_ENABLED', 'HOST_CURRENT_STATE',
-		'HOST_PROBLEM_HAS_BEEN_ACKNOWLEDGED'
+		'HOST_PROBLEM_HAS_BEEN_ACKNOWLEDGED', 'HOST_IS_FLAPPING',
+		'HOST_SCHEDULED_DOWNTIME_DEPTH'
 	);
 	
+	/**
+	 * The conditions map, the array key is php logical with
+	 * format parser syntax, all fields defined in the field list
+	 * can be used. Target array keys are true and false which holds
+	 * another array in it, container an image name and its alt 
+	 * description
+	 * @var array
+	 */
 	private static $host_conditions = array (
 		'${field.HOST_NOTIFICATIONS_ENABLED}' => array (
 			false	=> array ('ndisabled.png', 'Notifications disabled')
 		),
 		
 		'${field.HOST_ACTIVE_CHECKS_ENABLED} && ${field.HOST_PASSIVE_CHECKS_ENABLED}' => array (
-			false	=> array ('off.png', 'Service disabled')
+			false	=> array ('disabled.png', 'Service disabled')
 		),
 		
 		'!${field.HOST_ACTIVE_CHECKS_ENABLED} && ${field.HOST_PASSIVE_CHECKS_ENABLED}' => array (
@@ -51,13 +94,32 @@ class IcingaTemplateDisplayServiceIcons extends IcingaTemplateDisplay {
 		
 		'${field.HOST_CURRENT_STATE} && ${field.HOST_PROBLEM_HAS_BEEN_ACKNOWLEDGED}' => array (
 			true	=> array ('acknowledged.png', 'Problem has been acknowledged')
+		),
+		
+		'${field.HOST_IS_FLAPPING}' => array (
+			true	=> array ('flapping.png', 'Host is flapping')
+		),
+		
+		'${field.HOST_SCHEDULED_DOWNTIME_DEPTH}' => array (
+			true	=> array ('downtime.png', 'Service is flapping')
 		)
 	);
 	
+	/**
+	 * Returns a singleton class instance
+	 * @return IcingaTemplateDisplayServiceIcons
+	 */
 	public static function getInstance() {
 		return parent::getInstance(__CLASS__);
 	}
 	
+	/**
+	 * Returns the service status icons from the map above defined
+	 * @param mixed $val
+	 * @param AgaviParameterHolder $method_params
+	 * @param AgaviParameterHolder $row
+	 * @return string
+	 */
 	public function serviceIcons($val, AgaviParameterHolder $method_params, AgaviParameterHolder $row) {
 		
 		$id = $this->getObjectId($method_params->getParameter('field', null), $row);
@@ -70,6 +132,13 @@ class IcingaTemplateDisplayServiceIcons extends IcingaTemplateDisplay {
 		return $this->buildIcons($dh, self::$service_conditions);
 	}
 	
+	/**
+	 * Returns the host status icons from the map above defined
+	 * @param mixed $val
+	 * @param AgaviParameterHolder $method_params
+	 * @param AgaviParameterHolder $row
+	 * @return string
+	 */
 	public function hostIcons($val, AgaviParameterHolder $method_params, AgaviParameterHolder $row) {
 		
 		$id = $this->getObjectId($method_params->getParameter('field', null), $row);
@@ -82,6 +151,12 @@ class IcingaTemplateDisplayServiceIcons extends IcingaTemplateDisplay {
 		return $this->buildIcons($dh, self::$host_conditions);
 	}
 	
+	/**
+	 * Build the icon frames with the field and the conditions map
+	 * @param IcingaApiSearch $dh
+	 * @param array $mapping
+	 * @return string html code
+	 */
 	private function buildIcons(IcingaApiSearch &$dh, array $mapping) {
 		$out = null;
 		
@@ -123,6 +198,12 @@ class IcingaTemplateDisplayServiceIcons extends IcingaTemplateDisplay {
 		return $out;
 	}
 	
+	/**
+	 * Evals some code and returns its value
+	 * or self::COND_ERROR if a error occures
+	 * @param string $code
+	 * @return mixed
+	 */
 	private function evalCode($code) {
 		$re = @eval($code);
 		if ($re === false) {
@@ -132,6 +213,12 @@ class IcingaTemplateDisplayServiceIcons extends IcingaTemplateDisplay {
 		return (bool)$re;
 	}
 	
+	/**
+	 * Returns the id value from the row
+	 * @param string $field_name
+	 * @param AgaviParameterHolder $row
+	 * @return mixed
+	 */
 	private function getObjectId($field_name, AgaviParameterHolder $row) {
 
 		if ($row->hasParameter($field_name)) {
diff --git a/doc/CHANGELOG b/doc/CHANGELOG
index 91a6c1f..82822a6 100755
--- a/doc/CHANGELOG
+++ b/doc/CHANGELOG
@@ -57,4 +57,13 @@
      * Added host- / service status filterund
      
    * 2010-01-12
-     * Host- / serviceinfo info icons
\ No newline at end of file
+     * Host- / serviceinfo info icons
+     * ExtJs update to version 3.1
+     
+   * 2010-01-13
+      * DB field for class length 80 (principal target)
+      * CVs different for host and service (schema changes)
+      * make fix for files (make)
+      * removed temp files
+      * changes status icon files (from icinga theme, smaller)
+      * added some more state (flapping, downtime)
\ No newline at end of file
diff --git a/pub/images/status/acknowledged.png b/pub/images/status/acknowledged.png
index fefc2d5..4a53541 100644
Binary files a/pub/images/status/acknowledged.png and b/pub/images/status/acknowledged.png differ
diff --git a/pub/images/status/disabled.png b/pub/images/status/disabled.png
new file mode 100644
index 0000000..6d3e6cd
Binary files /dev/null and b/pub/images/status/disabled.png differ
diff --git a/pub/images/status/downtime.png b/pub/images/status/downtime.png
new file mode 100644
index 0000000..4847cf9
Binary files /dev/null and b/pub/images/status/downtime.png differ
diff --git a/pub/images/status/flapping.png b/pub/images/status/flapping.png
new file mode 100644
index 0000000..5ae4717
Binary files /dev/null and b/pub/images/status/flapping.png differ
diff --git a/pub/images/status/indowntime.png b/pub/images/status/indowntime.png
deleted file mode 100644
index 814f0ad..0000000
Binary files a/pub/images/status/indowntime.png and /dev/null differ
diff --git a/pub/images/status/ndisabled.png b/pub/images/status/ndisabled.png
index 5f10cd2..e0f31e0 100644
Binary files a/pub/images/status/ndisabled.png and b/pub/images/status/ndisabled.png differ
diff --git a/pub/images/status/passive.png b/pub/images/status/passive.png
index a6e7ea1..804d5cc 100644
Binary files a/pub/images/status/passive.png and b/pub/images/status/passive.png differ





More information about the icinga-checkins mailing list