Require `host_name' instead of `host' to show or list particular objects

`host' 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:25:29 +02:00
parent 13596ec70f
commit b93d18a0fc
13 changed files with 27 additions and 27 deletions

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<a href="/monitoring/host/show?host=localhost"
<a href="/monitoring/host/show?host_name=localhost"
title="Show detailed information about the host localhost"
aria-label="Show detailed information about the host localhost">localhost</a>
</body>

View File

@ -26,7 +26,7 @@ class Monitoring_HostController extends MonitoredObjectController
*/
public function init()
{
$host = new Host($this->backend, $this->params->get('host'));
$host = new Host($this->backend, $this->params->get('host_name'));
$this->applyRestriction('monitoring/hosts/filter', $host);

View File

@ -25,7 +25,7 @@ class Monitoring_ServiceController extends MonitoredObjectController
*/
public function init()
{
$service = new Service($this->backend, $this->params->get('host'), $this->params->get('service'));
$service = new Service($this->backend, $this->params->get('host_name'), $this->params->get('service'));
$this->applyRestriction('monitoring/services/filter', $service);

View File

@ -188,12 +188,12 @@ class Monitoring_ShowController extends Controller
if ($object->getType() === $object::TYPE_HOST) {
$isService = false;
$params = array(
'host' => $object->getName()
'host_name' => $object->getName()
);
} else {
$isService = true;
$params = array(
'host' => $object->getHost()->getName(),
'host_name' => $object->getHost()->getName(),
'service' => $object->getName()
);
}
@ -207,7 +207,7 @@ class Monitoring_ShowController extends Controller
),
'label' => $this->translate('Host'),
'icon' => 'host',
'url' => 'monitoring/show/host',
'url' => 'monitoring/host/show',
'urlParams' => $params,
)
);

View File

@ -33,7 +33,7 @@ class Zend_View_Helper_Link extends Zend_View_Helper_Abstract
return $this->view->qlink(
$linkText,
'monitoring/host/show',
array('host' => $host),
array('host_name' => $host),
array('title' => sprintf($this->view->translate('Show detailed information for host %s'), $host))
);
}
@ -55,7 +55,7 @@ class Zend_View_Helper_Link extends Zend_View_Helper_Abstract
$this->view->qlink(
$serviceLinkText,
'monitoring/service/show',
array('host' => $host, 'service' => $service),
array('host_name' => $host, 'service' => $service),
array('title' => sprintf(
$this->view->translate('Show detailed information for service %s on host %s'),
$service,

View File

@ -65,7 +65,7 @@ class Zend_View_Helper_PluginOutput extends Zend_View_Helper_Abstract
parse_str($m[1], $params);
if (isset($params['host'])) {
$tag->setAttribute('href', $this->view->baseUrl(
'/monitoring/host/show?host=' . urlencode($params['host']
'/monitoring/host/show?host_name=' . urlencode($params['host']
)));
}
} else {

View File

@ -42,7 +42,7 @@ if ($hosts->count() === 0) {
<?php foreach($hosts as $host):
$hostStateName = Host::getStateText($host->host_state);
$hostLink = $this->href('monitoring/host/show', array('host' => $host->host_name));
$hostLink = $this->href('monitoring/host/show', array('host_name' => $host->host_name));
$icons = array();
if (! $host->host_handled && $host->host_state > 0){
@ -112,7 +112,7 @@ if ($hosts->count() === 0) {
),
'monitoring/show/services',
array(
'host' => $host->host_name,
'host_name' => $host->host_name,
'service_problem' => 1,
'service_handled' => 0
),

View File

@ -68,7 +68,7 @@ foreach ($serviceDescriptions as $service_description): ?>
<?= $this->qlink(
$host_name,
'monitoring/show/services?' . $serviceFilter,
array('host' => $host_name),
array('host_name' => $host_name),
array('title' => sprintf($this->translate('List all reported services on host %s'), $host_name))
); ?>
</th>
@ -80,9 +80,9 @@ foreach ($serviceDescriptions as $service_description): ?>
</span>
<?= $this->qlink(
'',
'monitoring/show/service',
'monitoring/service/show',
array(
'host' => $service->host_name,
'host_name' => $service->host_name,
'service' => $service->service_description
),
array(

View File

@ -42,14 +42,14 @@ foreach ($services as $service):
$serviceLink = $this->href(
'monitoring/service/show',
array(
'host' => $service->host_name,
'service' => $service->service_description
'host_name' => $service->host_name,
'service' => $service->service_description
)
);
$hostLink = $this->href(
'monitoring/show/host',
'monitoring/host/show',
array(
'host' => $service->host_name,
'host_name' => $service->host_name,
)
);
$serviceStateName = Service::getStateText($service->service_state);

View File

@ -3,7 +3,7 @@
use Icinga\Web\Url;
use Icinga\Module\Monitoring\Object\Service;
$selfUrl = Url::fromPath('monitoring/show/services', array('host' => $object->host_name));
$selfUrl = Url::fromPath('monitoring/show/services', array('host_name' => $object->host_name));
$currentUrl = Url::fromRequest()->without('limit')->getRelativeUrl();
?><div class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : ''; ?>>
<?php if ($object->stats->services_total): ?>

View File

@ -144,8 +144,8 @@ $output = $this->tickets ? preg_replace_callback(
$event->service_display_name,
'monitoring/show/service',
array(
'host' => $event->host_name,
'service' => $event->service_description
'host_name' => $event->host_name,
'service' => $event->service_description
),
array('title' => sprintf(
$this->translate('Show detailed information for service %s on host %s'),

View File

@ -556,10 +556,10 @@ abstract class MonitoredObject implements Filterable
*/
public static function fromParams(UrlParams $params)
{
if ($params->has('service') && $params->has('host')) {
return new Service(MonitoringBackend::instance(), $params->get('host'), $params->get('service'));
} elseif ($params->has('host')) {
return new Host(MonitoringBackend::instance(), $params->get('host'));
if ($params->has('service') && $params->has('host_name')) {
return new Service(MonitoringBackend::instance(), $params->get('host_name'), $params->get('service'));
} elseif ($params->has('host_name')) {
return new Host(MonitoringBackend::instance(), $params->get('host_name'));
}
return null;
}

View File

@ -167,12 +167,12 @@ abstract class MonitoredObjectController extends Controller
if ($object->getType() === $object::TYPE_HOST) {
$isService = false;
$params = array(
'host' => $object->getName()
'host_name' => $object->getName()
);
} else {
$isService = true;
$params = array(
'host' => $object->getHost()->getName(),
'host_name' => $object->getHost()->getName(),
'service' => $object->getName()
);
}