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

View File

@ -26,7 +26,7 @@ class Monitoring_HostController extends MonitoredObjectController
*/ */
public function init() 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); $this->applyRestriction('monitoring/hosts/filter', $host);

View File

@ -25,7 +25,7 @@ class Monitoring_ServiceController extends MonitoredObjectController
*/ */
public function init() 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); $this->applyRestriction('monitoring/services/filter', $service);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,14 +34,14 @@ if (count($services) === 0) {
$serviceLink = $this->href( $serviceLink = $this->href(
'monitoring/service/show', 'monitoring/service/show',
array( array(
'host_name' => $service->host_name, 'host' => $service->host_name,
'service' => $service->service_description 'service' => $service->service_description
) )
); );
$hostLink = $this->href( $hostLink = $this->href(
'monitoring/host/show', 'monitoring/show/host',
array( array(
'host_name' => $service->host_name, 'host' => $service->host_name,
) )
); );
$serviceStateName = Service::getStateText($service->service_state); $serviceStateName = Service::getStateText($service->service_state);

View File

@ -3,7 +3,7 @@
use Icinga\Web\Url; use Icinga\Web\Url;
use Icinga\Module\Monitoring\Object\Service; 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(); $currentUrl = Url::fromRequest()->without('limit')->getRelativeUrl();
?><div class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : ''; ?>> ?><div class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : ''; ?>>
<?php if ($object->stats->services_total): ?> <?php if ($object->stats->services_total): ?>

View File

@ -148,8 +148,8 @@ $output = $this->tickets ? preg_replace_callback(
$event->service_display_name, $event->service_display_name,
'monitoring/show/service', 'monitoring/show/service',
array( array(
'host_name' => $event->host_name, 'host' => $event->host_name,
'service' => $event->service_description 'service' => $event->service_description
), ),
array('title' => sprintf( array('title' => sprintf(
$this->translate('Show detailed information for service %s on host %s'), $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) public static function fromParams(UrlParams $params)
{ {
if ($params->has('service') && $params->has('host_name')) { if ($params->has('service') && $params->has('host')) {
return new Service(MonitoringBackend::instance(), $params->get('host_name'), $params->get('service')); return new Service(MonitoringBackend::instance(), $params->get('host'), $params->get('service'));
} elseif ($params->has('host_name')) { } elseif ($params->has('host')) {
return new Host(MonitoringBackend::instance(), $params->get('host_name')); return new Host(MonitoringBackend::instance(), $params->get('host'));
} }
return null; return null;
} }

View File

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