From 4ac7557c2ff93c82cd8aa1b15e789443c0958079 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Tue, 26 May 2015 15:47:01 +0200 Subject: [PATCH 01/36] Show host and service notes in the host and service detail view refs #8235 --- .../application/views/scripts/host/show.phtml | 1 + .../views/scripts/service/show.phtml | 1 + .../scripts/show/components/actions.phtml | 12 ------ .../views/scripts/show/components/notes.phtml | 28 +++++++++++++ .../Backend/Ido/Query/StatusQuery.php | 2 + .../library/Monitoring/Object/Host.php | 11 +++++ .../Monitoring/Object/MonitoredObject.php | 40 +++++++++++++++++++ .../library/Monitoring/Object/Service.php | 11 +++++ 8 files changed, 94 insertions(+), 12 deletions(-) create mode 100644 modules/monitoring/application/views/scripts/show/components/notes.phtml diff --git a/modules/monitoring/application/views/scripts/host/show.phtml b/modules/monitoring/application/views/scripts/host/show.phtml index 32389515b..76d8c1b55 100644 --- a/modules/monitoring/application/views/scripts/host/show.phtml +++ b/modules/monitoring/application/views/scripts/host/show.phtml @@ -11,6 +11,7 @@ + render('show/components/notes.phtml') ?> render('show/components/acknowledgement.phtml') ?> render('show/components/comments.phtml') ?> render('show/components/notifications.phtml') ?> diff --git a/modules/monitoring/application/views/scripts/service/show.phtml b/modules/monitoring/application/views/scripts/service/show.phtml index 4d33644ce..43dc77030 100644 --- a/modules/monitoring/application/views/scripts/service/show.phtml +++ b/modules/monitoring/application/views/scripts/service/show.phtml @@ -11,6 +11,7 @@
+ render('show/components/notes.phtml') ?> render('show/components/acknowledgement.phtml') ?> render('show/components/comments.phtml') ?> render('show/components/notifications.phtml') ?> diff --git a/modules/monitoring/application/views/scripts/show/components/actions.phtml b/modules/monitoring/application/views/scripts/show/components/actions.phtml index 0681d5d91..35077abc0 100644 --- a/modules/monitoring/application/views/scripts/show/components/actions.phtml +++ b/modules/monitoring/application/views/scripts/show/components/actions.phtml @@ -8,18 +8,6 @@ $newTabInfo = sprintf(' %s ', $th $linkText = '%s ' . $newTabInfo . ''; $localLinkText = '%s'; -if ($object->notes_url) { - if (strpos($object->notes_url, "' ") === false) { - $links[] = sprintf($linkText, $this->resolveMacros($object->notes_url, $object), 'Notes'); - } else { - // TODO: We should find out document what's going on here. Looks strange :p - foreach(explode("' ", $object->notes_url) as $url) { - $url = strpos($url, "'") === 0 ? substr($url, 1) : $url; - $url = strrpos($url, "'") === strlen($url) - 1 ? substr($url, 0, strlen($url) - 1) : $url; - $links[] = sprintf($linkText, $this->resolveMacros($url, $object), 'Notes'); - } - } -} if ($object->action_url) { if (strpos($object->action_url, "' ") === false) { $links[] = sprintf($linkText, $this->resolveMacros($object->action_url, $object), 'Action'); diff --git a/modules/monitoring/application/views/scripts/show/components/notes.phtml b/modules/monitoring/application/views/scripts/show/components/notes.phtml new file mode 100644 index 000000000..cdc379184 --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/components/notes.phtml @@ -0,0 +1,28 @@ +getNotes()); +$links = $object->getNotesUrls(); +?> + + + + + + + \ No newline at end of file diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusQuery.php index 2aad7d31c..7181e8b89 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusQuery.php @@ -43,6 +43,7 @@ class StatusQuery extends IdoQuery 'host_icon_image' => 'h.icon_image', 'host_icon_image_alt' => 'h.icon_image_alt', 'host_action_url' => 'h.action_url', + 'host_notes' => 'h.notes', 'host_notes_url' => 'h.notes_url' ), 'hoststatus' => array( @@ -179,6 +180,7 @@ class StatusQuery extends IdoQuery 'service_icon_image' => 's.icon_image', 'service_icon_image_alt' => 's.icon_image_alt', 'service_action_url' => 's.action_url', + 'service_notes' => 's.notes', 'service_notes_url' => 's.notes_url', 'object_type' => '(\'service\')' ), diff --git a/modules/monitoring/library/Monitoring/Object/Host.php b/modules/monitoring/library/Monitoring/Object/Host.php index a158625b5..6bf6b05cc 100644 --- a/modules/monitoring/library/Monitoring/Object/Host.php +++ b/modules/monitoring/library/Monitoring/Object/Host.php @@ -119,6 +119,7 @@ class Host extends MonitoredObject 'host_max_check_attempts', 'host_name', 'host_next_check', + 'host_notes', 'host_notes_url', 'host_notifications_enabled', 'host_notifications_enabled_changed', @@ -188,4 +189,14 @@ class Host extends MonitoredObject } return $text; } + + public function getNotesUrls() + { + return MonitoredObject::parseAttributeUrls($this->host_notes_url); + } + + public function getNotes() + { + return $this->host_notes; + } } diff --git a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php index 05f201428..236ca2aaa 100644 --- a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php +++ b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php @@ -563,4 +563,44 @@ abstract class MonitoredObject implements Filterable } return null; } + + /** + * The notes for this monitored object + * + * @return string The notes as a string + */ + public function getNotes() {} + + /** + * Get all note urls configured for this monitored object + * + * @return array All note urls as a string + */ + public function getNotesUrls() {} + + /** + * Parse the content of the action_url or notes_url attributes + * + * @link http://docs.icinga.org/latest/de/objectdefinitions.html + * + * @param string $urlString A string containing one or more urls + * @return array Array of urls as strings + */ + public static function parseAttributeUrls($urlString) + { + if (empty($urlString)) { + return array(); + } + if (strpos($urlString, "' ") === false) { + $links[] = $urlString; + } else { + // parse notes-url format + foreach (explode("' ", $urlString) as $url) { + $url = strpos($url, "'") === 0 ? substr($url, 1) : $url; + $url = strrpos($url, "'") === strlen($url) - 1 ? substr($url, 0, strlen($url) - 1) : $url; + $links[] = $url; + } + } + return $links; + } } diff --git a/modules/monitoring/library/Monitoring/Object/Service.php b/modules/monitoring/library/Monitoring/Object/Service.php index 0e8c975f2..17fd143b5 100644 --- a/modules/monitoring/library/Monitoring/Object/Service.php +++ b/modules/monitoring/library/Monitoring/Object/Service.php @@ -147,6 +147,7 @@ class Service extends MonitoredObject 'service_last_state_change', 'service_long_output', 'service_next_check', + 'service_notes', 'service_notes_url', 'service_notifications_enabled', 'service_notifications_enabled_changed', @@ -198,4 +199,14 @@ class Service extends MonitoredObject } return $text; } + + public function getNotesUrls() + { + return MonitoredObject::parseAttributeUrls($this->service_notes_url); + } + + public function getNotes() + { + return $this->service_notes; + } } From a7135bad62b83445f298d6fcdfe5814e163b3193 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Tue, 26 May 2015 16:49:08 +0200 Subject: [PATCH 02/36] Resolve runtime macros in notes too refs #8235 --- .../application/views/scripts/show/components/notes.phtml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/application/views/scripts/show/components/notes.phtml b/modules/monitoring/application/views/scripts/show/components/notes.phtml index cdc379184..678d70c90 100644 --- a/modules/monitoring/application/views/scripts/show/components/notes.phtml +++ b/modules/monitoring/application/views/scripts/show/components/notes.phtml @@ -9,6 +9,7 @@ $links = $object->getNotesUrls(); - \ No newline at end of file + From cbf37bf90e7bae3bd7285838f3388c949926f896 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 27 May 2015 13:19:50 +0200 Subject: [PATCH 03/36] Inherit from Icinga\Web\Controller fixes #9317 --- application/controllers/ListController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/ListController.php b/application/controllers/ListController.php index 4271e385a..5e937d91b 100644 --- a/application/controllers/ListController.php +++ b/application/controllers/ListController.php @@ -1,7 +1,7 @@ Date: Wed, 27 May 2015 15:13:53 +0200 Subject: [PATCH 04/36] Ignore the preferences' loadability during authentication fixes #8956 --- library/Icinga/Authentication/Manager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Icinga/Authentication/Manager.php b/library/Icinga/Authentication/Manager.php index 993475636..5705b493b 100644 --- a/library/Icinga/Authentication/Manager.php +++ b/library/Icinga/Authentication/Manager.php @@ -70,7 +70,7 @@ class Manager $user ); $preferences = new Preferences($preferencesStore->load()); - } catch (NotReadableError $e) { + } catch (Exception $e) { Logger::error( new IcingaException( 'Cannot load preferences for user "%s". An exception was thrown', From 6c44f6a11a1154a9678257601071ed3c813e5799 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Thu, 28 May 2015 10:47:44 +0200 Subject: [PATCH 05/36] Deduplicate url-attribute parsing code Use function to fetch all host links in MonitoredObject instead. --- .../scripts/show/components/actions.phtml | 26 +++++++------------ .../Monitoring/Object/MonitoredObject.php | 13 ++++++++++ 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/modules/monitoring/application/views/scripts/show/components/actions.phtml b/modules/monitoring/application/views/scripts/show/components/actions.phtml index 35077abc0..18f8a8482 100644 --- a/modules/monitoring/application/views/scripts/show/components/actions.phtml +++ b/modules/monitoring/application/views/scripts/show/components/actions.phtml @@ -1,29 +1,21 @@ %s ', $this->translate('opens in new window')); -$linkText = '%s ' . $newTabInfo . ''; -$localLinkText = '%s'; - -if ($object->action_url) { - if (strpos($object->action_url, "' ") === false) { - $links[] = sprintf($linkText, $this->resolveMacros($object->action_url, $object), 'Action'); - } else { - // TODO: We should find out document what's going on here. Looks strange :p - foreach(explode("' ", $object->action_url) as $url) { - $url = strpos($url, "'") === 0 ? substr($url, 1) : $url; - $url = strrpos($url, "'") === strlen($url) - 1 ? substr($url, 0, strlen($url) - 1) : $url; - $links[] = sprintf($linkText, $this->resolveMacros($url, $object), 'Action'); - } - } +$links = MonitoredObject::parseAttributeUrls($object->action_url); +foreach ($links as $i => $link) { + $links[$i] = sprintf( + '%s ' . $newTabInfo . '', + $this->resolveMacros($object->action_url, $object), + 'Action' + ); } if (isset($this->actions)) { foreach ($this->actions as $id => $action) { - $links[] = sprintf($localLinkText, $action, $id); + $links[] = sprintf('%s', $action, $id); } } diff --git a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php index 236ca2aaa..37d29c82e 100644 --- a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php +++ b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php @@ -578,9 +578,22 @@ abstract class MonitoredObject implements Filterable */ public function getNotesUrls() {} + /** + * Get all action urls configured for this monitored object + * + * @return array All note urls as a string + */ + public function getActionUrls() + { + return MonitoredObject::parseAttributeUrls($this->action_url); + } + /** * Parse the content of the action_url or notes_url attributes * + * Find all occurences of http links, separated by whitespaces and quoted + * by single or double-ticks. + * * @link http://docs.icinga.org/latest/de/objectdefinitions.html * * @param string $urlString A string containing one or more urls From 701fd817fd07077b6de7187e0f8ffa7e7371e6f8 Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Thu, 28 May 2015 12:35:30 +0200 Subject: [PATCH 06/36] Vagrantfile: Update centos-6.5-64 to centos-6.6-64 Because the puppetlabs/centos-6.5-64-puppet vagrantbox is not anymore available --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 86de14bb1..28ac3897d 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -22,7 +22,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provision :shell, :path => ".puppet/manifests/puppet.sh" config.vm.provider :virtualbox do |v, override| - override.vm.box = "puppetlabs/centos-6.5-64-puppet" + override.vm.box = "puppetlabs/centos-6.6-64-puppet" v.customize ["modifyvm", :id, "--memory", "1024"] end From 903b02a13452353e07fa6250242db842a8254f65 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 27 May 2015 10:44:52 +0200 Subject: [PATCH 07/36] Translate no permission for configuration error message refs #6339 --- application/controllers/ConfigController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php index 77b5b66d9..8df6620c2 100644 --- a/application/controllers/ConfigController.php +++ b/application/controllers/ConfigController.php @@ -85,7 +85,7 @@ class ConfigController extends Controller public function indexAction() { if ($this->firstAllowedAction === null) { - throw new SecurityException('No permission for configuration'); + throw new SecurityException($this->translate('No permission for configuration')); } $action = $this->getTabs()->get($this->firstAllowedAction); if (substr($action->getUrl()->getPath(), 0, 7) === 'config/') { From bd5d6e966160728f1587471c5ef6116c975957dd Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 27 May 2015 10:46:20 +0200 Subject: [PATCH 08/36] Add missing return argument when removing an auth backend fails --- application/controllers/ConfigController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php index 8df6620c2..0606f8661 100644 --- a/application/controllers/ConfigController.php +++ b/application/controllers/ConfigController.php @@ -271,7 +271,7 @@ class ConfigController extends Controller $configForm->remove($authBackend); } catch (InvalidArgumentException $e) { Notification::error($e->getMessage()); - return; + return false; } if ($configForm->save()) { From a304645b1489ed721f3280ec93e396342b5d9e02 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 27 May 2015 10:48:27 +0200 Subject: [PATCH 09/36] Add missing return argument when removing a resource fails --- application/controllers/ConfigController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php index 0606f8661..5df2be008 100644 --- a/application/controllers/ConfigController.php +++ b/application/controllers/ConfigController.php @@ -352,7 +352,7 @@ class ConfigController extends Controller $configForm->remove($resource); } catch (InvalidArgumentException $e) { Notification::error($e->getMessage()); - return; + return false; } if ($configForm->save()) { From c2d7f0577e3c931be9d6285638ac76b0d130c7cd Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 27 May 2015 10:49:34 +0200 Subject: [PATCH 10/36] Use Controller::translate() instead of just t() refs #7330 --- application/controllers/DashboardController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/DashboardController.php b/application/controllers/DashboardController.php index 325556be0..7e4ac479b 100644 --- a/application/controllers/DashboardController.php +++ b/application/controllers/DashboardController.php @@ -78,7 +78,7 @@ class DashboardController extends ActionController $dashboard = $this->dashboard; $form = new DashletForm(); $form->setDashboard($dashboard); - $form->setSubmitLabel(t('Update Dashlet')); + $form->setSubmitLabel($this->translate('Update Dashlet')); if (! $this->_request->getParam('pane')) { throw new Zend_Controller_Action_Exception( 'Missing parameter "pane"', From 8b07a0e29a0253febe791cbf78974162f305e2cf Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 27 May 2015 10:59:35 +0200 Subject: [PATCH 11/36] Add missing return argument in the ResourceConfigForm --- application/forms/Config/ResourceConfigForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/forms/Config/ResourceConfigForm.php b/application/forms/Config/ResourceConfigForm.php index 5d1eeaa9b..bfec65938 100644 --- a/application/forms/Config/ResourceConfigForm.php +++ b/application/forms/Config/ResourceConfigForm.php @@ -149,7 +149,7 @@ class ResourceConfigForm extends ConfigForm } } catch (InvalidArgumentException $e) { Notification::error($e->getMessage()); - return; + return false; } if ($this->save()) { From 124173f3c867c4a2cdf6e743344719fbb563a668 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 27 May 2015 11:05:06 +0200 Subject: [PATCH 12/36] Don't provide helpful error messages for unauthenticated users fixes #6952 --- application/controllers/ErrorController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/ErrorController.php b/application/controllers/ErrorController.php index 0223a66b7..1c01b1672 100644 --- a/application/controllers/ErrorController.php +++ b/application/controllers/ErrorController.php @@ -37,7 +37,7 @@ class ErrorController extends ActionController $path = array_shift($path); $this->getResponse()->setHttpResponseCode(404); $this->view->message = $this->translate('Page not found.'); - if ($modules->hasInstalled($path) && ! $modules->hasEnabled($path)) { + if ($this->Auth()->isAuthenticated() && $modules->hasInstalled($path) && ! $modules->hasEnabled($path)) { $this->view->message .= ' ' . sprintf( $this->translate('Enabling the "%s" module might help!'), $path From 31400ea16a05a0c47efcdbf9ca8d2f37b23ef0cd Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 27 May 2015 11:45:00 +0200 Subject: [PATCH 13/36] monitoring: Fix that searching for specific columns is no longer possible if default search columns are set --- library/Icinga/Web/Widget/FilterEditor.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/library/Icinga/Web/Widget/FilterEditor.php b/library/Icinga/Web/Widget/FilterEditor.php index 2d64e4c2b..dd84a5e52 100644 --- a/library/Icinga/Web/Widget/FilterEditor.php +++ b/library/Icinga/Web/Widget/FilterEditor.php @@ -216,25 +216,22 @@ class FilterEditor extends AbstractWidget $filter = $this->getFilter(); if ($search !== null) { - if (empty($this->searchColumns)) { - if (strpos($search, '=') === false) { - Notification::error(mt('monitoring', 'Cannot search here')); - return $this; - } else { - list($k, $v) = preg_split('/=/', $search); - $filter = $this->mergeRootExpression($filter, trim($k), '=', ltrim($v)); - } - } else { - if (false === $this->resetSearchColumns($filter)) { + if (strpos($search, '=') !== false) { + list($k, $v) = preg_split('/=/', $search); + $filter = $this->mergeRootExpression($filter, trim($k), '=', ltrim($v)); + } elseif (! empty($this->searchColumns)) { + if (! $this->resetSearchColumns($filter)) { $filter = Filter::matchAll(); } - $filters = array(); $search = ltrim($search); foreach ($this->searchColumns as $searchColumn) { $filters[] = Filter::expression($searchColumn, '=', "*$search*"); } $filter->andFilter(new FilterOr($filters)); + } else { + Notification::error(mt('monitoring', 'Cannot search here')); + return $this; } $url = $this->url()->setQueryString( From 1bfbce98ac15d8aef13c02bb4b10d0fbbbbd5dab Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 28 May 2015 09:44:01 +0200 Subject: [PATCH 14/36] Disable all form controls on submit to prevent resubmission fixes #7151 --- public/js/icinga/events.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index cc927feb6..84354c960 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -274,6 +274,10 @@ } } + // Disable all form controls to prevent resubmission except for our search input + // Note that disabled form inputs will not be enabled via JavaScript again + $form.find(':input:not(#search):not(:disabled)').prop('disabled', true); + icinga.loader.loadUrl(url, $target, data, method); return false; From 5fdaa2cd7e95761dc9fa0e82e01cc01b317cee8b Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 28 May 2015 10:33:13 +0200 Subject: [PATCH 15/36] monitoring: Fix command links when showing multiple selected hosts fixes #9327 --- .../monitoring/application/controllers/HostsController.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/monitoring/application/controllers/HostsController.php b/modules/monitoring/application/controllers/HostsController.php index 20ae71e6b..8f88330aa 100644 --- a/modules/monitoring/application/controllers/HostsController.php +++ b/modules/monitoring/application/controllers/HostsController.php @@ -131,13 +131,12 @@ class Monitoring_HostsController extends Controller $this->view->objects = $this->hostList; $this->view->unhandledObjects = $this->hostList->getUnhandledObjects(); $this->view->problemObjects = $this->hostList->getProblemObjects(); - $this->view->acknowledgeUnhandledLink = Url::fromPath('monitoring/hosts/acknowledge-problem') - ->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter()); + ->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter()->toQueryString()); $this->view->downtimeUnhandledLink = Url::fromPath('monitoring/hosts/schedule-downtime') - ->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter()); + ->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter()->toQueryString()); $this->view->downtimeLink = Url::fromPath('monitoring/hosts/schedule-downtime') - ->setQueryString($this->hostList->getProblemObjects()->objectsFilter()); + ->setQueryString($this->hostList->getProblemObjects()->objectsFilter()->toQueryString()); $this->view->acknowledgedObjects = $this->hostList->getAcknowledgedObjects(); $this->view->objectsInDowntime = $this->hostList->getObjectsInDowntime(); $this->view->inDowntimeLink = Url::fromPath('monitoring/list/hosts') From d7bdc5980120e7662f38c825d5f474def0cce022 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Thu, 28 May 2015 14:25:36 +0200 Subject: [PATCH 16/36] Don't change the status text's color for ok/up on hover fixes #8934 --- public/css/icinga/monitoring-colors.less | 1 - 1 file changed, 1 deletion(-) diff --git a/public/css/icinga/monitoring-colors.less b/public/css/icinga/monitoring-colors.less index 2b2b70b27..7f1499f02 100644 --- a/public/css/icinga/monitoring-colors.less +++ b/public/css/icinga/monitoring-colors.less @@ -191,7 +191,6 @@ tr[href]:hover { } tr.state[href]:hover td.state { - color: white; background-color: #eee; } From 37f58e55d87de18e494d92daf7de2f199ce7991c Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Thu, 28 May 2015 14:21:05 +0200 Subject: [PATCH 17/36] Move macro resolcing functionality into separate class Make macro resolving functionality available to all code, instead of depending on a view resf #6392 --- .../application/views/helpers/IconImage.php | 6 +- .../views/helpers/ResolveMacros.php | 50 +------------- .../library/Monitoring/Object/Host.php | 2 +- .../library/Monitoring/Object/Macro.php | 67 +++++++++++++++++++ .../library/Monitoring/Object/Service.php | 2 +- .../views/helpers/ResolveMacrosTest.php | 25 +++---- 6 files changed, 86 insertions(+), 66 deletions(-) create mode 100644 modules/monitoring/library/Monitoring/Object/Macro.php diff --git a/modules/monitoring/application/views/helpers/IconImage.php b/modules/monitoring/application/views/helpers/IconImage.php index e0e969db4..ccd74ee3c 100644 --- a/modules/monitoring/application/views/helpers/IconImage.php +++ b/modules/monitoring/application/views/helpers/IconImage.php @@ -1,6 +1,8 @@ host_icon_image && ! preg_match('/[\'"]/', $object->host_icon_image)) { return $this->view->img( - 'img/icons/' . $this->view->resolveMacros($object->host_icon_image, $object), + 'img/icons/' . Macro::resolveMacro($object->host_icon_image, $object), null, array( 'alt' => $object->host_icon_image_alt, @@ -48,7 +50,7 @@ class Zend_View_Helper_IconImage extends Zend_View_Helper_Abstract { if ($object->service_icon_image && ! preg_match('/[\'"]/', $object->service_icon_image)) { return $this->view->img( - 'img/icons/' . $this->view->resolveMacros($object->service_icon_image, $object), + 'img/icons/' . Macro::resolveMacros($object->service_icon_image, $object), null, array( 'alt' => $object->service_icon_image_alt, diff --git a/modules/monitoring/application/views/helpers/ResolveMacros.php b/modules/monitoring/application/views/helpers/ResolveMacros.php index 7d555f8fd..e6566936e 100644 --- a/modules/monitoring/application/views/helpers/ResolveMacros.php +++ b/modules/monitoring/application/views/helpers/ResolveMacros.php @@ -2,61 +2,17 @@ /* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */ use \Zend_View_Helper_Abstract; -use Icinga\Module\Monitoring\Object\MonitoredObject; +use Icinga\Module\Monitoring\Object\Macro; class Zend_View_Helper_ResolveMacros extends Zend_View_Helper_Abstract { - /** - * Known icinga macros - * - * @var array - */ - private $icingaMacros = array( - 'HOSTNAME' => 'host_name', - 'HOSTADDRESS' => 'host_address', - 'SERVICEDESC' => 'service_description' - ); - - /** - * Return the given string with macros being resolved - * - * @param string $input The string in which to look for macros - * @param MonitoredObject|stdClass $object The host or service used to resolve macros - * - * @return string The substituted or unchanged string - */ public function resolveMacros($input, $object) { - $matches = array(); - if (preg_match_all('@\$([^\$\s]+)\$@', $input, $matches)) { - foreach ($matches[1] as $key => $value) { - $newValue = $this->resolveMacro($value, $object); - if ($newValue !== $value) { - $input = str_replace($matches[0][$key], $newValue, $input); - } - } - } - - return $input; + return Macro::resolveMacros($input, $object); } - /** - * Resolve a macro based on the given object - * - * @param string $macro The macro to resolve - * @param MonitoredObject|stdClass $object The object used to resolve the macro - * - * @return string The new value or the macro if it cannot be resolved - */ public function resolveMacro($macro, $object) { - if (array_key_exists($macro, $this->icingaMacros) && $object->{$this->icingaMacros[$macro]} !== false) { - return $object->{$this->icingaMacros[$macro]}; - } - if (array_key_exists($macro, $object->customvars)) { - return $object->customvars[$macro]; - } - - return $macro; + return Macro::resolveMacro($macro, $object); } } diff --git a/modules/monitoring/library/Monitoring/Object/Host.php b/modules/monitoring/library/Monitoring/Object/Host.php index 6bf6b05cc..da3d66613 100644 --- a/modules/monitoring/library/Monitoring/Object/Host.php +++ b/modules/monitoring/library/Monitoring/Object/Host.php @@ -7,7 +7,7 @@ use InvalidArgumentException; use Icinga\Module\Monitoring\Backend\MonitoringBackend; /** - * A Icinga host + * An Icinga host */ class Host extends MonitoredObject { diff --git a/modules/monitoring/library/Monitoring/Object/Macro.php b/modules/monitoring/library/Monitoring/Object/Macro.php new file mode 100644 index 000000000..4a9045b58 --- /dev/null +++ b/modules/monitoring/library/Monitoring/Object/Macro.php @@ -0,0 +1,67 @@ + 'host_name', + 'HOSTADDRESS' => 'host_address', + 'SERVICEDESC' => 'service_description', + 'host.name' => 'host_name', + 'host.address' => 'host_address', + 'service.description' => 'service_description' + ); + + /** + * Return the given string with macros being resolved + * + * @param string $input The string in which to look for macros + * @param MonitoredObject|stdClass $object The host or service used to resolve macros + * + * @return string The substituted or unchanged string + */ + public static function resolveMacros($input, $object) + { + $matches = array(); + if (preg_match_all('@\$([^\$\s]+)\$@', $input, $matches)) { + foreach ($matches[1] as $key => $value) { + $newValue = self::resolveMacro($value, $object); + if ($newValue !== $value) { + $input = str_replace($matches[0][$key], $newValue, $input); + } + } + } + + return $input; + } + + /** + * Resolve a macro based on the given object + * + * @param string $macro The macro to resolve + * @param MonitoredObject|stdClass $object The object used to resolve the macro + * + * @return string The new value or the macro if it cannot be resolved + */ + public static function resolveMacro($macro, $object) + { + if (array_key_exists($macro, self::$icingaMacros) && $object->{self::$icingaMacros[$macro]} !== false) { + return $object->{self::$icingaMacros[$macro]}; + } + if (array_key_exists($macro, $object->customvars)) { + return $object->customvars[$macro]; + } + + return $macro; + } +} diff --git a/modules/monitoring/library/Monitoring/Object/Service.php b/modules/monitoring/library/Monitoring/Object/Service.php index 17fd143b5..6b5cd5bf9 100644 --- a/modules/monitoring/library/Monitoring/Object/Service.php +++ b/modules/monitoring/library/Monitoring/Object/Service.php @@ -7,7 +7,7 @@ use InvalidArgumentException; use Icinga\Module\Monitoring\Backend\MonitoringBackend; /** - * A Icinga service + * An Icinga service */ class Service extends MonitoredObject { diff --git a/modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php b/modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php index 31bf839a3..dc05f1e3d 100644 --- a/modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php +++ b/modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php @@ -4,10 +4,10 @@ namespace Tests\Icinga\Modules\Monitoring\Application\Views\Helpers; use Mockery; -use Zend_View_Helper_ResolveMacros; use Icinga\Test\BaseTestCase; +use Icinga\Module\Monitoring\Object\Macro; -require_once realpath(BaseTestCase::$moduleDir . '/monitoring/application/views/helpers/ResolveMacros.php'); +require_once realpath(BaseTestCase::$moduleDir . '/monitoring/library/Monitoring/Object/Macro.php'); class ResolveMacrosTest extends BaseTestCase { @@ -17,9 +17,8 @@ class ResolveMacrosTest extends BaseTestCase $hostMock->host_name = 'test'; $hostMock->host_address = '1.1.1.1'; - $helper = new Zend_View_Helper_ResolveMacros(); - $this->assertEquals($helper->resolveMacros('$HOSTNAME$', $hostMock), $hostMock->host_name); - $this->assertEquals($helper->resolveMacros('$HOSTADDRESS$', $hostMock), $hostMock->host_address); + $this->assertEquals(Macro::resolveMacros('$HOSTNAME$', $hostMock), $hostMock->host_name); + $this->assertEquals(Macro::resolveMacros('$HOSTADDRESS$', $hostMock), $hostMock->host_address); } public function testServiceMacros() @@ -29,10 +28,9 @@ class ResolveMacrosTest extends BaseTestCase $svcMock->host_address = '1.1.1.1'; $svcMock->service_description = 'a service'; - $helper = new Zend_View_Helper_ResolveMacros(); - $this->assertEquals($helper->resolveMacros('$HOSTNAME$', $svcMock), $svcMock->host_name); - $this->assertEquals($helper->resolveMacros('$HOSTADDRESS$', $svcMock), $svcMock->host_address); - $this->assertEquals($helper->resolveMacros('$SERVICEDESC$', $svcMock), $svcMock->service_description); + $this->assertEquals(Macro::resolveMacros('$HOSTNAME$', $svcMock), $svcMock->host_name); + $this->assertEquals(Macro::resolveMacros('$HOSTADDRESS$', $svcMock), $svcMock->host_address); + $this->assertEquals(Macro::resolveMacros('$SERVICEDESC$', $svcMock), $svcMock->service_description); } public function testCustomvars() @@ -42,8 +40,7 @@ class ResolveMacrosTest extends BaseTestCase 'CUSTOMVAR' => 'test' ); - $helper = new Zend_View_Helper_ResolveMacros(); - $this->assertEquals($helper->resolveMacros('$CUSTOMVAR$', $objectMock), $objectMock->customvars['CUSTOMVAR']); + $this->assertEquals(Macro::resolveMacros('$CUSTOMVAR$', $objectMock), $objectMock->customvars['CUSTOMVAR']); } public function testFaultyMacros() @@ -55,9 +52,8 @@ class ResolveMacrosTest extends BaseTestCase 'NAME' => 'st' ); - $helper = new Zend_View_Helper_ResolveMacros(); $this->assertEquals( - $helper->resolveMacros('$$HOSTNAME$ $ HOSTNAME$ $HOST$NAME$', $hostMock), + Macro::resolveMacros('$$HOSTNAME$ $ HOSTNAME$ $HOST$NAME$', $hostMock), '$test $ HOSTNAME$ teNAME$' ); } @@ -69,9 +65,8 @@ class ResolveMacrosTest extends BaseTestCase 'V€RY_SP3C|@L' => 'not too special!' ); - $helper = new Zend_View_Helper_ResolveMacros(); $this->assertEquals( - $helper->resolveMacros('$V€RY_SP3C|@L$', $objectMock), + Macro::resolveMacros('$V€RY_SP3C|@L$', $objectMock), $objectMock->customvars['V€RY_SP3C|@L'] ); } From a66949162bdb21daee4850bed261d26fa08e4118 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Thu, 28 May 2015 14:58:16 +0200 Subject: [PATCH 18/36] Resolve macros when accessing getters on MonitoredObjects refs #6392 --- .../scripts/show/components/actions.phtml | 9 ++------ .../views/scripts/show/components/notes.phtml | 7 ++---- .../library/Monitoring/Object/Host.php | 4 +++- .../Monitoring/Object/MonitoredObject.php | 22 ++++++++++++++++--- .../library/Monitoring/Object/Service.php | 4 +++- 5 files changed, 29 insertions(+), 17 deletions(-) diff --git a/modules/monitoring/application/views/scripts/show/components/actions.phtml b/modules/monitoring/application/views/scripts/show/components/actions.phtml index 18f8a8482..78365f733 100644 --- a/modules/monitoring/application/views/scripts/show/components/actions.phtml +++ b/modules/monitoring/application/views/scripts/show/components/actions.phtml @@ -1,16 +1,11 @@ %s ', $this->translate('opens in new window')); -$links = MonitoredObject::parseAttributeUrls($object->action_url); +$links = $object->getActionUrls(); foreach ($links as $i => $link) { - $links[$i] = sprintf( - '%s ' . $newTabInfo . '', - $this->resolveMacros($object->action_url, $object), - 'Action' - ); + $links[$i] = sprintf('%s ' . $newTabInfo . '', $link, 'Action'); } if (isset($this->actions)) { diff --git a/modules/monitoring/application/views/scripts/show/components/notes.phtml b/modules/monitoring/application/views/scripts/show/components/notes.phtml index 678d70c90..4a5041e50 100644 --- a/modules/monitoring/application/views/scripts/show/components/notes.phtml +++ b/modules/monitoring/application/views/scripts/show/components/notes.phtml @@ -1,15 +1,13 @@ getNotes()); $links = $object->getNotesUrls(); -?> - +if (! empty($links) || ! empty($notes)): ?> - + From c7261bd4811a371312a43722b0ba41c5e6eedc1a Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Thu, 28 May 2015 15:37:01 +0200 Subject: [PATCH 24/36] Add missing columns for macro expansion refs #6392 --- modules/monitoring/application/controllers/HostsController.php | 2 ++ .../monitoring/application/controllers/ServicesController.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/modules/monitoring/application/controllers/HostsController.php b/modules/monitoring/application/controllers/HostsController.php index 20ae71e6b..961e08822 100644 --- a/modules/monitoring/application/controllers/HostsController.php +++ b/modules/monitoring/application/controllers/HostsController.php @@ -56,6 +56,7 @@ class Monitoring_HostsController extends Controller 'host_icon_image', 'host_icon_image_alt', 'host_name', + 'host_address', 'host_state', 'host_problem', 'host_handled', @@ -94,6 +95,7 @@ class Monitoring_HostsController extends Controller 'host_icon_image', 'host_icon_image_alt', 'host_name', + 'host_address', 'host_state', 'host_problem', 'host_handled', diff --git a/modules/monitoring/application/controllers/ServicesController.php b/modules/monitoring/application/controllers/ServicesController.php index 1a8ec9a58..097ee607b 100644 --- a/modules/monitoring/application/controllers/ServicesController.php +++ b/modules/monitoring/application/controllers/ServicesController.php @@ -53,6 +53,7 @@ class Monitoring_ServicesController extends Controller 'host_icon_image', 'host_icon_image_alt', 'host_name', + 'host_address', 'host_output', 'host_state', 'host_problem', @@ -100,6 +101,7 @@ class Monitoring_ServicesController extends Controller 'host_icon_image', 'host_icon_image_alt', 'host_name', + 'host_address', 'host_output', 'host_state', 'host_problem', From 1a51368a76c1f0f36f4b3e116fcee8901f9b776b Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 28 May 2015 16:08:21 +0200 Subject: [PATCH 25/36] Fix MacroTest Pushing failing tests to the master is a mystery to me. refs #6392 --- .../monitoring/test/php/library/Monitoring/Object/MacroTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/test/php/library/Monitoring/Object/MacroTest.php b/modules/monitoring/test/php/library/Monitoring/Object/MacroTest.php index 88cebe63e..e1b3595e3 100644 --- a/modules/monitoring/test/php/library/Monitoring/Object/MacroTest.php +++ b/modules/monitoring/test/php/library/Monitoring/Object/MacroTest.php @@ -35,7 +35,7 @@ class MacroTest extends BaseTestCase $this->assertEquals(Macro::resolveMacros('$SERVICEDESC$', $svcMock), $svcMock->service_description); $this->assertEquals(Macro::resolveMacros('$host.name$', $svcMock), $svcMock->host_name); $this->assertEquals(Macro::resolveMacros('$host.address$', $svcMock), $svcMock->host_address); - $this->assertEquals(Macro::resolveMacros('$service.description', $svcMock), $svcMock->service_description); + $this->assertEquals(Macro::resolveMacros('$service.description$', $svcMock), $svcMock->service_description); } public function testCustomvars() From a4a1a296d181904fbf76246f93ef533b991f2cc3 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 28 May 2015 13:36:00 +0200 Subject: [PATCH 26/36] monitoring: Reduce error output when transporting a command to a local command file failed refs #8006 --- .../Monitoring/Command/Transport/LocalCommandFile.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Command/Transport/LocalCommandFile.php b/modules/monitoring/library/Monitoring/Command/Transport/LocalCommandFile.php index 197a3fdb1..a26999f18 100644 --- a/modules/monitoring/library/Monitoring/Command/Transport/LocalCommandFile.php +++ b/modules/monitoring/library/Monitoring/Command/Transport/LocalCommandFile.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Monitoring\Command\Transport; use Exception; +use RuntimeException; use Icinga\Application\Logger; use Icinga\Exception\ConfigurationError; use Icinga\Module\Monitoring\Command\Exception\TransportException; @@ -123,11 +124,15 @@ class LocalCommandFile implements CommandTransportInterface $file->fwrite($commandString . "\n"); $file->fflush(); } catch (Exception $e) { + $message = $e->getMessage(); + if ($e instanceof RuntimeException && ($pos = strrpos($message, ':')) !== false) { + // Assume RuntimeException thrown by SplFileObject in the format: __METHOD__ . "({$filename}): Message" + $message = substr($message, $pos + 1); + } throw new TransportException( - 'Can\'t send external Icinga command "%s" to the local command file "%s": %s', - $commandString, + 'Can\'t send external Icinga command to the local command file "%s": %s', $this->path, - $e + $message ); } } From 70d98f3ae0de374cd1b58de019066bf59d64dacb Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 28 May 2015 16:27:43 +0200 Subject: [PATCH 27/36] Don't render disabled input elements white --- public/css/icinga/forms.less | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/public/css/icinga/forms.less b/public/css/icinga/forms.less index c8b5df161..b5d5bca01 100644 --- a/public/css/icinga/forms.less +++ b/public/css/icinga/forms.less @@ -96,11 +96,6 @@ select::-moz-focus-inner { outline: 0; } -input:disabled, select:disabled { - background-color: #fff; - border-color: white; -} - form.inline { margin: 0; padding: 0; @@ -263,4 +258,4 @@ form > div.header { h1, h2, h3, h4, h5, h6 { display: inline-block; } -} \ No newline at end of file +} From 9f155ea99d9126f9d90e5fa9b74fda2bbbeffb38 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 28 May 2015 16:33:35 +0200 Subject: [PATCH 28/36] monitoring: Don't show SSH command when transporting a command to a remote command file failed refs #8006 --- .../library/Monitoring/Command/Transport/RemoteCommandFile.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Command/Transport/RemoteCommandFile.php b/modules/monitoring/library/Monitoring/Command/Transport/RemoteCommandFile.php index 866497a5a..c0f670bfe 100644 --- a/modules/monitoring/library/Monitoring/Command/Transport/RemoteCommandFile.php +++ b/modules/monitoring/library/Monitoring/Command/Transport/RemoteCommandFile.php @@ -201,8 +201,7 @@ class RemoteCommandFile implements CommandTransportInterface exec($ssh, $output, $status); if ($status !== 0) { throw new TransportException( - 'Can\'t send external Icinga command "%s": %s', - $ssh, + 'Can\'t send external Icinga command: %s', implode(' ', $output) ); } From 29cc92a3f3417f639deab9eb7c78df3cec24632b Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Mon, 1 Jun 2015 12:22:53 +0200 Subject: [PATCH 29/36] Display acknowledgement action for all unacknowledged objects Instead of displaying the ack for all unhandled problem host, make acknowledgement possible for all monitored objects in multi views. fixes #7931 --- .../controllers/HostsController.php | 5 +-- .../controllers/ServicesController.php | 5 +-- .../views/scripts/hosts/show.phtml | 36 ++++++++++--------- .../views/scripts/services/show.phtml | 36 +++++++++++-------- .../library/Monitoring/Object/HostList.php | 15 ++++++++ .../library/Monitoring/Object/ObjectList.php | 5 +++ .../library/Monitoring/Object/ServiceList.php | 15 ++++++++ 7 files changed, 82 insertions(+), 35 deletions(-) diff --git a/modules/monitoring/application/controllers/HostsController.php b/modules/monitoring/application/controllers/HostsController.php index 2a40efc5b..487955da4 100644 --- a/modules/monitoring/application/controllers/HostsController.php +++ b/modules/monitoring/application/controllers/HostsController.php @@ -133,13 +133,14 @@ class Monitoring_HostsController extends Controller $this->view->objects = $this->hostList; $this->view->unhandledObjects = $this->hostList->getUnhandledObjects(); $this->view->problemObjects = $this->hostList->getProblemObjects(); - $this->view->acknowledgeUnhandledLink = Url::fromPath('monitoring/hosts/acknowledge-problem') - ->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter()->toQueryString()); $this->view->downtimeUnhandledLink = Url::fromPath('monitoring/hosts/schedule-downtime') ->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter()->toQueryString()); $this->view->downtimeLink = Url::fromPath('monitoring/hosts/schedule-downtime') ->setQueryString($this->hostList->getProblemObjects()->objectsFilter()->toQueryString()); $this->view->acknowledgedObjects = $this->hostList->getAcknowledgedObjects(); + $this->view->acknowledgeLink = Url::fromPath('monitoring/hosts/acknowledge-problem') + ->setQueryString($this->hostList->getUnacknowledgedObjects()->objectsFilter()->toQueryString()); + $this->view->unacknowledgedObjects = $this->hostList->getUnacknowledgedObjects(); $this->view->objectsInDowntime = $this->hostList->getObjectsInDowntime(); $this->view->inDowntimeLink = Url::fromPath('monitoring/list/hosts') ->setQueryString( diff --git a/modules/monitoring/application/controllers/ServicesController.php b/modules/monitoring/application/controllers/ServicesController.php index 097ee607b..a05a10e4d 100644 --- a/modules/monitoring/application/controllers/ServicesController.php +++ b/modules/monitoring/application/controllers/ServicesController.php @@ -149,13 +149,14 @@ class Monitoring_ServicesController extends Controller $this->view->objects = $this->serviceList; $this->view->unhandledObjects = $this->serviceList->getUnhandledObjects(); $this->view->problemObjects = $this->serviceList->getProblemObjects(); - $this->view->acknowledgeUnhandledLink = Url::fromPath('monitoring/services/acknowledge-problem') - ->setQueryString($this->serviceList->getUnhandledObjects()->objectsFilter()->toQueryString()); $this->view->downtimeUnhandledLink = Url::fromPath('monitoring/services/schedule-downtime') ->setQueryString($this->serviceList->getUnhandledObjects()->objectsFilter()->toQueryString()); $this->view->downtimeLink = Url::fromPath('monitoring/services/schedule-downtime') ->setQueryString($this->serviceList->getProblemObjects()->objectsFilter()->toQueryString()); $this->view->acknowledgedObjects = $acknowledgedObjects; + $this->view->acknowledgeLink = Url::fromPath('monitoring/services/acknowledge-problem') + ->setQueryString($this->serviceList->getUnacknowledgedObjects()->objectsFilter()->toQueryString()); + $this->view->unacknowledgedObjects = $this->serviceList->getUnacknowledgedObjects(); $this->view->objectsInDowntime = $this->serviceList->getObjectsInDowntime(); $this->view->inDowntimeLink = Url::fromPath('monitoring/list/services') ->setQueryString($this->serviceList->getObjectsInDowntime() diff --git a/modules/monitoring/application/views/scripts/hosts/show.phtml b/modules/monitoring/application/views/scripts/hosts/show.phtml index 6bbb3c80d..1abc2d21d 100644 --- a/modules/monitoring/application/views/scripts/hosts/show.phtml +++ b/modules/monitoring/application/views/scripts/hosts/show.phtml @@ -72,9 +72,10 @@ - +

icon('attention-alt') ?> translatePlural( @@ -110,6 +111,24 @@ ); ?> + 0): ?> +
+ qlink( + sprintf( + $this->translatePlural( + 'Acknowledge %u unacknowledged problem hosts', + 'Acknowledge %u unacknowledged problem hosts', + $unackCount + ), + $unackCount + ), + $acknowledgeLink, + null, + array('icon' => 'ok') + ); ?> + +

'plug') ); ?> -
- qlink( - sprintf( - $this->translatePlural( - 'Acknowledge %u unhandled problem host', - 'Acknowledge %u unhandled problem hosts', - $unhandledCount - ), - $unhandledCount - ), - $acknowledgeUnhandledLink, - null, - array('icon' => 'ok') - ); ?> - diff --git a/modules/monitoring/application/views/scripts/services/show.phtml b/modules/monitoring/application/views/scripts/services/show.phtml index 746e24871..f4469fe2d 100644 --- a/modules/monitoring/application/views/scripts/services/show.phtml +++ b/modules/monitoring/application/views/scripts/services/show.phtml @@ -70,9 +70,10 @@ - +

icon('attention-alt') ?> @@ -105,6 +106,25 @@ ); ?> + + 0): ?> +
+ qlink( + sprintf( + $this->translatePlural( + 'Acknowledge %u unacknowledged problem service', + 'Acknowledge %u unacknowledged problem services', + $unackCount + ), + $unackCount + ), + $acknowledgeLink, + null, + array('icon' => 'ok') + ); ?> + +

translate('There are %s unhandled problem services. ' . @@ -126,20 +146,6 @@ array('icon' => 'plug') ); ?> -
- qlink( - sprintf( - $this->translatePlural( - 'Acknowledge %u unhandled problem service', - 'Acknowledge %u unhandled problem services', - $unhandledCount - ), - $unhandledCount - ), - $acknowledgeUnhandledLink, - null, - array('icon' => 'ok') - ); ?>

diff --git a/modules/monitoring/library/Monitoring/Object/HostList.php b/modules/monitoring/library/Monitoring/Object/HostList.php index 2aa5bb04f..51b58776b 100644 --- a/modules/monitoring/library/Monitoring/Object/HostList.php +++ b/modules/monitoring/library/Monitoring/Object/HostList.php @@ -99,4 +99,19 @@ class HostList extends ObjectList ->applyFilter(clone $this->filter) ->where('downtime_objecttype', 'host'); } + + /** + * @return ObjectList + */ + public function getUnacknowledgedObjects() + { + $unhandledObjects = array(); + foreach ($this as $object) { + if (! in_array((int) $object->state, array(0, 99)) && + (bool) $object->host_acknowledged === false) { + $unhandledObjects[] = $object; + } + } + return $this->newFromArray($unhandledObjects); + } } diff --git a/modules/monitoring/library/Monitoring/Object/ObjectList.php b/modules/monitoring/library/Monitoring/Object/ObjectList.php index 75fe1ba76..c4ecdddb2 100644 --- a/modules/monitoring/library/Monitoring/Object/ObjectList.php +++ b/modules/monitoring/library/Monitoring/Object/ObjectList.php @@ -193,6 +193,11 @@ abstract class ObjectList implements Countable, IteratorAggregate return $this->newFromArray($handledObjects); } + /** + * @return ObjectList + */ + public abstract function getUnacknowledgedObjects(); + /** * Create a ObjectList from an array of hosts without querying a backend * diff --git a/modules/monitoring/library/Monitoring/Object/ServiceList.php b/modules/monitoring/library/Monitoring/Object/ServiceList.php index 5ae9b8193..01ecf4da9 100644 --- a/modules/monitoring/library/Monitoring/Object/ServiceList.php +++ b/modules/monitoring/library/Monitoring/Object/ServiceList.php @@ -147,4 +147,19 @@ class ServiceList extends ObjectList ->applyFilter(clone $this->filter) ->where('downtime_objecttype', 'service'); } + + /** + * @return ObjectList + */ + public function getUnacknowledgedObjects() + { + $unhandledObjects = array(); + foreach ($this as $object) { + if (! in_array((int) $object->state, array(0, 99)) && + (bool) $object->service_acknowledged === false) { + $unhandledObjects[] = $object; + } + } + return $this->newFromArray($unhandledObjects); + } } From 1901f0af980a69ee28d5bc3457fca874396a28b9 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Mon, 1 Jun 2015 16:12:02 +0200 Subject: [PATCH 30/36] Improve .ini file formatting End every file with a newline, and only display 1 empty line between each section, to improve readabillity. fixes #8706 --- library/Icinga/File/Ini/IniEditor.php | 10 +++++++++- .../application/views/scripts/services/show.phtml | 2 -- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/library/Icinga/File/Ini/IniEditor.php b/library/Icinga/File/Ini/IniEditor.php index a772a8f41..c324808bc 100644 --- a/library/Icinga/File/Ini/IniEditor.php +++ b/library/Icinga/File/Ini/IniEditor.php @@ -62,7 +62,7 @@ class IniEditor $this->commentIndentation = array_key_exists('commentIndentation', $options) ? $options['commentIndentation'] : 43; $this->sectionSeparators = array_key_exists('sectionSeparators', $options) - ? $options['sectionSeparators'] : 2; + ? $options['sectionSeparators'] : 1; } /** @@ -323,6 +323,12 @@ class IniEditor private function cleanUpWhitespaces() { $i = count($this->text) - 1; + + // remove all trailing whitespaces + while ($i > 0 && preg_match('/^\s*$/', $this->text[$i]) === 1) { + $this->deleteLine($i); + $i--; + } for (; $i > 0; $i--) { $line = $this->text[$i]; if ($this->isSectionDeclaration($line) && $i > 0) { @@ -351,6 +357,8 @@ class IniEditor } } } + // always end file with a linebreak + $this->insertAtLine(count($this->text) + 1, ""); } /** diff --git a/modules/monitoring/application/views/scripts/services/show.phtml b/modules/monitoring/application/views/scripts/services/show.phtml index f4469fe2d..fc2e87ad2 100644 --- a/modules/monitoring/application/views/scripts/services/show.phtml +++ b/modules/monitoring/application/views/scripts/services/show.phtml @@ -106,8 +106,6 @@ ); ?> - 0): ?>
qlink( From 4c6a2b4f0695c0e4cb7e417cab386a69f6897240 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Mon, 1 Jun 2015 16:46:52 +0200 Subject: [PATCH 31/36] Fix ini writer unit tests refs #8706 --- .../library/Icinga/File/Ini/IniWriterTest.php | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/test/php/library/Icinga/File/Ini/IniWriterTest.php b/test/php/library/Icinga/File/Ini/IniWriterTest.php index 4dc94a63a..2d9659675 100644 --- a/test/php/library/Icinga/File/Ini/IniWriterTest.php +++ b/test/php/library/Icinga/File/Ini/IniWriterTest.php @@ -521,12 +521,10 @@ EOD key1 = "1" key2 = "2" - [two] a.b = "c" d.e = "f" - [three] key = "value" foo.bar = "raboof" @@ -537,12 +535,10 @@ EOD; key = "value" foo.bar = "raboof" - [two] a.b = "c" d.e = "f" - [one] key1 = "1" key2 = "2" @@ -589,7 +585,6 @@ EOD; ; comment 1 [one] - ; comment 2 [two] EOD; @@ -598,7 +593,6 @@ EOD; ; comment 2 [two] - ; comment 1 [one] EOD; @@ -637,8 +631,8 @@ EOD; ); $this->assertEquals( - $config, - $writer->render(), + trim($config), + trim($writer->render()), 'IniWriter does not preserve comments on empty lines' ); } @@ -667,8 +661,8 @@ EOD; ); $this->assertEquals( - $config, - $writer->render(), + trim($config), + trim($writer->render()), 'IniWriter does not preserve comments on property lines' ); } @@ -686,8 +680,8 @@ EOD; ); $this->assertEquals( - $config, - $writer->render(), + trim($config), + trim($writer->render()), 'IniWriter does not preserve comments on empty section lines' ); } @@ -719,8 +713,8 @@ EOD; ); $this->assertEquals( - $config, - $writer->render(), + trim($config), + trim($writer->render()), 'IniWriter does not preserve comments on property lines' ); } From 6661d49bd268fd4fc78e052c82526bc7f01815ac Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Mon, 1 Jun 2015 17:00:43 +0200 Subject: [PATCH 32/36] Use ltrim instead of a manual loop to remove trailing lines in ini writer refs #8706 --- library/Icinga/File/Ini/IniEditor.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/library/Icinga/File/Ini/IniEditor.php b/library/Icinga/File/Ini/IniEditor.php index c324808bc..1f8202d9d 100644 --- a/library/Icinga/File/Ini/IniEditor.php +++ b/library/Icinga/File/Ini/IniEditor.php @@ -314,7 +314,7 @@ class IniEditor public function getText() { $this->cleanUpWhitespaces(); - return implode(PHP_EOL, $this->text); + return rtrim(implode(PHP_EOL, $this->text)) . PHP_EOL; } /** @@ -323,12 +323,6 @@ class IniEditor private function cleanUpWhitespaces() { $i = count($this->text) - 1; - - // remove all trailing whitespaces - while ($i > 0 && preg_match('/^\s*$/', $this->text[$i]) === 1) { - $this->deleteLine($i); - $i--; - } for (; $i > 0; $i--) { $line = $this->text[$i]; if ($this->isSectionDeclaration($line) && $i > 0) { @@ -357,8 +351,6 @@ class IniEditor } } } - // always end file with a linebreak - $this->insertAtLine(count($this->text) + 1, ""); } /** From 44968266f6bdfacdbec4ac9c3d1525c2a57cd44d Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 1 Jun 2015 14:01:40 +0200 Subject: [PATCH 33/36] Fix no-op searches Depeding on the current filter, Filter::andFilter() may return a new filter object w/ the and filter applied or the and filter is applied to the object itself. The FilterEditor did not make use of the return value of Filter::andFilter() thus resulting in no-op searches in some scenarios. --- library/Icinga/Web/Widget/FilterEditor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Icinga/Web/Widget/FilterEditor.php b/library/Icinga/Web/Widget/FilterEditor.php index dd84a5e52..42561aeee 100644 --- a/library/Icinga/Web/Widget/FilterEditor.php +++ b/library/Icinga/Web/Widget/FilterEditor.php @@ -228,7 +228,7 @@ class FilterEditor extends AbstractWidget foreach ($this->searchColumns as $searchColumn) { $filters[] = Filter::expression($searchColumn, '=', "*$search*"); } - $filter->andFilter(new FilterOr($filters)); + $filter = $filter->andFilter(new FilterOr($filters)); } else { Notification::error(mt('monitoring', 'Cannot search here')); return $this; From 34edf87461cde09d643837c401c253c1f6f82c22 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 1 Jun 2015 17:24:34 +0200 Subject: [PATCH 34/36] monitoring: Readd link to all configured services --- .../scripts/list/components/servicesummary.phtml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/components/servicesummary.phtml b/modules/monitoring/application/views/scripts/list/components/servicesummary.phtml index 76a51de92..5776285ee 100644 --- a/modules/monitoring/application/views/scripts/list/components/servicesummary.phtml +++ b/modules/monitoring/application/views/scripts/list/components/servicesummary.phtml @@ -17,7 +17,18 @@ $this->baseFilter = isset($this->baseFilter) ? $this->baseFilter : null; $selfUrl = 'monitoring/list/services'; $currentUrl = Url::fromRequest()->getRelativeUrl(); ?>
compact ? ' data-base-target="col1"' : ''; ?>> -translate('%s services:'), $this->stats->services_total); ?> +qlink( + sprintf($this->translatePlural( + '%u Service', '%u Services', $this->stats->services_total), + $this->stats->services_total + ), + $selfUrl, + null, + array('title' => sprintf( + $this->translatePlural('List %u service', 'List all %u services', $this->stats->services_total), + $this->stats->services_total + )) +) ?>: stats->services_ok): ?> @@ -63,7 +74,7 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $ } else { $active = ''; } - + echo ''; if ($this->stats->$unhandled) { From 9b4f3c9f608faea39ff1d381390e1cb35606c1e6 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 1 Jun 2015 17:25:10 +0200 Subject: [PATCH 35/36] monitoring: Readd link to all configured hosts --- .../views/scripts/list/components/hostssummary.phtml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml b/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml index d6166a52d..1690bf0a7 100644 --- a/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml +++ b/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml @@ -15,7 +15,15 @@ $this->baseFilter = isset($this->baseFilter) ? $this->baseFilter : null; $selfUrl = 'monitoring/list/hosts'; $currentUrl = Url::fromRequest()->getRelativeUrl(); ?>
compact ? ' data-base-target="col1"' : ''; ?>> - translate('%s hosts:'), $this->stats->hosts_total); ?> + qlink( + sprintf($this->translatePlural('%u Host', '%u Hosts', $this->stats->hosts_total), $this->stats->hosts_total), + $selfUrl, + null, + array('title' => sprintf( + $this->translatePlural('List %u host', 'List all %u hosts', $this->stats->hosts_total), + $this->stats->hosts_total + )) + ) ?>: stats->hosts_up): ?> @@ -156,4 +164,4 @@ $currentUrl = Url::fromRequest()->getRelativeUrl(); -
\ No newline at end of file +
From cf95994ff54b4b8bd70cb675cf3d4a6648d245c7 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 26 May 2015 16:04:57 +0200 Subject: [PATCH 36/36] Documentation: Add config overview as first draft refs #7153 --- doc/configuration.md | 15 +++++++++++++++ modules/monitoring/doc/configuration.md | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 doc/configuration.md create mode 100644 modules/monitoring/doc/configuration.md diff --git a/doc/configuration.md b/doc/configuration.md new file mode 100644 index 000000000..90946be83 --- /dev/null +++ b/doc/configuration.md @@ -0,0 +1,15 @@ +# Configuration + +## Overview + +Apart from its web configuration capabilities, the local configuration is +stored in `/etc/icingaweb2` by default (depending on your config setup). + + Location | File | Description + ------------------------------|-----------------------|--------------------------- + . | config.ini | General configuration (logging, preferences) + . | resources.ini | Global resources (Icinga Web 2 database for preferences and authentication, icinga ido database) + . | roles.ini | User specific roles (e.g. `administrators`) and permissions + . | [authentication.ini](authentication.md) | Authentication backends (e.g. database) + enabledModules | Symlink | Contains symlinks to enabled modules from `/usr/share/icingaweb2/modules/*`. Defaults to [monitoring](modules/monitoring/doc/configuration.md) and `doc`. + modules | Directory | Module specific configuration diff --git a/modules/monitoring/doc/configuration.md b/modules/monitoring/doc/configuration.md new file mode 100644 index 000000000..7636b1a52 --- /dev/null +++ b/modules/monitoring/doc/configuration.md @@ -0,0 +1,16 @@ +# Monitoring Module Configuration + +## Overview + +Apart from its web configuration capabilities, the local configuration is +stored in `/etc/icingaweb2` by default (depending on your config setup). + + Location | File | Description + ------------------------------|-----------------------|--------------------------- + modules/monitoring | Directory | `monitoring` module specific configuration + modules/monitoring | config.ini | Security settings (e.g. protected custom vars) for the `monitoring` module + modules/monitoring | backends.ini | Backend type and resources (e.g. Icinga IDO DB) + modules/monitoring | [instances.ini](instances.md#instances) | Instances and their transport (e.g. local external command pipe) + + +

translate('Notes') ?> + '; + } + // add warning to links that open in new tabs to improve accessibility, as recommended by WCAG20 G201 + $newTabInfo = sprintf( + ' %s ', + $this->translate('opens in new window') + ); + $linkText = '%s ' . $newTabInfo . ''; + foreach ($links as $i => $link) { + $resolved = $this->resolveMacros($link, $object); + $links[$i] = sprintf($linkText, $this->escape($resolved), $this->escape($resolved)); + } + echo implode('
', $links); + ?> +
resolveMacros($notes, $object); echo $notes . '
'; } // add warning to links that open in new tabs to improve accessibility, as recommended by WCAG20 G201 @@ -25,4 +26,4 @@ $links = $object->getNotesUrls(); ?>
translate('Notes') ?> resolveMacros($notes, $object); echo $notes . '
'; } // add warning to links that open in new tabs to improve accessibility, as recommended by WCAG20 G201 @@ -19,8 +17,7 @@ $links = $object->getNotesUrls(); ); $linkText = '%s ' . $newTabInfo . ''; foreach ($links as $i => $link) { - $resolved = $this->resolveMacros($link, $object); - $links[$i] = sprintf($linkText, $this->escape($resolved), $this->escape($resolved)); + $links[$i] = sprintf($linkText, $this->escape($link), $this->escape($link)); } echo implode('
', $links); ?> diff --git a/modules/monitoring/library/Monitoring/Object/Host.php b/modules/monitoring/library/Monitoring/Object/Host.php index da3d66613..dd9b4c0c1 100644 --- a/modules/monitoring/library/Monitoring/Object/Host.php +++ b/modules/monitoring/library/Monitoring/Object/Host.php @@ -192,7 +192,9 @@ class Host extends MonitoredObject public function getNotesUrls() { - return MonitoredObject::parseAttributeUrls($this->host_notes_url); + return $this->resolveAllStrings( + MonitoredObject::parseAttributeUrls($this->host_notes_url) + ); } public function getNotes() diff --git a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php index 37d29c82e..b68bc0539 100644 --- a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php +++ b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php @@ -569,14 +569,14 @@ abstract class MonitoredObject implements Filterable * * @return string The notes as a string */ - public function getNotes() {} + public abstract function getNotes(); /** * Get all note urls configured for this monitored object * * @return array All note urls as a string */ - public function getNotesUrls() {} + public abstract function getNotesUrls(); /** * Get all action urls configured for this monitored object @@ -585,7 +585,23 @@ abstract class MonitoredObject implements Filterable */ public function getActionUrls() { - return MonitoredObject::parseAttributeUrls($this->action_url); + return $this->resolveAllStrings( + MonitoredObject::parseAttributeUrls($this->action_url) + ); + } + + /** + * Resolve macros in all given strings in the current object context + * + * @param array $strs An array of urls as string + * @return type + */ + protected function resolveAllStrings(array $strs) + { + foreach ($strs as $i => $str) { + $strs[$i] = Macro::resolveMacros($str, $this); + } + return $strs; } /** diff --git a/modules/monitoring/library/Monitoring/Object/Service.php b/modules/monitoring/library/Monitoring/Object/Service.php index 6b5cd5bf9..cb5615df1 100644 --- a/modules/monitoring/library/Monitoring/Object/Service.php +++ b/modules/monitoring/library/Monitoring/Object/Service.php @@ -202,7 +202,9 @@ class Service extends MonitoredObject public function getNotesUrls() { - return MonitoredObject::parseAttributeUrls($this->service_notes_url); + return $this->resolveAllStrings( + MonitoredObject::parseAttributeUrls($this->service_notes_url) + ); } public function getNotes() From 60e5608b4034a4ed67b79fc8b27b18114b858eeb Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Thu, 28 May 2015 15:02:58 +0200 Subject: [PATCH 19/36] Rename ResolveMacroTest refs #6392 --- .../Monitoring/Object/MacroTest.php} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename modules/monitoring/test/php/{application/views/helpers/ResolveMacrosTest.php => library/Monitoring/Object/MacroTest.php} (98%) diff --git a/modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php b/modules/monitoring/test/php/library/Monitoring/Object/MacroTest.php similarity index 98% rename from modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php rename to modules/monitoring/test/php/library/Monitoring/Object/MacroTest.php index dc05f1e3d..d328df367 100644 --- a/modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php +++ b/modules/monitoring/test/php/library/Monitoring/Object/MacroTest.php @@ -9,7 +9,7 @@ use Icinga\Module\Monitoring\Object\Macro; require_once realpath(BaseTestCase::$moduleDir . '/monitoring/library/Monitoring/Object/Macro.php'); -class ResolveMacrosTest extends BaseTestCase +class MacroTest extends BaseTestCase { public function testHostMacros() { From 2572842aa481b4c7b7939fa13cdf9b9a315c4816 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Thu, 28 May 2015 15:07:46 +0200 Subject: [PATCH 20/36] Add unit test cases for the new macro syntax refs #6392 --- .../test/php/library/Monitoring/Object/MacroTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/monitoring/test/php/library/Monitoring/Object/MacroTest.php b/modules/monitoring/test/php/library/Monitoring/Object/MacroTest.php index d328df367..88cebe63e 100644 --- a/modules/monitoring/test/php/library/Monitoring/Object/MacroTest.php +++ b/modules/monitoring/test/php/library/Monitoring/Object/MacroTest.php @@ -19,6 +19,8 @@ class MacroTest extends BaseTestCase $this->assertEquals(Macro::resolveMacros('$HOSTNAME$', $hostMock), $hostMock->host_name); $this->assertEquals(Macro::resolveMacros('$HOSTADDRESS$', $hostMock), $hostMock->host_address); + $this->assertEquals(Macro::resolveMacros('$host.name$', $hostMock), $hostMock->host_name); + $this->assertEquals(Macro::resolveMacros('$host.address$', $hostMock), $hostMock->host_address); } public function testServiceMacros() @@ -31,6 +33,9 @@ class MacroTest extends BaseTestCase $this->assertEquals(Macro::resolveMacros('$HOSTNAME$', $svcMock), $svcMock->host_name); $this->assertEquals(Macro::resolveMacros('$HOSTADDRESS$', $svcMock), $svcMock->host_address); $this->assertEquals(Macro::resolveMacros('$SERVICEDESC$', $svcMock), $svcMock->service_description); + $this->assertEquals(Macro::resolveMacros('$host.name$', $svcMock), $svcMock->host_name); + $this->assertEquals(Macro::resolveMacros('$host.address$', $svcMock), $svcMock->host_address); + $this->assertEquals(Macro::resolveMacros('$service.description', $svcMock), $svcMock->service_description); } public function testCustomvars() From 3b601decc595b07ee4673f01040f7a312c24b554 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Thu, 28 May 2015 15:15:07 +0200 Subject: [PATCH 21/36] Remove unused ResolceMacro Helper refs #6392 --- .../views/helpers/ResolveMacros.php | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 modules/monitoring/application/views/helpers/ResolveMacros.php diff --git a/modules/monitoring/application/views/helpers/ResolveMacros.php b/modules/monitoring/application/views/helpers/ResolveMacros.php deleted file mode 100644 index e6566936e..000000000 --- a/modules/monitoring/application/views/helpers/ResolveMacros.php +++ /dev/null @@ -1,18 +0,0 @@ - Date: Thu, 28 May 2015 15:21:56 +0200 Subject: [PATCH 22/36] Access correct resolver function in IconImage refs #6392 --- modules/monitoring/application/views/helpers/IconImage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/application/views/helpers/IconImage.php b/modules/monitoring/application/views/helpers/IconImage.php index ccd74ee3c..12108f30b 100644 --- a/modules/monitoring/application/views/helpers/IconImage.php +++ b/modules/monitoring/application/views/helpers/IconImage.php @@ -28,7 +28,7 @@ class Zend_View_Helper_IconImage extends Zend_View_Helper_Abstract { if ($object->host_icon_image && ! preg_match('/[\'"]/', $object->host_icon_image)) { return $this->view->img( - 'img/icons/' . Macro::resolveMacro($object->host_icon_image, $object), + 'img/icons/' . Macro::resolveMacros($object->host_icon_image, $object), null, array( 'alt' => $object->host_icon_image_alt, From a298197e6ce085fe5dfd7b1420322f34196cc1da Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Thu, 28 May 2015 15:31:50 +0200 Subject: [PATCH 23/36] Fix layout of action lincs in view refs #6392 --- .../application/views/scripts/show/components/actions.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/application/views/scripts/show/components/actions.phtml b/modules/monitoring/application/views/scripts/show/components/actions.phtml index 78365f733..329a06fb9 100644 --- a/modules/monitoring/application/views/scripts/show/components/actions.phtml +++ b/modules/monitoring/application/views/scripts/show/components/actions.phtml @@ -21,5 +21,5 @@ if (empty($links)) { ?>
translate('Actions') ?>", $links) ?>