mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-24 00:29:47 -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;
|
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 = '')
|
public function renderHtml($view, $prefix = '')
|
||||||
{
|
{
|
||||||
$id = $this->getId($prefix);
|
$id = $this->getId($prefix);
|
||||||
$state = strtolower($this->getStateName());
|
|
||||||
if ($this->isMissing()) $state = 'missing';
|
|
||||||
$handled = $this->isAcknowledged() || $this->isInDowntime();
|
$handled = $this->isAcknowledged() || $this->isInDowntime();
|
||||||
|
|
||||||
$html = sprintf(
|
$html = sprintf(
|
||||||
'<table class="bp %s%s%s%s" id="%s"><tbody><tr>',
|
'<table class="bp %s%s%s%s" id="%s"><tbody><tr>',
|
||||||
$state === 'ok' ? 'ok' : 'problem ' . $state,
|
implode(' ', $this->getStateClassNames()),
|
||||||
$handled ? ' handled' : '',
|
$handled ? ' handled' : '',
|
||||||
($this->hasChildren() ? ' operator ' : ' node '),
|
($this->hasChildren() ? ' operator ' : ' node '),
|
||||||
$this->getObjectClassName(),
|
$this->getObjectClassName(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue