From f6cbc17ff7c35d7ffb5f36ed709717830c6e207d Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 23 Feb 2015 16:56:49 +0100 Subject: [PATCH] Add proper titles to all host/service tabs refs #8458 --- .../controllers/ShowController.php | 33 ++++++++++++++++--- .../Controller/MonitoredObjectController.php | 33 ++++++++++++++++--- 2 files changed, 56 insertions(+), 10 deletions(-) diff --git a/modules/monitoring/application/controllers/ShowController.php b/modules/monitoring/application/controllers/ShowController.php index 033b11b1d..4550b20ae 100644 --- a/modules/monitoring/application/controllers/ShowController.php +++ b/modules/monitoring/application/controllers/ShowController.php @@ -189,10 +189,12 @@ class Monitoring_ShowController extends Controller return; } if ($object->getType() === $object::TYPE_HOST) { + $isService = false; $params = array( 'host' => $object->getName() ); } else { + $isService = true; $params = array( 'host' => $object->getHost()->getName(), 'service' => $object->getName() @@ -202,17 +204,26 @@ class Monitoring_ShowController extends Controller $tabs->add( 'host', array( - 'title' => $this->translate('Host'), + 'title' => sprintf( + $this->translate('Show detailed information for host %s'), + $isService ? $object->getHost()->getName() : $object->getName() + ), + 'label' => $this->translate('Host'), 'icon' => 'host', 'url' => 'monitoring/show/host', 'urlParams' => $params, ) ); - if (isset($params['service'])) { + if ($isService) { $tabs->add( 'service', array( - 'title' => $this->translate('Service'), + 'title' => sprintf( + $this->translate('Show detailed information for service %s on host %s'), + $object->getName(), + $object->getHost()->getName() + ), + 'label' => $this->translate('Service'), 'icon' => 'service', 'url' => 'monitoring/show/service', 'urlParams' => $params, @@ -222,7 +233,11 @@ class Monitoring_ShowController extends Controller $tabs->add( 'services', array( - 'title' => $this->translate('Services'), + 'title' => sprintf( + $this->translate('List all services on host %s'), + $isService ? $object->getHost()->getName() : $object->getName() + ), + 'label' => $this->translate('Services'), 'icon' => 'services', 'url' => 'monitoring/show/services', 'urlParams' => $params, @@ -232,7 +247,15 @@ class Monitoring_ShowController extends Controller $tabs->add( 'history', array( - 'title' => $this->translate('History'), + 'title' => $isService + ? sprintf( + $this->translate('Show all event records of service %s on host %s'), + $object->getName(), + $object->getHost()->getName() + ) + : sprintf($this->translate('Show all event records of host %s'), $object->getName()) + , + 'label' => $this->translate('History'), 'icon' => 'rewind', 'url' => 'monitoring/show/history', 'urlParams' => $params, diff --git a/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php b/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php index 566c569a3..f553c12f3 100644 --- a/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php +++ b/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php @@ -164,10 +164,12 @@ abstract class MonitoredObjectController extends Controller $tabs = $this->getTabs(); $object = $this->object; if ($object->getType() === $object::TYPE_HOST) { + $isService = false; $params = array( 'host' => $object->getName() ); } else { + $isService = true; $params = array( 'host' => $object->getHost()->getName(), 'service' => $object->getName() @@ -176,17 +178,26 @@ abstract class MonitoredObjectController extends Controller $tabs->add( 'host', array( - 'title' => $this->translate('Host'), + 'title' => sprintf( + $this->translate('Show detailed information for host %s'), + $isService ? $object->getHost()->getName() : $object->getName() + ), + 'label' => $this->translate('Host'), 'icon' => 'host', 'url' => 'monitoring/host/show', 'urlParams' => $params ) ); - if (isset($params['service'])) { + if ($isService) { $tabs->add( 'service', array( - 'title' => $this->translate('Service'), + 'title' => sprintf( + $this->translate('Show detailed information for service %s on host %s'), + $object->getName(), + $object->getHost()->getName() + ), + 'label' => $this->translate('Service'), 'icon' => 'service', 'url' => 'monitoring/service/show', 'urlParams' => $params @@ -196,7 +207,11 @@ abstract class MonitoredObjectController extends Controller $tabs->add( 'services', array( - 'title' => $this->translate('Services'), + 'title' => sprintf( + $this->translate('List all services on host %s'), + $isService ? $object->getHost()->getName() : $object->getName() + ), + 'label' => $this->translate('Services'), 'icon' => 'services', 'url' => 'monitoring/show/services', 'urlParams' => $params @@ -206,7 +221,15 @@ abstract class MonitoredObjectController extends Controller $tabs->add( 'history', array( - 'title' => $this->translate('History'), + 'title' => $isService + ? sprintf( + $this->translate('Show all event records of service %s on host %s'), + $object->getName(), + $object->getHost()->getName() + ) + : sprintf($this->translate('Show all event records of host %s'), $object->getName()) + , + 'label' => $this->translate('History'), 'icon' => 'rewind', 'url' => 'monitoring/show/history', 'urlParams' => $params