mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 13:54:26 +02:00
monitoring: Adjust custom navigation renderer for backend availability checks
refs #5600
This commit is contained in:
parent
881880f18f
commit
a96bead01b
@ -221,7 +221,7 @@ $section = $this->menuSection($this->translate('System'));
|
|||||||
$section->add($this->translate('Monitoring Health'), array(
|
$section->add($this->translate('Monitoring Health'), array(
|
||||||
'url' => 'monitoring/process/info',
|
'url' => 'monitoring/process/info',
|
||||||
'priority' => 720,
|
'priority' => 720,
|
||||||
'renderer' => 'Icinga\Module\Monitoring\Web\Menu\BackendAvailabilityMenuItemRenderer'
|
'renderer' => 'BackendAvailabilityNavigationItemRenderer'
|
||||||
));
|
));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
||||||
|
|
||||||
namespace Icinga\Module\Monitoring\Web\Menu;
|
namespace Icinga\Module\Monitoring\Web\Navigation\Renderer;
|
||||||
|
|
||||||
use Icinga\Web\Menu;
|
use Exception;
|
||||||
use Icinga\Web\Menu\BadgeMenuItemRenderer;
|
use Icinga\Web\Navigation\Renderer\BadgeNavigationItemRenderer;
|
||||||
use Icinga\Module\Monitoring\Backend\MonitoringBackend;
|
use Icinga\Module\Monitoring\Backend\MonitoringBackend;
|
||||||
|
|
||||||
class BackendAvailabilityMenuItemRenderer extends BadgeMenuItemRenderer
|
class BackendAvailabilityNavigationItemRenderer extends BadgeNavigationItemRenderer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get whether or not the monitoring backend is currently running
|
* Get whether or not the monitoring backend is currently running
|
||||||
@ -43,10 +43,15 @@ class BackendAvailabilityMenuItemRenderer extends BadgeMenuItemRenderer
|
|||||||
*/
|
*/
|
||||||
public function getCount()
|
public function getCount()
|
||||||
{
|
{
|
||||||
if (! $this->isCurrentlyRunning()) {
|
try {
|
||||||
return 1;
|
if ($this->isCurrentlyRunning()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} catch (Exception $_) {
|
||||||
|
// pass
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user