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

This reverts commit b93d18a0fc.
This commit is contained in:
Johannes Meyer 2015-04-20 16:11:22 +02:00
parent 894457a1c1
commit f11ea04557
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_name=localhost"
<a href="/monitoring/host/show?host=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_name'));
$host = new Host($this->backend, $this->params->get('host'));
$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_name'), $this->params->get('service'));
$service = new Service($this->backend, $this->params->get('host'), $this->params->get('service'));
$this->applyRestriction('monitoring/services/filter', $service);

View File

@ -189,12 +189,12 @@ class Monitoring_ShowController extends Controller
if ($object->getType() === $object::TYPE_HOST) {
$isService = false;
$params = array(
'host_name' => $object->getName()
'host' => $object->getName()
);
} else {
$isService = true;
$params = array(
'host_name' => $object->getHost()->getName(),
'host' => $object->getHost()->getName(),
'service' => $object->getName()
);
}
@ -208,7 +208,7 @@ class Monitoring_ShowController extends Controller
),
'label' => $this->translate('Host'),
'icon' => 'host',
'url' => 'monitoring/host/show',
'url' => 'monitoring/show/host',
'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_name' => $host),
array('host' => $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_name' => $host, 'service' => $service),
array('host' => $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_name=' . urlencode($params['host']
'/monitoring/host/show?host=' . urlencode($params['host']
)));
}
} else {

View File

@ -34,7 +34,7 @@ if (count($hosts) === 0) {
<?php foreach($hosts as $host):
$hostStateName = Host::getStateText($host->host_state);
$hostLink = $this->href('monitoring/host/show', array('host_name' => $host->host_name));
$hostLink = $this->href('monitoring/host/show', array('host' => $host->host_name));
$icons = array();
if (! $host->host_handled && $host->host_state > 0){
@ -104,7 +104,7 @@ if (count($hosts) === 0) {
),
'monitoring/show/services',
array(
'host_name' => $host->host_name,
'host' => $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_name' => $host_name),
array('host' => $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/service/show',
'monitoring/show/service',
array(
'host_name' => $service->host_name,
'host' => $service->host_name,
'service' => $service->service_description
),
array(

View File

@ -34,14 +34,14 @@ if (count($services) === 0) {
$serviceLink = $this->href(
'monitoring/service/show',
array(
'host_name' => $service->host_name,
'service' => $service->service_description
'host' => $service->host_name,
'service' => $service->service_description
)
);
$hostLink = $this->href(
'monitoring/host/show',
'monitoring/show/host',
array(
'host_name' => $service->host_name,
'host' => $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_name' => $object->host_name));
$selfUrl = Url::fromPath('monitoring/show/services', array('host' => $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

@ -148,8 +148,8 @@ $output = $this->tickets ? preg_replace_callback(
$event->service_display_name,
'monitoring/show/service',
array(
'host_name' => $event->host_name,
'service' => $event->service_description
'host' => $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_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'));
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'));
}
return null;
}

View File

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