[icinga-checkins] icinga.org: icingaweb2-module-director/master: inspect: show tabs, allow for all hosts
git at icinga.org
git at icinga.org
Tue Nov 8 16:40:20 CET 2016
Module: icingaweb2-module-director
Branch: master
Commit: 8ce4cf49c022d42d0b6b02bfec2ec585fe2cebd6
URL: https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=8ce4cf49c022d42d0b6b02bfec2ec585fe2cebd6
Author: Thomas Gelf <thomas at gelf.net>
Date: Tue Nov 8 16:13:01 2016 +0100
inspect: show tabs, allow for all hosts
fixes #13073
---
application/controllers/InspectController.php | 2 ++
.../ProvidedHook/Monitoring/HostActions.php | 33 +++++++++-----------
2 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/application/controllers/InspectController.php b/application/controllers/InspectController.php
index 99f6956..5ef958b 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 3ae3538..65d9e70 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();
+ return $actions;
}
-
- if (IcingaHost::exists($host->host_name, $db)) {
- $actions = array(
- 'Modify' => Url::fromPath(
- 'director/host/edit',
- array('name' => $host->host_name)
- )
+ $hostname = $host->host_name;
+ if (Util::hasPermission('director/inspect')) {
+ $actions['Inspect'] = Url::fromPath(
+ 'director/inspect/object',
+ array('type' => 'host', 'plural' => 'hosts', 'name' => $hostname)
);
+ }
- 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();
+ if (IcingaHost::exists($hostname, $db)) {
+ $actions['Modify'] = Url::fromPath(
+ 'director/host/edit',
+ array('name' => $hostname)
+ );
}
+
+ return $actions;
}
protected function db()
More information about the icinga-checkins
mailing list