mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-20 23:00:16 -05:00
Node: remove implementation-specific logic
This commit is contained in:
parent
a97073334c
commit
64bab3f8da
5 changed files with 17 additions and 14 deletions
|
|
@ -21,6 +21,8 @@ class BpNode extends Node
|
|||
|
||||
);
|
||||
|
||||
protected $className = 'process';
|
||||
|
||||
public function __construct(
|
||||
BusinessProcess $bp,
|
||||
$object
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ class HostNode extends Node
|
|||
{
|
||||
protected $hostname;
|
||||
|
||||
protected $className = 'host';
|
||||
|
||||
public function __construct(BusinessProcess $bp, $object)
|
||||
{
|
||||
$this->name = $object->hostname . ';Hoststatus';
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ class ImportedNode extends Node
|
|||
|
||||
protected $importedNode;
|
||||
|
||||
protected $className = 'subtree';
|
||||
|
||||
public function __construct(BusinessProcess $bp, $object)
|
||||
{
|
||||
$this->name = $object->name;
|
||||
|
|
|
|||
|
|
@ -93,6 +93,8 @@ abstract class Node
|
|||
|
||||
protected $missing = false;
|
||||
|
||||
protected $className = 'unknown';
|
||||
|
||||
protected static $state_names = array(
|
||||
'OK',
|
||||
'WARNING',
|
||||
|
|
@ -327,32 +329,25 @@ abstract class Node
|
|||
{
|
||||
return md5($prefix . (string) $this);
|
||||
}
|
||||
|
||||
|
||||
protected function getObjectClassName()
|
||||
{
|
||||
return $this->className;
|
||||
}
|
||||
|
||||
public function renderHtml($view, $prefix = '')
|
||||
{
|
||||
$id = $this->getId($prefix);
|
||||
$state = strtolower($this->getStateName());
|
||||
if ($this->isMissing()) $state = 'missing';
|
||||
$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(
|
||||
'<table class="bp %s%s%s%s" id="%s"><tbody><tr>',
|
||||
$state === 'ok' ? 'ok' : 'problem ' . $state,
|
||||
$handled ? ' handled' : '',
|
||||
($this->hasChildren() ? ' operator ' : ' node '),
|
||||
$typeClass,
|
||||
$this->getObjectClassName(),
|
||||
$id
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ class ServiceNode extends Node
|
|||
|
||||
protected $service;
|
||||
|
||||
protected $className = 'service';
|
||||
|
||||
public function __construct(BusinessProcess $bp, $object)
|
||||
{
|
||||
$this->name = $object->hostname . ';' . $object->service;
|
||||
|
|
|
|||
Loading…
Reference in a new issue