mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-20 23:00:16 -05:00
Node: node type class detection
Not so nice, but works for now
This commit is contained in:
parent
99e03ef44f
commit
8f0b492b1b
1 changed files with 16 additions and 2 deletions
|
|
@ -267,11 +267,25 @@ abstract class Node
|
||||||
$state = strtolower($this->getStateName());
|
$state = strtolower($this->getStateName());
|
||||||
if ($this->isMissing()) $state = 'missing';
|
if ($this->isMissing()) $state = 'missing';
|
||||||
$handled = $this->isAcknowledged() || $this->isInDowntime();
|
$handled = $this->isAcknowledged() || $this->isInDowntime();
|
||||||
|
if ($this instanceof BpNode) {
|
||||||
|
$typeClass = 'process';
|
||||||
|
} elseif ($this instanceof HostNode) {
|
||||||
|
$typeClass = 'host';
|
||||||
|
} elseif ($this instanceof ServiceNode) {
|
||||||
|
$typeClass = 'service';
|
||||||
|
} elseif ($this instanceof ImportedNode) {
|
||||||
|
$typeClass = 'subtree';
|
||||||
|
} else {
|
||||||
|
// WTF?
|
||||||
|
var_dump($this); exit;
|
||||||
|
}
|
||||||
|
|
||||||
$html = sprintf(
|
$html = sprintf(
|
||||||
'<table class="bp %s%s%s" id="%s"><tbody><tr>',
|
'<table class="bp %s%s%s%s" id="%s"><tbody><tr>',
|
||||||
$state === 'ok' ? 'ok' : 'problem ' . $state,
|
$state === 'ok' ? 'ok' : 'problem ' . $state,
|
||||||
$handled ? ' handled' : '',
|
$handled ? ' handled' : '',
|
||||||
$this->hasChildren() ? ' operator process' : ' node service',
|
($this->hasChildren() ? ' operator ' : ' node '),
|
||||||
|
$typeClass,
|
||||||
$id
|
$id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue