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
This commit is contained in:
Johannes Meyer 2015-04-08 16:49:52 +02:00
parent b93d18a0fc
commit 09ab601942
8 changed files with 24 additions and 17 deletions

View File

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

View File

@ -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,
)
);

View File

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

View File

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

View File

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

View File

@ -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'),

View File

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

View File

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