From 9f035dd61a066e9f90400475cca015e9fa697128 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 12 Jan 2016 12:27:21 +0100 Subject: [PATCH] Monitoring\Hook: fix service actions --- .../monitoring/library/Monitoring/Hook/HostActionsHook.php | 6 ++++++ .../library/Monitoring/Hook/ObjectActionsHook.php | 4 +++- .../library/Monitoring/Hook/ServiceActionsHook.php | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/library/Monitoring/Hook/HostActionsHook.php b/modules/monitoring/library/Monitoring/Hook/HostActionsHook.php index c81612851..527da9ac5 100644 --- a/modules/monitoring/library/Monitoring/Hook/HostActionsHook.php +++ b/modules/monitoring/library/Monitoring/Hook/HostActionsHook.php @@ -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); + } } diff --git a/modules/monitoring/library/Monitoring/Hook/ObjectActionsHook.php b/modules/monitoring/library/Monitoring/Hook/ObjectActionsHook.php index e6996886c..dcddbcb8c 100644 --- a/modules/monitoring/library/Monitoring/Hook/ObjectActionsHook.php +++ b/modules/monitoring/library/Monitoring/Hook/ObjectActionsHook.php @@ -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); } diff --git a/modules/monitoring/library/Monitoring/Hook/ServiceActionsHook.php b/modules/monitoring/library/Monitoring/Hook/ServiceActionsHook.php index e40299a7a..71aa65100 100644 --- a/modules/monitoring/library/Monitoring/Hook/ServiceActionsHook.php +++ b/modules/monitoring/library/Monitoring/Hook/ServiceActionsHook.php @@ -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); + } }