Add proper titles to all host/service tabs

refs #8458
This commit is contained in:
Johannes Meyer 2015-02-23 16:56:49 +01:00
parent 64a4dc67bc
commit f6cbc17ff7
2 changed files with 56 additions and 10 deletions

View File

@ -189,10 +189,12 @@ class Monitoring_ShowController extends Controller
return; return;
} }
if ($object->getType() === $object::TYPE_HOST) { if ($object->getType() === $object::TYPE_HOST) {
$isService = false;
$params = array( $params = array(
'host' => $object->getName() 'host' => $object->getName()
); );
} else { } else {
$isService = true;
$params = array( $params = array(
'host' => $object->getHost()->getName(), 'host' => $object->getHost()->getName(),
'service' => $object->getName() 'service' => $object->getName()
@ -202,17 +204,26 @@ class Monitoring_ShowController extends Controller
$tabs->add( $tabs->add(
'host', 'host',
array( 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', 'icon' => 'host',
'url' => 'monitoring/show/host', 'url' => 'monitoring/show/host',
'urlParams' => $params, 'urlParams' => $params,
) )
); );
if (isset($params['service'])) { if ($isService) {
$tabs->add( $tabs->add(
'service', 'service',
array( 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', 'icon' => 'service',
'url' => 'monitoring/show/service', 'url' => 'monitoring/show/service',
'urlParams' => $params, 'urlParams' => $params,
@ -222,7 +233,11 @@ class Monitoring_ShowController extends Controller
$tabs->add( $tabs->add(
'services', 'services',
array( 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', 'icon' => 'services',
'url' => 'monitoring/show/services', 'url' => 'monitoring/show/services',
'urlParams' => $params, 'urlParams' => $params,
@ -232,7 +247,15 @@ class Monitoring_ShowController extends Controller
$tabs->add( $tabs->add(
'history', 'history',
array( 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', 'icon' => 'rewind',
'url' => 'monitoring/show/history', 'url' => 'monitoring/show/history',
'urlParams' => $params, 'urlParams' => $params,

View File

@ -164,10 +164,12 @@ abstract class MonitoredObjectController extends Controller
$tabs = $this->getTabs(); $tabs = $this->getTabs();
$object = $this->object; $object = $this->object;
if ($object->getType() === $object::TYPE_HOST) { if ($object->getType() === $object::TYPE_HOST) {
$isService = false;
$params = array( $params = array(
'host' => $object->getName() 'host' => $object->getName()
); );
} else { } else {
$isService = true;
$params = array( $params = array(
'host' => $object->getHost()->getName(), 'host' => $object->getHost()->getName(),
'service' => $object->getName() 'service' => $object->getName()
@ -176,17 +178,26 @@ abstract class MonitoredObjectController extends Controller
$tabs->add( $tabs->add(
'host', 'host',
array( 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', 'icon' => 'host',
'url' => 'monitoring/host/show', 'url' => 'monitoring/host/show',
'urlParams' => $params 'urlParams' => $params
) )
); );
if (isset($params['service'])) { if ($isService) {
$tabs->add( $tabs->add(
'service', 'service',
array( 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', 'icon' => 'service',
'url' => 'monitoring/service/show', 'url' => 'monitoring/service/show',
'urlParams' => $params 'urlParams' => $params
@ -196,7 +207,11 @@ abstract class MonitoredObjectController extends Controller
$tabs->add( $tabs->add(
'services', 'services',
array( 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', 'icon' => 'services',
'url' => 'monitoring/show/services', 'url' => 'monitoring/show/services',
'urlParams' => $params 'urlParams' => $params
@ -206,7 +221,15 @@ abstract class MonitoredObjectController extends Controller
$tabs->add( $tabs->add(
'history', 'history',
array( 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', 'icon' => 'rewind',
'url' => 'monitoring/show/history', 'url' => 'monitoring/show/history',
'urlParams' => $params 'urlParams' => $params