From 09ab6019423e858d222a570c65f247bfcb09e62f Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 8 Apr 2015 16:49:52 +0200 Subject: [PATCH] Require `service_description' instead of `service' to show a particular service `service' implies that it is possible to provide case-less identifiers which is *not* possible. refs #8613 --- .../application/controllers/ServiceController.php | 6 +++++- .../application/controllers/ShowController.php | 6 +++--- modules/monitoring/application/views/helpers/Link.php | 2 +- .../application/views/scripts/list/servicegrid.phtml | 4 ++-- .../application/views/scripts/list/services.phtml | 4 ++-- .../application/views/scripts/show/history.phtml | 6 +++--- .../library/Monitoring/Object/MonitoredObject.php | 9 ++++++--- .../Web/Controller/MonitoredObjectController.php | 4 ++-- 8 files changed, 24 insertions(+), 17 deletions(-) diff --git a/modules/monitoring/application/controllers/ServiceController.php b/modules/monitoring/application/controllers/ServiceController.php index 4f9bdeb1a..86579343f 100644 --- a/modules/monitoring/application/controllers/ServiceController.php +++ b/modules/monitoring/application/controllers/ServiceController.php @@ -25,7 +25,11 @@ class Monitoring_ServiceController extends MonitoredObjectController */ public function init() { - $service = new Service($this->backend, $this->params->get('host_name'), $this->params->get('service')); + $service = new Service( + $this->backend, + $this->params->get('host_name'), + $this->params->get('service_description') + ); $this->applyRestriction('monitoring/services/filter', $service); diff --git a/modules/monitoring/application/controllers/ShowController.php b/modules/monitoring/application/controllers/ShowController.php index 475e80b4f..b5ffc0535 100644 --- a/modules/monitoring/application/controllers/ShowController.php +++ b/modules/monitoring/application/controllers/ShowController.php @@ -193,8 +193,8 @@ class Monitoring_ShowController extends Controller } else { $isService = true; $params = array( - 'host_name' => $object->getHost()->getName(), - 'service' => $object->getName() + 'host_name' => $object->getHost()->getName(), + 'service_description' => $object->getName() ); } $tabs = $this->getTabs(); @@ -222,7 +222,7 @@ class Monitoring_ShowController extends Controller ), 'label' => $this->translate('Service'), 'icon' => 'service', - 'url' => 'monitoring/show/service', + 'url' => 'monitoring/service/show', 'urlParams' => $params, ) ); diff --git a/modules/monitoring/application/views/helpers/Link.php b/modules/monitoring/application/views/helpers/Link.php index 454d37682..7f1324573 100644 --- a/modules/monitoring/application/views/helpers/Link.php +++ b/modules/monitoring/application/views/helpers/Link.php @@ -55,7 +55,7 @@ class Zend_View_Helper_Link extends Zend_View_Helper_Abstract $this->view->qlink( $serviceLinkText, 'monitoring/service/show', - array('host_name' => $host, 'service' => $service), + array('host_name' => $host, 'service_description' => $service), array('title' => sprintf( $this->view->translate('Show detailed information for service %s on host %s'), $service, diff --git a/modules/monitoring/application/views/scripts/list/servicegrid.phtml b/modules/monitoring/application/views/scripts/list/servicegrid.phtml index 9a37a52c5..a2e7502ea 100644 --- a/modules/monitoring/application/views/scripts/list/servicegrid.phtml +++ b/modules/monitoring/application/views/scripts/list/servicegrid.phtml @@ -82,8 +82,8 @@ foreach ($serviceDescriptions as $service_description): ?> '', 'monitoring/service/show', array( - 'host_name' => $service->host_name, - 'service' => $service->service_description + 'host_name' => $service->host_name, + 'service_description' => $service->service_description ), array( 'aria-describedby' => $service->host_name . '_' . $service->service_description . '_desc', diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index f3e76e9d0..3dd0b060d 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -42,8 +42,8 @@ foreach ($services as $service): $serviceLink = $this->href( 'monitoring/service/show', array( - 'host_name' => $service->host_name, - 'service' => $service->service_description + 'host_name' => $service->host_name, + 'service_description' => $service->service_description ) ); $hostLink = $this->href( diff --git a/modules/monitoring/application/views/scripts/show/history.phtml b/modules/monitoring/application/views/scripts/show/history.phtml index 53425b9d9..149eb0ecc 100644 --- a/modules/monitoring/application/views/scripts/show/history.phtml +++ b/modules/monitoring/application/views/scripts/show/history.phtml @@ -142,10 +142,10 @@ $output = $this->tickets ? preg_replace_callback( $this->translate('%s on %s', 'Service running on host'), $hostContext ? $this->qlink( $event->service_display_name, - 'monitoring/show/service', + 'monitoring/service/show', array( - 'host_name' => $event->host_name, - 'service' => $event->service_description + 'host_name' => $event->host_name, + 'service_description' => $event->service_description ), array('title' => sprintf( $this->translate('Show detailed information for service %s on host %s'), diff --git a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php index 9361843e3..621c25c75 100644 --- a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php +++ b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php @@ -556,11 +556,14 @@ abstract class MonitoredObject implements Filterable */ public static function fromParams(UrlParams $params) { - if ($params->has('service') && $params->has('host_name')) { - return new Service(MonitoringBackend::instance(), $params->get('host_name'), $params->get('service')); + if ($params->has('service_description') && $params->has('host_name')) { + return new Service( + MonitoringBackend::instance(), + $params->get('host_name'), + $params->get('service_description') + ); } elseif ($params->has('host_name')) { return new Host(MonitoringBackend::instance(), $params->get('host_name')); } - return null; } } diff --git a/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php b/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php index 3f71cb2c0..de0c3fbfe 100644 --- a/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php +++ b/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php @@ -172,8 +172,8 @@ abstract class MonitoredObjectController extends Controller } else { $isService = true; $params = array( - 'host_name' => $object->getHost()->getName(), - 'service' => $object->getName() + 'host_name' => $object->getHost()->getName(), + 'service_description' => $object->getName() ); } $tabs->add(