From f11ea045577c25af14b3b961edd45cef33be59a9 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 20 Apr 2015 16:11:22 +0200 Subject: [PATCH] Revert "Require `host_name' instead of `host' to show or list particular objects" This reverts commit b93d18a0fc2507d360f122afdfb27317b7708fd4. --- doc/accessibility/link-labels.html | 2 +- .../monitoring/application/controllers/HostController.php | 2 +- .../application/controllers/ServiceController.php | 2 +- .../monitoring/application/controllers/ShowController.php | 6 +++--- modules/monitoring/application/views/helpers/Link.php | 4 ++-- .../monitoring/application/views/helpers/PluginOutput.php | 2 +- .../monitoring/application/views/scripts/list/hosts.phtml | 4 ++-- .../application/views/scripts/list/servicegrid.phtml | 6 +++--- .../application/views/scripts/list/services.phtml | 8 ++++---- .../views/scripts/partials/host/servicesummary.phtml | 2 +- .../application/views/scripts/show/history.phtml | 4 ++-- .../library/Monitoring/Object/MonitoredObject.php | 8 ++++---- .../Web/Controller/MonitoredObjectController.php | 4 ++-- 13 files changed, 27 insertions(+), 27 deletions(-) diff --git a/doc/accessibility/link-labels.html b/doc/accessibility/link-labels.html index a65b909de5..439adb85e3 100644 --- a/doc/accessibility/link-labels.html +++ b/doc/accessibility/link-labels.html @@ -8,7 +8,7 @@ - localhost diff --git a/modules/monitoring/application/controllers/HostController.php b/modules/monitoring/application/controllers/HostController.php index 5b336a26ba..11179c1fa6 100644 --- a/modules/monitoring/application/controllers/HostController.php +++ b/modules/monitoring/application/controllers/HostController.php @@ -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); diff --git a/modules/monitoring/application/controllers/ServiceController.php b/modules/monitoring/application/controllers/ServiceController.php index 4f9bdeb1a6..3dc98c3b88 100644 --- a/modules/monitoring/application/controllers/ServiceController.php +++ b/modules/monitoring/application/controllers/ServiceController.php @@ -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); diff --git a/modules/monitoring/application/controllers/ShowController.php b/modules/monitoring/application/controllers/ShowController.php index 13b55da7dd..c1522d2a1f 100644 --- a/modules/monitoring/application/controllers/ShowController.php +++ b/modules/monitoring/application/controllers/ShowController.php @@ -189,12 +189,12 @@ protected function createTabs() 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 @@ protected function createTabs() ), 'label' => $this->translate('Host'), 'icon' => 'host', - 'url' => 'monitoring/host/show', + 'url' => 'monitoring/show/host', 'urlParams' => $params, ) ); diff --git a/modules/monitoring/application/views/helpers/Link.php b/modules/monitoring/application/views/helpers/Link.php index 454d376826..8faf6e5fb2 100644 --- a/modules/monitoring/application/views/helpers/Link.php +++ b/modules/monitoring/application/views/helpers/Link.php @@ -33,7 +33,7 @@ public function host($host, $linkText) 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 @@ public function service($service, $serviceLinkText, $host, $hostLinkText) $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, diff --git a/modules/monitoring/application/views/helpers/PluginOutput.php b/modules/monitoring/application/views/helpers/PluginOutput.php index 8778d01b3d..d494a78100 100644 --- a/modules/monitoring/application/views/helpers/PluginOutput.php +++ b/modules/monitoring/application/views/helpers/PluginOutput.php @@ -65,7 +65,7 @@ protected function fixLinks($html) 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 { diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index 3efb703200..d1cdaf1b3f 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -34,7 +34,7 @@ if (count($hosts) === 0) { 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 ), diff --git a/modules/monitoring/application/views/scripts/list/servicegrid.phtml b/modules/monitoring/application/views/scripts/list/servicegrid.phtml index 2802ad9b48..a9cbac4451 100644 --- a/modules/monitoring/application/views/scripts/list/servicegrid.phtml +++ b/modules/monitoring/application/views/scripts/list/servicegrid.phtml @@ -68,7 +68,7 @@ foreach ($serviceDescriptions as $service_description): ?> 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)) ); ?> @@ -80,9 +80,9 @@ foreach ($serviceDescriptions as $service_description): ?> qlink( '', - 'monitoring/service/show', + 'monitoring/show/service', array( - 'host_name' => $service->host_name, + 'host' => $service->host_name, 'service' => $service->service_description ), array( diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index 12dec8c753..b8d344bde2 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -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); diff --git a/modules/monitoring/application/views/scripts/partials/host/servicesummary.phtml b/modules/monitoring/application/views/scripts/partials/host/servicesummary.phtml index 23cc21e975..c0acdead4a 100644 --- a/modules/monitoring/application/views/scripts/partials/host/servicesummary.phtml +++ b/modules/monitoring/application/views/scripts/partials/host/servicesummary.phtml @@ -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(); ?>
compact ? ' data-base-target="col1"' : ''; ?>> stats->services_total): ?> diff --git a/modules/monitoring/application/views/scripts/show/history.phtml b/modules/monitoring/application/views/scripts/show/history.phtml index 392490595e..3777d03841 100644 --- a/modules/monitoring/application/views/scripts/show/history.phtml +++ b/modules/monitoring/application/views/scripts/show/history.phtml @@ -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'), diff --git a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php index 084eb86cc6..05f201428a 100644 --- a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php +++ b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php @@ -556,10 +556,10 @@ public function __isset($name) */ 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; } diff --git a/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php b/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php index 3f71cb2c07..04102e9d2a 100644 --- a/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php +++ b/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php @@ -167,12 +167,12 @@ protected function createTabs() 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() ); }