From 8ce4cf49c022d42d0b6b02bfec2ec585fe2cebd6 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 8 Nov 2016 16:13:01 +0100 Subject: [PATCH] inspect: show tabs, allow for all hosts fixes #13073 --- application/controllers/InspectController.php | 2 + .../ProvidedHook/Monitoring/HostActions.php | 37 +++++++++---------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/application/controllers/InspectController.php b/application/controllers/InspectController.php index 99f69561..5ef958b1 100644 --- a/application/controllers/InspectController.php +++ b/application/controllers/InspectController.php @@ -56,6 +56,7 @@ class InspectController extends ActionController public function typeAction() { $typeName = $this->params->get('name'); + $this->singleTab($this->translate('Inspect - object list')); $this->view->title = sprintf( $this->translate('Object type "%s"'), $typeName @@ -75,6 +76,7 @@ class InspectController extends ActionController public function objectAction() { + $this->singleTab($this->translate('Object Inspection')); $this->view->object = $this->api()->getObject( $this->params->get('name'), $this->params->get('plural') diff --git a/library/Director/ProvidedHook/Monitoring/HostActions.php b/library/Director/ProvidedHook/Monitoring/HostActions.php index 3ae3538f..65d9e70a 100644 --- a/library/Director/ProvidedHook/Monitoring/HostActions.php +++ b/library/Director/ProvidedHook/Monitoring/HostActions.php @@ -24,30 +24,27 @@ class HostActions extends HostActionsHook protected function getThem(Host $host) { + $actions = array(); $db = $this->db(); if (! $db) { - return array(); - } - - if (IcingaHost::exists($host->host_name, $db)) { - $actions = array( - 'Modify' => Url::fromPath( - 'director/host/edit', - array('name' => $host->host_name) - ) - ); - - if (Util::hasPermission('director/inspect')) { - $actions['Inspect'] = Url::fromPath( - 'director/inspect/object', - array('type' => 'host', 'plural' => 'hosts', 'name' => $host->host_name) - ); - } - return $actions; - } else { - return array(); } + $hostname = $host->host_name; + if (Util::hasPermission('director/inspect')) { + $actions['Inspect'] = Url::fromPath( + 'director/inspect/object', + array('type' => 'host', 'plural' => 'hosts', 'name' => $hostname) + ); + } + + if (IcingaHost::exists($hostname, $db)) { + $actions['Modify'] = Url::fromPath( + 'director/host/edit', + array('name' => $hostname) + ); + } + + return $actions; } protected function db()