monitoring: Fix ServiceController::getServiceActions() after changing hook usage
This commit is contained in:
parent
66c4b9a3da
commit
9885d74d24
|
@ -3,8 +3,6 @@
|
|||
|
||||
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\AddCommentCommandForm;
|
||||
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\Object\Host;
|
||||
use Icinga\Module\Monitoring\Web\Controller\MonitoredObjectController;
|
||||
use Icinga\Web\Hook;
|
||||
use Icinga\Web\Navigation\Navigation;
|
||||
|
||||
class HostController extends MonitoredObjectController
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ class HostController extends MonitoredObjectController
|
|||
/**
|
||||
* Get host actions from hook
|
||||
*
|
||||
* @return array
|
||||
* @return Navigation
|
||||
*/
|
||||
protected function getHostActions()
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@ use Icinga\Module\Monitoring\Forms\Command\Object\SendCustomNotificationCommandF
|
|||
use Icinga\Module\Monitoring\Object\Service;
|
||||
use Icinga\Module\Monitoring\Web\Controller\MonitoredObjectController;
|
||||
use Icinga\Web\Hook;
|
||||
use Icinga\Web\Navigation\Navigation;
|
||||
|
||||
class ServiceController extends MonitoredObjectController
|
||||
{
|
||||
|
@ -42,19 +43,16 @@ class ServiceController extends MonitoredObjectController
|
|||
/**
|
||||
* Get service actions from hook
|
||||
*
|
||||
* @return array
|
||||
* @return Navigation
|
||||
*/
|
||||
protected function getServiceActions()
|
||||
{
|
||||
$urls = array();
|
||||
|
||||
$navigation = new Navigation();
|
||||
foreach (Hook::all('Monitoring\\ServiceActions') as $hook) {
|
||||
foreach ($hook->getActionsForService($this->object) as $id => $url) {
|
||||
$urls[$id] = $url;
|
||||
}
|
||||
$navigation->merge($hook->getNavigation($this->object));
|
||||
}
|
||||
|
||||
return $urls;
|
||||
return $navigation;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,7 +32,7 @@ if (isset($this->actions)) {
|
|||
$navigation->merge($this->actions);
|
||||
}
|
||||
|
||||
if ($navigation->isEmpty() || !$navigation->hasRenderableItems()) {
|
||||
if ($navigation->isEmpty() || ! $navigation->hasRenderableItems()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -40,4 +40,4 @@ if ($navigation->isEmpty() || !$navigation->hasRenderableItems()) {
|
|||
<tr>
|
||||
<th><?= $this->translate('Actions'); ?></th>
|
||||
<?= $navigation->getRenderer()->setElementTag('td')->setCssClass('actions'); ?>
|
||||
</tr>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in New Issue