mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
Capitalize monitoring properties, e.g. Current Attempt
This commit is contained in:
parent
cabe2ccbee
commit
c47778f10e
@ -46,16 +46,16 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $keys = array(
|
private static $keys = array(
|
||||||
'buildAttempt' => 'Current attempt',
|
'buildAttempt' => 'Current Attempt',
|
||||||
'last_check' => 'Last check time',
|
'last_check' => 'Last Check Time',
|
||||||
'buildCheckType' => 'Check type',
|
'buildCheckType' => 'Check Type',
|
||||||
'buildLatency' => 'Check latency / duration',
|
'buildLatency' => 'Check Latency / Duration',
|
||||||
'buildNextCheck' => 'Next scheduled active check',
|
'buildNextCheck' => 'Next Scheduled Active Check',
|
||||||
'buildLastStateChange' => 'Last state change',
|
'buildLastStateChange' => 'Last State Change',
|
||||||
'buildLastNotification' => 'Last notification',
|
'buildLastNotification' => 'Last Notification',
|
||||||
'buildFlapping' => 'Is this %s flapping?',
|
'buildFlapping' => 'Is This %s Flapping?',
|
||||||
'buildScheduledDowntime' => 'In scheduled downtime?',
|
'buildScheduledDowntime' => 'In Scheduled Downtime?',
|
||||||
'status_update_time' => 'Last update'
|
'status_update_time' => 'Last Update'
|
||||||
);
|
);
|
||||||
|
|
||||||
private static $notificationReasons = array(
|
private static $notificationReasons = array(
|
||||||
@ -256,7 +256,7 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
|
|||||||
$out = array();
|
$out = array();
|
||||||
|
|
||||||
foreach (self::$keys as $property => $label) {
|
foreach (self::$keys as $property => $label) {
|
||||||
$label = sprintf($label, $type);
|
$label = sprintf($label, ucfirst($type));
|
||||||
if (is_callable(array(&$this, $property))) {
|
if (is_callable(array(&$this, $property))) {
|
||||||
$out[$label] = $this->$property($object);
|
$out[$label] = $this->$property($object);
|
||||||
} elseif (isset($object->{$property})) {
|
} elseif (isset($object->{$property})) {
|
||||||
|
@ -6,6 +6,9 @@ require_once 'Zend/View/Helper/Abstract.php';
|
|||||||
require_once 'Zend/View.php';
|
require_once 'Zend/View.php';
|
||||||
require_once __DIR__. '/../../../../../application/views/helpers/MonitoringProperties.php';
|
require_once __DIR__. '/../../../../../application/views/helpers/MonitoringProperties.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @TODO(el): This test is subject to bug #4679 and
|
||||||
|
*/
|
||||||
class HostStruct4Properties extends \stdClass
|
class HostStruct4Properties extends \stdClass
|
||||||
{
|
{
|
||||||
public $host_name = 'localhost';
|
public $host_name = 'localhost';
|
||||||
@ -70,8 +73,8 @@ class MonitoringPropertiesTest extends \PHPUnit_Framework_TestCase
|
|||||||
$items = $propertyHelper->monitoringProperties($host);
|
$items = $propertyHelper->monitoringProperties($host);
|
||||||
|
|
||||||
$this->assertCount(10, $items);
|
$this->assertCount(10, $items);
|
||||||
$this->assertEquals('5/10 (HARD state)', $items['Current attempt']);
|
$this->assertEquals('5/10 (HARD state)', $items['Current Attempt']);
|
||||||
$this->assertEquals('2013-07-08 10:10:10', $items['Last update']);
|
$this->assertEquals('2013-07-08 10:10:10', $items['Last Update']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testOutput2()
|
public function testOutput2()
|
||||||
@ -89,16 +92,16 @@ class MonitoringPropertiesTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertCount(10, $items);
|
$this->assertCount(10, $items);
|
||||||
|
|
||||||
$test = array(
|
$test = array(
|
||||||
'Current attempt' => "5/10 (HARD state)",
|
'Current Attempt' => "5/10 (HARD state)",
|
||||||
'Last check time' => "2013-07-04 11:24:42",
|
'Last Check Time' => "2013-07-04 11:24:42",
|
||||||
'Check type' => "ACTIVE",
|
'Check Type' => "ACTIVE",
|
||||||
'Check latency / duration' => "0.1204 / 0.0000 seconds",
|
'Check Latency / Duration' => "0.1204 / 0.0000 seconds",
|
||||||
'Next scheduled active check' => "2013-07-04 11:29:43",
|
'Next Scheduled Active Check' => "2013-07-04 11:29:43",
|
||||||
'Last state change' => "2013-07-04 11:24:43",
|
'Last State Change' => "2013-07-04 11:24:43",
|
||||||
'Last notification' => "N/A (notification 0)",
|
'Last Notification' => "N/A (notification 0)",
|
||||||
'Is this host flapping?' => "YES (12.37% state change)",
|
'Is This Host Flapping?' => "YES (12.37% state change)",
|
||||||
'In scheduled downtime?' => "YES",
|
'In Scheduled Downtime?' => "YES",
|
||||||
'Last update' => "2013-07-08 10:10:10",
|
'Last Update' => "2013-07-08 10:10:10",
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals($test, $items);
|
$this->assertEquals($test, $items);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user