Host/ServiceNode: introduce common base class

This commit is contained in:
Thomas Gelf 2016-11-22 17:57:46 +01:00
parent 0b6cf208f0
commit 0251bc5edb
3 changed files with 27 additions and 3 deletions

View file

@ -4,7 +4,7 @@ namespace Icinga\Module\Businessprocess;
use Icinga\Web\Url;
class HostNode extends Node
class HostNode extends MonitoredNode
{
protected static $sortStateToStateMap = array(
4 => self::ICINGA_DOWN,

View file

@ -0,0 +1,24 @@
<?php
namespace Icinga\Module\Businessprocess;
use Icinga\Module\Businessprocess\Web\Component\Container;
use Icinga\Module\Businessprocess\Web\Component\Link;
abstract class MonitoredNode extends Node
{
protected function prepareActions(Container $actions)
{
$actions->add(
$url = Link::create(
$actions->view()->translate('Simulate a specific state'),
'businessprocess/process/show?addSimulation&unlocked',
array(
'config' => $this->bp->getName(),
'simulationNode' => $this->name
),
array('class' => 'icon-magic')
)
);
}
}

View file

@ -4,7 +4,7 @@ namespace Icinga\Module\Businessprocess;
use Icinga\Web\Url;
class ServiceNode extends Node
class ServiceNode extends MonitoredNode
{
protected $hostname;
@ -42,7 +42,7 @@ class ServiceNode extends Node
return $link;
}
protected function getActionIcons($view)
{
$icons = array();