mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-20 23:00:16 -05:00
Node: move logic to new getStateClassNames() method
This commit is contained in:
parent
64bab3f8da
commit
472e31e55e
1 changed files with 13 additions and 3 deletions
|
|
@ -335,16 +335,26 @@ abstract class Node
|
|||
return $this->className;
|
||||
}
|
||||
|
||||
protected function getStateClassNames()
|
||||
{
|
||||
$state = strtolower($this->getStateName());
|
||||
if ($this->isMissing()) {
|
||||
return array('missing');
|
||||
} elseif ($state === 'ok') {
|
||||
return array('ok');
|
||||
} else {
|
||||
return array('problem', $state);
|
||||
}
|
||||
}
|
||||
|
||||
public function renderHtml($view, $prefix = '')
|
||||
{
|
||||
$id = $this->getId($prefix);
|
||||
$state = strtolower($this->getStateName());
|
||||
if ($this->isMissing()) $state = 'missing';
|
||||
$handled = $this->isAcknowledged() || $this->isInDowntime();
|
||||
|
||||
$html = sprintf(
|
||||
'<table class="bp %s%s%s%s" id="%s"><tbody><tr>',
|
||||
$state === 'ok' ? 'ok' : 'problem ' . $state,
|
||||
implode(' ', $this->getStateClassNames()),
|
||||
$handled ? ' handled' : '',
|
||||
($this->hasChildren() ? ' operator ' : ' node '),
|
||||
$this->getObjectClassName(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue