monitoring: Fix ServiceController::getServiceActions() after changing hook usage

This commit is contained in:
Eric Lippmann 2016-01-12 08:58:32 +01:00
parent 66c4b9a3da
commit 9885d74d24
3 changed files with 10 additions and 12 deletions

View File

@ -3,8 +3,6 @@
namespace Icinga\Module\Monitoring\Controllers; namespace Icinga\Module\Monitoring\Controllers;
use Icinga\Web\Hook;
use Icinga\Web\Navigation\Navigation;
use Icinga\Module\Monitoring\Forms\Command\Object\AcknowledgeProblemCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\AcknowledgeProblemCommandForm;
use Icinga\Module\Monitoring\Forms\Command\Object\AddCommentCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\AddCommentCommandForm;
use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm;
@ -13,6 +11,8 @@ use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleHostDowntimeCommandFor
use Icinga\Module\Monitoring\Forms\Command\Object\SendCustomNotificationCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\SendCustomNotificationCommandForm;
use Icinga\Module\Monitoring\Object\Host; use Icinga\Module\Monitoring\Object\Host;
use Icinga\Module\Monitoring\Web\Controller\MonitoredObjectController; use Icinga\Module\Monitoring\Web\Controller\MonitoredObjectController;
use Icinga\Web\Hook;
use Icinga\Web\Navigation\Navigation;
class HostController extends MonitoredObjectController class HostController extends MonitoredObjectController
{ {
@ -40,7 +40,7 @@ class HostController extends MonitoredObjectController
/** /**
* Get host actions from hook * Get host actions from hook
* *
* @return array * @return Navigation
*/ */
protected function getHostActions() protected function getHostActions()
{ {

View File

@ -12,6 +12,7 @@ use Icinga\Module\Monitoring\Forms\Command\Object\SendCustomNotificationCommandF
use Icinga\Module\Monitoring\Object\Service; use Icinga\Module\Monitoring\Object\Service;
use Icinga\Module\Monitoring\Web\Controller\MonitoredObjectController; use Icinga\Module\Monitoring\Web\Controller\MonitoredObjectController;
use Icinga\Web\Hook; use Icinga\Web\Hook;
use Icinga\Web\Navigation\Navigation;
class ServiceController extends MonitoredObjectController class ServiceController extends MonitoredObjectController
{ {
@ -42,19 +43,16 @@ class ServiceController extends MonitoredObjectController
/** /**
* Get service actions from hook * Get service actions from hook
* *
* @return array * @return Navigation
*/ */
protected function getServiceActions() protected function getServiceActions()
{ {
$urls = array(); $navigation = new Navigation();
foreach (Hook::all('Monitoring\\ServiceActions') as $hook) { foreach (Hook::all('Monitoring\\ServiceActions') as $hook) {
foreach ($hook->getActionsForService($this->object) as $id => $url) { $navigation->merge($hook->getNavigation($this->object));
$urls[$id] = $url;
}
} }
return $urls; return $navigation;
} }
/** /**