mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-01-03 12:19:35 -05:00
RenderStateBadges: strip state name logic
This commit is contained in:
parent
0c633491d4
commit
4c9ed65a09
1 changed files with 4 additions and 12 deletions
|
|
@ -2,24 +2,16 @@
|
|||
|
||||
class Zend_View_Helper_RenderStateBadges extends Zend_View_Helper_Abstract
|
||||
{
|
||||
protected $stateNames = array(
|
||||
0 => 'OK',
|
||||
1 => 'WARNING',
|
||||
2 => 'CRITICAL',
|
||||
3 => 'UNKNOWN',
|
||||
99 => 'PENDING',
|
||||
);
|
||||
|
||||
public function renderStateBadges($summary)
|
||||
{
|
||||
$html = '';
|
||||
|
||||
foreach ($summary as $state => $cnt) {
|
||||
if ($cnt === 0) continue;
|
||||
if ($state === 0) continue;
|
||||
$stateName = $this->stateNames[$state];
|
||||
$html .= '<span class="badge badge-' . strtolower($stateName)
|
||||
. '" title="' . mt('monitoring', $stateName) . '">'
|
||||
if ($state === 'OK') continue;
|
||||
if ($state === 'UP') continue;
|
||||
$html .= '<span class="badge badge-' . strtolower($state)
|
||||
. '" title="' . mt('monitoring', $state) . '">'
|
||||
. $cnt . '</span>';
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue