icingaweb2-module-businessp.../library/Businessprocess/ServiceNode.php

50 lines
1.3 KiB
PHP
Raw Normal View History

<?php
2014-11-30 09:56:58 -05:00
namespace Icinga\Module\Businessprocess;
class ServiceNode extends Node
{
protected $hostname;
protected $service;
public function __construct(BusinessProcess $bp, $object)
{
$this->name = $object->hostname . ';' . $object->service;
$this->hostname = $object->hostname;
$this->service = $object->service;
$this->bp = $bp;
$this->setState($object->state);
}
2014-11-30 05:30:59 -05:00
public function renderLink($view)
{
if ($this->bp->isSimulationMode()) {
2014-11-30 09:56:58 -05:00
return $view->qlink($this->getAlias(), 'businessprocess/node/simulate', array(
'node' => $this->name,
'processName' => $this->bp->getName()
2014-11-30 05:30:59 -05:00
));
} else {
return $view->qlink($this->getAlias(), 'monitoring/service/show', array(
2014-11-30 05:30:59 -05:00
'host' => $this->getHostname(),
'service' => $this->getServiceDescription(),
'processName' => $this->bp->getName()
2014-11-30 05:30:59 -05:00
));
}
}
public function getHostname()
{
return $this->hostname;
}
public function getServiceDescription()
{
return $this->service;
}
public function getAlias()
{
return $this->hostname . ': ' . $this->service;
}
}