Monitoring\Hook: fix service actions

This commit is contained in:
Thomas Gelf 2016-01-12 12:27:21 +01:00
parent 9885d74d24
commit 9f035dd61a
3 changed files with 15 additions and 1 deletions

View File

@ -4,6 +4,7 @@
namespace Icinga\Module\Monitoring\Hook;
use Icinga\Module\Monitoring\Object\Host;
use Icinga\Module\Monitoring\Object\MonitoredObject;
/**
* Base class for host action hooks
@ -43,4 +44,9 @@ abstract class HostActionsHook extends ObjectActionsHook
* @return array An array containing a list of host action links
*/
abstract public function getActionsForHost(Host $host);
public function getActionsForObject(MonitoredObject $object)
{
return $this->getActionsForHost($object);
}
}

View File

@ -18,7 +18,7 @@ abstract class ObjectActionsHook
*/
public function getNavigation(MonitoredObject $object)
{
$urls = $this->getActionsForHost($object);
$urls = $this->getActionsForObject($object);
if (is_array($urls)) {
$navigation = new Navigation();
foreach ($urls as $label => $url) {
@ -42,4 +42,6 @@ abstract class ObjectActionsHook
{
return empty($actions) ? new Navigation() : Navigation::fromArray($actions);
}
abstract function getActionsForObject(MonitoredObject $object);
}

View File

@ -4,6 +4,7 @@
namespace Icinga\Module\Monitoring\Hook;
use Icinga\Module\Monitoring\Object\Service;
use Icinga\Module\Monitoring\Object\MonitoredObject;
/**
* Base class for host action hooks
@ -43,4 +44,9 @@ abstract class ServiceActionsHook extends ObjectActionsHook
* @return array An array containing a list of service action links
*/
abstract public function getActionsForService(Service $service);
public function getActionsForObject(MonitoredObject $object)
{
return $this->getActionsForService($object);
}
}