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;
}
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,

View File

@ -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