From 45a0982bebb411ed8a202696965c1438b5948c2c Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Thu, 2 Apr 2015 16:44:05 +0200 Subject: [PATCH] Add new tab to switch between host and service multi-selection refs #8565 --- .../controllers/HostsController.php | 20 ++++++++++++++++++- .../controllers/ServicesController.php | 13 ++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/application/controllers/HostsController.php b/modules/monitoring/application/controllers/HostsController.php index 3c59f4643..632ca69ec 100644 --- a/modules/monitoring/application/controllers/HostsController.php +++ b/modules/monitoring/application/controllers/HostsController.php @@ -25,9 +25,14 @@ class Monitoring_HostsController extends Controller public function init() { + // Support switching from service-view using the host and service selection. The filter would error + // on any occurrence of a filter based on service. + $filterString = preg_replace('/(service=[^)&]*)/', '', (string)$this->params); + $hostList = new HostList($this->backend); - $hostList->setFilter(Filter::fromQueryString((string) $this->params)); + $hostList->setFilter(Filter::fromQueryString($filterString)); $this->hostList = $hostList; + $this->getTabs()->add( 'show', array( @@ -40,6 +45,19 @@ class Monitoring_HostsController extends Controller 'icon' => 'host' ) )->activate('show'); + + $this->getTabs()->add( + 'services', + array( + 'title' => sprintf( + $this->translate('Show summarized information for related services') + ), + 'label' => $this->translate('Services'), + 'url' => Url::fromPath('monitoring/services/show')->setParams(Url::fromRequest()->getParams()), + 'icon' => 'services' + ) + )->activate('show'); + $this->view->listAllLink = Url::fromRequest()->setPath('monitoring/list/hosts'); } diff --git a/modules/monitoring/application/controllers/ServicesController.php b/modules/monitoring/application/controllers/ServicesController.php index e7199ed26..91da11968 100644 --- a/modules/monitoring/application/controllers/ServicesController.php +++ b/modules/monitoring/application/controllers/ServicesController.php @@ -32,6 +32,19 @@ class Monitoring_ServicesController extends Controller $serviceList->setFilter(Filter::fromQueryString((string) $this->params->without('service_problem', 'service_handled'))); $this->serviceList = $serviceList; $this->view->listAllLink = Url::fromRequest()->setPath('monitoring/list/services'); + + $this->getTabs()->add( + 'hosts', + array( + 'title' => sprintf( + $this->translate('Show summarized information for hosts') + ), + 'label' => $this->translate('Hosts'), + 'url' => Url::fromPath('monitoring/hosts/show')->setParams(Url::fromRequest()->getParams()), + 'icon' => 'host' + ) + )->activate('show'); + $this->getTabs()->add( 'show', array(