From 975230d1166c13f713f80ba0fabf0e15e33decc6 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 30 Mar 2016 18:02:40 +0200 Subject: [PATCH 01/29] monitoring: Use descriptive variable names in commentsAction() --- .../controllers/ListController.php | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 35ce34797..efde0a749 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -385,12 +385,20 @@ class ListController extends Controller $this->view->groupData = $groupData; } + /** + * List all comments + */ public function commentsAction() { - $this->addTitleTab('comments', $this->translate('Comments'), $this->translate('List comments')); + $this->addTitleTab( + 'comments', + $this->translate('Comments'), + $this->translate('List comments') + ); + $this->setAutorefreshInterval(12); - $query = $this->backend->select()->from('comment', array( + $comments = $this->backend->select()->from('comment', array( 'id' => 'comment_internal_id', 'objecttype' => 'object_type', 'comment' => 'comment_data', @@ -404,12 +412,11 @@ class ListController extends Controller 'host_display_name', 'service_display_name' )); - $this->applyRestriction('monitoring/filter/objects', $query); - $this->filterQuery($query); - $this->view->comments = $query; + $this->applyRestriction('monitoring/filter/objects', $comments); + $this->filterQuery($comments); + $this->setupPaginationControl($comments); $this->setupLimitControl(); - $this->setupPaginationControl($this->view->comments); $this->setupSortControl( array( 'comment_timestamp' => $this->translate('Comment Timestamp'), @@ -418,9 +425,11 @@ class ListController extends Controller 'comment_type' => $this->translate('Comment Type'), 'comment_expiration' => $this->translate('Expiration') ), - $query + $comments ); + $this->view->comments = $comments; + if ($this->Auth()->hasPermission('monitoring/command/comment/delete')) { $this->view->delCommentForm = new DeleteCommentCommandForm(); $this->view->delCommentForm->handleRequest(); From 7481e3af43086cf717ee067bbdc09b952178dcc4 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 30 Mar 2016 18:03:37 +0200 Subject: [PATCH 02/29] monitoring: Update controls markup in comments refs #11145 --- .../application/views/scripts/list/comments.phtml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/comments.phtml b/modules/monitoring/application/views/scripts/list/comments.phtml index 0801a7e4d..4941922a9 100644 --- a/modules/monitoring/application/views/scripts/list/comments.phtml +++ b/modules/monitoring/application/views/scripts/list/comments.phtml @@ -1,11 +1,11 @@ compact): ?>
- + tabs ?> render('list/components/selectioninfo.phtml') ?> -
- sortBox ?> + paginator ?> +
limiter ?> - paginator ?> + sortBox ?>
filterEditor ?>
From a2ff8c9778d49d322050aa79bcd8fbc157ccac5c Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 09:14:15 +0200 Subject: [PATCH 03/29] monitoring: No longer provide contact columns in the contact group query Contacts query w/ filter for contact group should be used instead. --- .../controllers/ListController.php | 36 ++++------- .../views/scripts/list/contactgroups.phtml | 61 +++++++++---------- .../Backend/Ido/Query/ContactgroupQuery.php | 38 +++--------- .../Monitoring/DataView/Contactgroup.php | 27 +------- 4 files changed, 50 insertions(+), 112 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index efde0a749..d1fba8a72 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -342,6 +342,9 @@ class ListController extends Controller $this->view->orientation = $orientation; } + /** + * List contact groups + */ public function contactgroupsAction() { $this->addTitleTab( @@ -350,39 +353,22 @@ class ListController extends Controller $this->translate('List contact groups') ); - $query = $this->backend->select()->from('contactgroup', array( + $contactGroups = $this->backend->select()->from('contactgroup', array( 'contactgroup_name', 'contactgroup_alias', - 'contact_name', - 'contact_alias', - 'contact_email', - 'contact_pager' + 'contact_count' )); - $this->applyRestriction('monitoring/filter/objects', $query); - $this->filterQuery($query); + $this->applyRestriction('monitoring/filter/objects', $contactGroups); + $this->filterQuery($contactGroups); + $this->setupPaginationControl($contactGroups); + $this->setupLimitControl(); $this->setupSortControl(array( 'contactgroup_name' => $this->translate('Contactgroup Name'), 'contactgroup_alias' => $this->translate('Contactgroup Alias') - ), $query); + ), $contactGroups); - // Fetch and prepare all contact groups: - $contactgroups = $query->getQuery()->fetchAll(); - $groupData = array(); - foreach ($contactgroups as $c) { - if (!array_key_exists($c->contactgroup_name, $groupData)) { - $groupData[$c->contactgroup_name] = array( - 'alias' => $c->contactgroup_alias, - 'contacts' => array() - ); - } - if (isset ($c->contact_name)) { - $groupData[$c->contactgroup_name]['contacts'][] = $c; - } - } - - // TODO: Find a better naming - $this->view->groupData = $groupData; + $this->view->contactGroups = $contactGroups; } /** diff --git a/modules/monitoring/application/views/scripts/list/contactgroups.phtml b/modules/monitoring/application/views/scripts/list/contactgroups.phtml index eea6302b1..7deb4e6fb 100644 --- a/modules/monitoring/application/views/scripts/list/contactgroups.phtml +++ b/modules/monitoring/application/views/scripts/list/contactgroups.phtml @@ -12,42 +12,39 @@ if (! $this->compact): ?>
-translate('No contactgroups found matching the filter') . '
'; - return; -} -?> - +hasResult()): ?> +

translate('No contact groups found matching the filter') ?>

+ + +
- - - - - + + + + + - - $groupInfo): ?> - - + + + + - diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ContactgroupQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ContactgroupQuery.php index f0afc0768..c861d1fc9 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ContactgroupQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ContactgroupQuery.php @@ -16,12 +16,12 @@ class ContactgroupQuery extends IdoQuery /** * {@inheritdoc} */ - protected $groupBase = array('contactgroups' => array('cg.contactgroup_id', 'cgo.object_id')); + protected $groupBase = array('contactgroups' => array('cg.contactgroup_id')); /** * {@inheritdoc} */ - protected $groupOrigin = array('contacts', 'hosts', 'services'); + protected $groupOrigin = array('hosts', 'members', 'services'); /** * {@inheritdoc} @@ -32,28 +32,8 @@ class ContactgroupQuery extends IdoQuery 'contactgroup_name' => 'cgo.name1', 'contactgroup_alias' => 'cg.alias COLLATE latin1_general_ci' ), - 'contacts' => array( - 'contact_id' => 'c.contact_id', - 'contact' => 'co.name1 COLLATE latin1_general_ci', - 'contact_name' => 'co.name1', - 'contact_alias' => 'c.alias COLLATE latin1_general_ci', - 'contact_email' => 'c.email_address COLLATE latin1_general_ci', - 'contact_pager' => 'c.pager_address', - 'contact_object_id' => 'c.contact_object_id', - 'contact_has_host_notfications' => 'c.host_notifications_enabled', - 'contact_has_service_notfications' => 'c.service_notifications_enabled', - 'contact_can_submit_commands' => 'c.can_submit_commands', - 'contact_notify_service_recovery' => 'c.notify_service_recovery', - 'contact_notify_service_warning' => 'c.notify_service_warning', - 'contact_notify_service_critical' => 'c.notify_service_critical', - 'contact_notify_service_unknown' => 'c.notify_service_unknown', - 'contact_notify_service_flapping' => 'c.notify_service_flapping', - 'contact_notify_service_downtime' => 'c.notify_service_recovery', - 'contact_notify_host_recovery' => 'c.notify_host_recovery', - 'contact_notify_host_down' => 'c.notify_host_down', - 'contact_notify_host_unreachable' => 'c.notify_host_unreachable', - 'contact_notify_host_flapping' => 'c.notify_host_flapping', - 'contact_notify_host_downtime' => 'c.notify_host_downtime' + 'members' => array( + 'contact_count' => 'COUNT(cgm.contactgroup_member_id)' ), 'hostgroups' => array( 'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci', @@ -99,22 +79,18 @@ class ContactgroupQuery extends IdoQuery } /** - * Join contacts + * Join contact group members */ - protected function joinContacts() + protected function joinMembers() { $this->select->joinLeft( array('cgm' => $this->prefix . 'contactgroup_members'), 'cgm.contactgroup_id = cg.contactgroup_id', array() - )->joinLeft( + )->join( array('co' => $this->prefix . 'objects'), 'co.object_id = cgm.contact_object_id AND co.is_active = 1 AND co.objecttype_id = 10', array() - )->joinLeft( - array('c' => $this->prefix . 'contacts'), - 'c.contact_object_id = co.object_id', - array() ); } diff --git a/modules/monitoring/library/Monitoring/DataView/Contactgroup.php b/modules/monitoring/library/Monitoring/DataView/Contactgroup.php index cb12b0e2f..84eecd101 100644 --- a/modules/monitoring/library/Monitoring/DataView/Contactgroup.php +++ b/modules/monitoring/library/Monitoring/DataView/Contactgroup.php @@ -11,31 +11,9 @@ class Contactgroup extends DataView public function getColumns() { return array( - 'instance_name', 'contactgroup_name', 'contactgroup_alias', - 'contact_object_id', - 'contact_id', - 'contact_name', - 'contact_alias', - 'contact_email', - 'contact_pager', - 'contact_has_host_notfications', - 'contact_has_service_notfications', - 'contact_can_submit_commands', - 'contact_notify_service_recovery', - 'contact_notify_service_warning', - 'contact_notify_service_critical', - 'contact_notify_service_unknown', - 'contact_notify_service_flapping', - 'contact_notify_service_downtime', - 'contact_notify_host_recovery', - 'contact_notify_host_down', - 'contact_notify_host_unreachable', - 'contact_notify_host_flapping', - 'contact_notify_host_downtime', - 'contact_notify_host_timeperiod', - 'contact_notify_service_timeperiod' + 'contact_count' ); } @@ -60,9 +38,10 @@ class Contactgroup extends DataView public function getStaticFilterColumns() { return array( - 'contactgroup', 'contact', + 'contactgroup', 'host', 'host_name', 'host_display_name', 'host_alias', 'hostgroup', 'hostgroup_alias', 'hostgroup_name', + 'instance_name', 'service', 'service_description', 'service_display_name', 'servicegroup', 'servicegroup_alias', 'servicegroup_name' ); From 6e287d7905f9ca7c9cea1ab4599e26ea87c91dfe Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 09:15:39 +0200 Subject: [PATCH 04/29] monitoring: Update controls markup in contact groups refs #11145 --- .../application/views/scripts/list/contactgroups.phtml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/contactgroups.phtml b/modules/monitoring/application/views/scripts/list/contactgroups.phtml index 7deb4e6fb..c0656471a 100644 --- a/modules/monitoring/application/views/scripts/list/contactgroups.phtml +++ b/modules/monitoring/application/views/scripts/list/contactgroups.phtml @@ -2,11 +2,11 @@ if (! $this->compact): ?>
- -
- sortBox ?> + tabs ?> + paginator ?> +
limiter ?> - paginator ?> + sortBox ?>
filterEditor ?>
From af2a26474e02f6c22347db347de3d0b5ca0bdeea Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 09:18:21 +0200 Subject: [PATCH 05/29] monitoring: Use descriptive variable names in contactsAction() --- .../controllers/ListController.php | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index d1fba8a72..ced141a74 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -274,11 +274,18 @@ class ListController extends Controller ), $query); } + /** + * List contacts + */ public function contactsAction() { - $this->addTitleTab('contacts', $this->translate('Contacts'), $this->translate('List contacts')); + $this->addTitleTab( + 'contacts', + $this->translate('Contacts'), + $this->translate('List contacts') + ); - $query = $this->backend->select()->from('contact', array( + $contacts = $this->backend->select()->from('contact', array( 'contact_name', 'contact_alias', 'contact_email', @@ -286,20 +293,21 @@ class ListController extends Controller 'contact_notify_service_timeperiod', 'contact_notify_host_timeperiod' )); - $this->applyRestriction('monitoring/filter/objects', $query); - $this->filterQuery($query); - $this->view->contacts = $query; + $this->applyRestriction('monitoring/filter/objects', $contacts); + $this->filterQuery($contacts); + $this->setupPaginationControl($contacts); $this->setupLimitControl(); - $this->setupPaginationControl($this->view->contacts); $this->setupSortControl(array( - 'contact_name' => $this->translate('Name'), + 'contact_name' => $this->translate('Name'), 'contact_alias' => $this->translate('Alias'), 'contact_email' => $this->translate('Email'), 'contact_pager' => $this->translate('Pager Address / Number'), 'contact_notify_service_timeperiod' => $this->translate('Service Notification Timeperiod'), 'contact_notify_host_timeperiod' => $this->translate('Host Notification Timeperiod') - ), $query); + ), $contacts); + + $this->view->contacts = $contacts; } public function eventgridAction() From bb565b28aa2056c9e3640bff9d8cb5f8b1924042 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 09:18:35 +0200 Subject: [PATCH 06/29] monitoring/contacts: Remove sort by time period --- modules/monitoring/application/controllers/ListController.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index ced141a74..f3c83d30e 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -302,9 +302,7 @@ class ListController extends Controller 'contact_name' => $this->translate('Name'), 'contact_alias' => $this->translate('Alias'), 'contact_email' => $this->translate('Email'), - 'contact_pager' => $this->translate('Pager Address / Number'), - 'contact_notify_service_timeperiod' => $this->translate('Service Notification Timeperiod'), - 'contact_notify_host_timeperiod' => $this->translate('Host Notification Timeperiod') + 'contact_pager' => $this->translate('Pager Address / Number') ), $contacts); $this->view->contacts = $contacts; From a2d067ba97064023627b31e118d5c02973d4c353 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 09:19:41 +0200 Subject: [PATCH 07/29] monitoring: Update controls markup in contacts refs #11145 --- .../application/views/scripts/list/contacts.phtml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/contacts.phtml b/modules/monitoring/application/views/scripts/list/contacts.phtml index aca29d88e..f3ff3187c 100644 --- a/modules/monitoring/application/views/scripts/list/contacts.phtml +++ b/modules/monitoring/application/views/scripts/list/contacts.phtml @@ -1,10 +1,10 @@ compact): ?>
-
- sortBox ?> + paginator ?> +
limiter ?> - paginator ?> + sortBox ?>
filterEditor ?>
From 1da35eaad40ae19cdf63255c30dc99ac4151b4f4 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 09:24:31 +0200 Subject: [PATCH 08/29] monitoring/list: Update content markup in contacts --- .../views/scripts/list/contacts.phtml | 100 +++++++++--------- 1 file changed, 52 insertions(+), 48 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/contacts.phtml b/modules/monitoring/application/views/scripts/list/contacts.phtml index f3ff3187c..f712ada8a 100644 --- a/modules/monitoring/application/views/scripts/list/contacts.phtml +++ b/modules/monitoring/application/views/scripts/list/contacts.phtml @@ -1,6 +1,6 @@ compact): ?>
- + tabs ?> paginator ?>
limiter ?> @@ -10,70 +10,74 @@
-hasResult()): ?> -
translate('Contact Group ') ?>translate('Alias') ?>
translate('Contact Group ') ?>translate('Alias') ?>
- -
+ contact_count ?> + + qlink( + $contactGroup->contactgroup_name, + 'monitoring/list/contacts', + array('contactgroup_name' => $contactGroup->contactgroup_name), + array('title' => sprintf( + $this->translate('Show detailed information about %s'), + $contactGroup->contactgroup_name + )) + ) ?> + - qlink( - $groupName, - 'monitoring/list/contacts', - array('contactgroup_name' => $groupName), - array('title' => sprintf( - $this->translate('Show detailed information about %s'), - $groupName - )) - ) ?> - - - - + contactgroup_name !== $contactGroup->contactgroup_alias): ?> + contactgroup_alias ?> +
- +hasResult()): ?> +

translate('No contacts found matching the filter') ?>

+ + +
+ - - - peekAhead($this->compact) as $contact): ?> - - + peekAhead($this->compact) as $contact): ?> + + + ) + ) + ) ?> + + - - contact_notify_service_timeperiod): ?> - - + contact_notify_service_timeperiod): ?> + + - contact_notify_host_timeperiod): ?> - - - - - + contact_notify_host_timeperiod): ?> + + + + +
translate('Name') ?> translate('Email') ?> translate('Pager') ?>
- qlink( - $contact->contact_name, - 'monitoring/show/contact', - array('contact_name' => $contact->contact_name), - array('title' => sprintf( + +
+ qlink( + $contact->contact_name, + 'monitoring/show/contact', + array('contact_name' => $contact->contact_name), + array( + 'title' => sprintf( $this->translate('Show detailed information about %s'), $contact->contact_alias - ), 'class' => 'rowaction') - ); ?> - + translate('Email') ?>: + + escape($contact->contact_email) ?> + + - translate('Email') ?>: - - escape($contact->contact_email); ?> - + contact_pager): ?> + escape($contact->contact_pager) ?> + - contact_pager): ?> - escape($contact->contact_pager) ?> - - - escape($contact->contact_notify_service_timeperiod) ?> - + escape($contact->contact_notify_service_timeperiod) ?> + - escape($contact->contact_notify_host_timeperiod) ?> -
+ escape($contact->contact_notify_host_timeperiod) ?> +
- hasMore()): ?> +hasMore()): ?> + From 40e1c96df08dc6eda97370b339ae62cc83ee13cd Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 09:25:56 +0200 Subject: [PATCH 09/29] monitoring: Use descriptive variable names in downtimesAction() --- .../controllers/ListController.php | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index f3c83d30e..88cb5edd6 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -187,14 +187,19 @@ class ListController extends Controller } /** - * Fetch the current downtimes and put them into the view property `downtimes` + * List downtimes */ public function downtimesAction() { - $this->addTitleTab('downtimes', $this->translate('Downtimes'), $this->translate('List downtimes')); + $this->addTitleTab( + 'downtimes', + $this->translate('Downtimes'), + $this->translate('List downtimes') + ); + $this->setAutorefreshInterval(12); - $query = $this->backend->select()->from('downtime', array( + $downtimes = $this->backend->select()->from('downtime', array( 'id' => 'downtime_internal_id', 'objecttype' => 'object_type', 'comment' => 'downtime_comment', @@ -215,13 +220,11 @@ class ListController extends Controller 'host_display_name', 'service_display_name' )); - $this->applyRestriction('monitoring/filter/objects', $query); - $this->filterQuery($query); - - $this->view->downtimes = $query; + $this->applyRestriction('monitoring/filter/objects', $downtimes); + $this->filterQuery($downtimes); + $this->setupPaginationControl($downtimes); $this->setupLimitControl(); - $this->setupPaginationControl($this->view->downtimes); $this->setupSortControl(array( 'downtime_is_in_effect' => $this->translate('Is In Effect'), 'host_display_name' => $this->translate('Host'), @@ -233,7 +236,9 @@ class ListController extends Controller 'downtime_scheduled_start' => $this->translate('Scheduled Start'), 'downtime_scheduled_end' => $this->translate('Scheduled End'), 'downtime_duration' => $this->translate('Duration') - ), $query); + ), $downtimes); + + $this->view->downtimes = $downtimes; if ($this->Auth()->hasPermission('monitoring/command/downtime/delete')) { $this->view->delDowntimeForm = new DeleteDowntimeCommandForm(); From f135e4d0d26b4a3d77882535294c7b45061f3726 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 09:28:18 +0200 Subject: [PATCH 10/29] monitoring: Update controls markup in downtimes refs #11145 --- .../application/views/scripts/list/downtimes.phtml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/downtimes.phtml b/modules/monitoring/application/views/scripts/list/downtimes.phtml index 1033fdfe8..e0ac873d6 100644 --- a/modules/monitoring/application/views/scripts/list/downtimes.phtml +++ b/modules/monitoring/application/views/scripts/list/downtimes.phtml @@ -3,13 +3,13 @@ use Icinga\Module\Monitoring\Object\Host; use Icinga\Module\Monitoring\Object\Service; if (! $this->compact): ?> -
+
render('list/components/selectioninfo.phtml') ?> -
- sortBox ?> + paginator ?> +
limiter ?> - paginator ?> + sortBox ?>
filterEditor ?>
From bd3d40d46dd285a1bfb3b9f6770d96b6028bcf6e Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 09:33:21 +0200 Subject: [PATCH 11/29] monitoring: Update content markup in downtimes --- .../views/scripts/list/downtimes.phtml | 67 ++++++++++--------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/downtimes.phtml b/modules/monitoring/application/views/scripts/list/downtimes.phtml index e0ac873d6..cefddfa53 100644 --- a/modules/monitoring/application/views/scripts/list/downtimes.phtml +++ b/modules/monitoring/application/views/scripts/list/downtimes.phtml @@ -4,7 +4,7 @@ use Icinga\Module\Monitoring\Object\Service; if (! $this->compact): ?>
- + tabs ?> render('list/components/selectioninfo.phtml') ?> paginator ?>
@@ -15,39 +15,44 @@ if (! $this->compact): ?>
- " - data-icinga-multiselect-data="downtime_id"> +hasResult()): ?> +

translate('No downtimes found matching the filter.') ?>

+ + +
" + data-icinga-multiselect-data="downtime_id"> peekAhead($this->compact) as $downtime): - if (isset($downtime->service_description)) { - $this->isService = true; - $this->stateName = Service::getStateText($downtime->service_state); - } else { - $this->isService = false; - $this->stateName = Host::getStateText($downtime->host_state); - } - $this->downtime = $downtime; - ?> - - render('partials/downtime/downtime-header.phtml'); ?> - + if (isset($downtime->service_description)) { + $this->isService = true; + $this->stateName = Service::getStateText($downtime->service_state); + } else { + $this->isService = false; + $this->stateName = Host::getStateText($downtime->host_state); + } + // Set downtime for partials + $this->downtime = $downtime; + ?> + + render('partials/downtime/downtime-header.phtml') ?> + -
-hasResult()): ?> - translate('No downtimes found matching the filter, maybe the downtime already expired.'); ?> -hasMore()): ?> - qlink( - $this->translate('Show More'), - $this->url()->without(array('view', 'limit')), - null, - array( - 'data-base-target' => '_next', - 'class' => 'pull-right action-link' - ) - ); ?> + +hasMore()): ?> +
From c7249eab0c494f9341c7a9b7b9fecb756c2f915b Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 09:36:59 +0200 Subject: [PATCH 12/29] monitoring: Update controls markup in event views refs #11145 --- .../application/views/scripts/list/eventgrid.phtml | 8 ++------ .../application/views/scripts/list/eventhistory.phtml | 6 +++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/eventgrid.phtml b/modules/monitoring/application/views/scripts/list/eventgrid.phtml index 37024b841..aafa9b6b1 100644 --- a/modules/monitoring/application/views/scripts/list/eventgrid.phtml +++ b/modules/monitoring/application/views/scripts/list/eventgrid.phtml @@ -4,12 +4,8 @@ use Icinga\Web\Widget\Chart\HistoryColorGrid; if (! $this->compact): ?>
- tabs; ?> - sortBox; ?> - limiter; ?> - paginator; ?> - filterEditor; ?> - + tabs ?> + form ?>
diff --git a/modules/monitoring/application/views/scripts/list/eventhistory.phtml b/modules/monitoring/application/views/scripts/list/eventhistory.phtml index 32bb3d128..2ee788d60 100644 --- a/modules/monitoring/application/views/scripts/list/eventhistory.phtml +++ b/modules/monitoring/application/views/scripts/list/eventhistory.phtml @@ -3,11 +3,11 @@ if (! $this->compact): ?>
tabs ?> -
- sortBox ?> +
limiter ?> - filterEditor ?> + sortBox ?>
+ filterEditor ?>
partial( From 28e639bde1d678ecc31f1ebd19fea6e0a2da0738 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 09:38:02 +0200 Subject: [PATCH 13/29] monitoring: Use descriptive variable names in hostgroupsAction() --- .../controllers/ListController.php | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 88cb5edd6..e53f29417 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -470,10 +470,15 @@ class ListController extends Controller public function hostgroupsAction() { - $this->addTitleTab('hostgroups', $this->translate('Host Groups'), $this->translate('List host groups')); + $this->addTitleTab( + 'hostgroups', + $this->translate('Host Groups'), + $this->translate('List host groups') + ); + $this->setAutorefreshInterval(12); - $query = $this->backend->select()->from('hostgroupsummary', array( + $hostGroups = $this->backend->select()->from('hostgroupsummary', array( 'hostgroup_alias', 'hostgroup_name', 'hosts_down_handled', @@ -493,18 +498,19 @@ class ListController extends Controller 'services_warning_handled', 'services_warning_unhandled' )); - $this->applyRestriction('monitoring/filter/objects', $query); - $this->filterQuery($query); - $this->view->hostgroups = $query; + $this->applyRestriction('monitoring/filter/objects', $hostGroups); + $this->filterQuery($hostGroups); + $this->setupPaginationControl($hostGroups); $this->setupLimitControl(); - $this->setupPaginationControl($this->view->hostgroups); $this->setupSortControl(array( 'hosts_severity' => $this->translate('Severity'), 'hostgroup_alias' => $this->translate('Host Group Name'), 'hosts_total' => $this->translate('Total Hosts'), 'services_total' => $this->translate('Total Services') - ), $query); + ), $hostGroups); + + $this->view->hostgroups = $hostGroups; } public function eventhistoryAction() From 0551133291f53d520fb41c9489b3be5834a43fd1 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 09:40:54 +0200 Subject: [PATCH 14/29] monitoring: Update controls markup in host groups refs #11145 --- .../application/views/scripts/list/hostgroups.phtml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/hostgroups.phtml b/modules/monitoring/application/views/scripts/list/hostgroups.phtml index c39a80d33..848e2cd98 100644 --- a/modules/monitoring/application/views/scripts/list/hostgroups.phtml +++ b/modules/monitoring/application/views/scripts/list/hostgroups.phtml @@ -1,13 +1,13 @@ compact): ?>
- -
+ tabs ?> + paginator ?> +
sortBox ?> limiter ?> - paginator ?>
filterEditor ?>
From 7bc17aee74644e6acb5c27855a8768c3921f3824 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 09:44:48 +0200 Subject: [PATCH 15/29] monitoring: Update content markup in host groups --- .../controllers/ListController.php | 2 +- .../views/scripts/list/hostgroups.phtml | 516 +++++++++--------- 2 files changed, 260 insertions(+), 258 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index e53f29417..9e8a085cd 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -510,7 +510,7 @@ class ListController extends Controller 'services_total' => $this->translate('Total Services') ), $hostGroups); - $this->view->hostgroups = $hostGroups; + $this->view->hostGroups = $hostGroups; } public function eventhistoryAction() diff --git a/modules/monitoring/application/views/scripts/list/hostgroups.phtml b/modules/monitoring/application/views/scripts/list/hostgroups.phtml index 848e2cd98..2fbd9d4c5 100644 --- a/modules/monitoring/application/views/scripts/list/hostgroups.phtml +++ b/modules/monitoring/application/views/scripts/list/hostgroups.phtml @@ -6,273 +6,275 @@ if (! $this->compact): ?> tabs ?> paginator ?>
- sortBox ?> limiter ?> + sortBox ?>
filterEditor ?>
-hasResult()): ?> +hasResult()): ?>

translate('No host groups found matching the filter.') ?>

- - - - - - - - - - - -peekAhead($this->compact) as $hostgroup): ?> - - - - - - + + + +
translate('Host Group') ?>translate('Host States') ?>translate('Service States') ?>
- hosts_total ?> - - qlink( - $hostgroup->hostgroup_alias, - 'monitoring/list/hosts', - array('hostgroup_name' => $hostgroup->hostgroup_name), - array('title' => sprintf( - $this->translate('List all hosts in the group "%s"'), - $hostgroup->hostgroup_alias - )) - ) ?> - - setUrl('monitoring/list/hosts') - ->setBaseFilter($this->filterEditor->getFilter()) - ->add( - StateBadges::STATE_UP, - $hostgroup->hosts_up, - array( - 'host_state' => 0, - 'hostgroup_name' => $hostgroup->hostgroup_name, - 'sort' => 'host_severity' - ), - 'List %u host that is currently in state UP in the host group "%s"', - 'List %u hosts which are currently in state UP in the host group "%s"', - array($hostgroup->hosts_up, $hostgroup->hostgroup_alias) - ) - ->add( - StateBadges::STATE_DOWN, - $hostgroup->hosts_down_unhandled, - array( - 'host_state' => 1, - 'host_acknowledged' => 0, - 'host_in_downtime' => 0, - 'hostgroup_name' => $hostgroup->hostgroup_name, - 'sort' => 'host_severity' - ), - 'List %u host that is currently in state DOWN in the host group "%s"', - 'List %u hosts which are currently in state DOWN in the host group "%s"', - array($hostgroup->hosts_down_unhandled, $hostgroup->hostgroup_alias) - ) - ->add( - StateBadges::STATE_DOWN_HANDLED, - $hostgroup->hosts_down_handled, - array( - 'host_state' => 1, - 'host_handled' => 1, - 'hostgroup_name' => $hostgroup->hostgroup_name, - 'sort' => 'host_severity' - ), - 'List %u host that is currently in state DOWN (Acknowledged) in the host group "%s"', - 'List %u hosts which are currently in state DOWN (Acknowledged) in the host group "%s"', - array($hostgroup->hosts_down_handled, $hostgroup->hostgroup_alias) - ) - ->add( - StateBadges::STATE_UNREACHABLE, - $hostgroup->hosts_unreachable_unhandled, - array( - 'host_state' => 2, - 'host_acknowledged' => 0, - 'host_in_downtime' => 0, - 'hostgroup_name' => $hostgroup->hostgroup_name, - 'sort' => 'host_severity' - ), - 'List %u host that is currently in state UNREACHABLE in the host group "%s"', - 'List %u hosts which are currently in state UNREACHABLE in the host group "%s"', - array($hostgroup->hosts_unreachable_unhandled, $hostgroup->hostgroup_alias) - ) - ->add( - StateBadges::STATE_UNREACHABLE_HANDLED, - $hostgroup->hosts_unreachable_handled, - array( - 'host_state' => 2, - 'host_handled' => 1, - 'hostgroup_name' => $hostgroup->hostgroup_name, - 'sort' => 'host_severity' - ), - 'List %u host that is currently in state UNREACHABLE (Acknowledged) in the host group "%s"', - 'List %u hosts which are currently in state UNREACHABLE (Acknowledged) in the host group "%s"', - array($hostgroup->hosts_unreachable_handled, $hostgroup->hostgroup_alias) - ) - ->add( - StateBadges::STATE_PENDING, - $hostgroup->hosts_pending, - array( - 'host_state' => 99, - 'hostgroup_name' => $hostgroup->hostgroup_name, - 'sort' => 'host_severity' - ), - 'List %u host that is currently in state PENDING in the host group "%s"', - 'List %u hosts which are currently in state PENDING in the host group "%s"', - array($hostgroup->hosts_pending, $hostgroup->hostgroup_alias) - ); - echo $stateBadges->render(); - ?> - - qlink( - $hostgroup->services_total, - 'monitoring/list/services', - array('hostgroup_name' => $hostgroup->hostgroup_name), - array('title' => sprintf( - $this->translate('List all services of all hosts in host group "%s"'), - $hostgroup->hostgroup_alias - ), 'class' => 'badge') - ) ?> - - setUrl('monitoring/list/services') - ->add( - StateBadges::STATE_OK, - $hostgroup->services_ok, - array( - 'service_state' => 0, - 'hostgroup_name' => $hostgroup->hostgroup_name, - 'sort' => 'service_severity' - ), - 'List %u service that is currently in state OK on hosts in the host group "%s"', - 'List %u services which are currently in state OK on hosts in the host group "%s"', - array($hostgroup->services_ok, $hostgroup->hostgroup_alias) - ) - ->add( - StateBadges::STATE_CRITICAL, - $hostgroup->services_critical_unhandled, - array( - 'service_state' => 2, - 'service_acknowledged' => 0, - 'service_in_downtime' => 0, - 'host_problem' => 0, - 'hostgroup_name' => $hostgroup->hostgroup_name, - 'sort' => 'service_severity' - ), - 'List %u service that is currently in state CRITICAL on hosts in the host group "%s"', - 'List %u services which are currently in state CRITICAL on hosts in the host group "%s"', - array($hostgroup->services_critical_unhandled, $hostgroup->hostgroup_alias) - ) - ->add( - StateBadges::STATE_CRITICAL_HANDLED, - $hostgroup->services_critical_handled, - array( - 'service_state' => 2, - 'service_handled' => 1, - 'hostgroup_name' => $hostgroup->hostgroup_name, - 'sort' => 'service_severity' - ), - 'List %u service that is currently in state CRITICAL (Acknowledged) on hosts in the host group "%s"', - 'List %u services which are currently in state CRITICAL (Acknowledged) on hosts in the host group "%s"', - array($hostgroup->services_critical_unhandled, $hostgroup->hostgroup_alias) - ) - ->add( - StateBadges::STATE_UNKNOWN, - $hostgroup->services_unknown_unhandled, - array( - 'service_state' => 3, - 'service_acknowledged' => 0, - 'service_in_downtime' => 0, - 'host_problem' => 0, - 'hostgroup_name' => $hostgroup->hostgroup_name, - 'sort' => 'service_severity' - ), - 'List %u service that is currently in state UNKNOWN on hosts in the host group "%s"', - 'List %u services which are currently in state UNKNOWN on hosts in the host group "%s"', - array($hostgroup->services_unknown_unhandled, $hostgroup->hostgroup_alias) - ) - ->add( - StateBadges::STATE_UNKNOWN_HANDLED, - $hostgroup->services_unknown_handled, - array( - 'service_state' => 3, - 'service_handled' => 1, - 'hostgroup_name' => $hostgroup->hostgroup_name, - 'sort' => 'service_severity' - ), - 'List %u service that is currently in state UNKNOWN (Acknowledged) on hosts in the host group "%s"', - 'List %u services which are currently in state UNKNOWN (Acknowledged) on hosts in the host group "%s"', - array($hostgroup->services_unknown_handled, $hostgroup->hostgroup_alias) + + + + + + + + + + + + peekAhead($this->compact) as $hostGroup): ?> + + + + + + - - - -
translate('Host Group') ?>translate('Host States') ?>translate('Service States') ?>
+ hosts_total ?> + + qlink( + $hostGroup->hostgroup_alias, + 'monitoring/list/hosts', + array('hostgroup_name' => $hostGroup->hostgroup_name), + array('title' => sprintf( + $this->translate('List all hosts in the group "%s"'), + $hostGroup->hostgroup_alias + )) + ) ?> + + setUrl('monitoring/list/hosts') + ->setBaseFilter($this->filterEditor->getFilter()) + ->add( + StateBadges::STATE_UP, + $hostGroup->hosts_up, + array( + 'host_state' => 0, + 'hostgroup_name' => $hostGroup->hostgroup_name, + 'sort' => 'host_severity' + ), + 'List %u host that is currently in state UP in the host group "%s"', + 'List %u hosts which are currently in state UP in the host group "%s"', + array($hostGroup->hosts_up, $hostGroup->hostgroup_alias) + ) + ->add( + StateBadges::STATE_DOWN, + $hostGroup->hosts_down_unhandled, + array( + 'host_state' => 1, + 'host_acknowledged' => 0, + 'host_in_downtime' => 0, + 'hostgroup_name' => $hostGroup->hostgroup_name, + 'sort' => 'host_severity' + ), + 'List %u host that is currently in state DOWN in the host group "%s"', + 'List %u hosts which are currently in state DOWN in the host group "%s"', + array($hostGroup->hosts_down_unhandled, $hostGroup->hostgroup_alias) + ) + ->add( + StateBadges::STATE_DOWN_HANDLED, + $hostGroup->hosts_down_handled, + array( + 'host_state' => 1, + 'host_handled' => 1, + 'hostgroup_name' => $hostGroup->hostgroup_name, + 'sort' => 'host_severity' + ), + 'List %u host that is currently in state DOWN (Acknowledged) in the host group "%s"', + 'List %u hosts which are currently in state DOWN (Acknowledged) in the host group "%s"', + array($hostGroup->hosts_down_handled, $hostGroup->hostgroup_alias) + ) + ->add( + StateBadges::STATE_UNREACHABLE, + $hostGroup->hosts_unreachable_unhandled, + array( + 'host_state' => 2, + 'host_acknowledged' => 0, + 'host_in_downtime' => 0, + 'hostgroup_name' => $hostGroup->hostgroup_name, + 'sort' => 'host_severity' + ), + 'List %u host that is currently in state UNREACHABLE in the host group "%s"', + 'List %u hosts which are currently in state UNREACHABLE in the host group "%s"', + array($hostGroup->hosts_unreachable_unhandled, $hostGroup->hostgroup_alias) + ) + ->add( + StateBadges::STATE_UNREACHABLE_HANDLED, + $hostGroup->hosts_unreachable_handled, + array( + 'host_state' => 2, + 'host_handled' => 1, + 'hostgroup_name' => $hostGroup->hostgroup_name, + 'sort' => 'host_severity' + ), + 'List %u host that is currently in state UNREACHABLE (Acknowledged) in the host group "%s"', + 'List %u hosts which are currently in state UNREACHABLE (Acknowledged) in the host group "%s"', + array($hostGroup->hosts_unreachable_handled, $hostGroup->hostgroup_alias) + ) + ->add( + StateBadges::STATE_PENDING, + $hostGroup->hosts_pending, + array( + 'host_state' => 99, + 'hostgroup_name' => $hostGroup->hostgroup_name, + 'sort' => 'host_severity' + ), + 'List %u host that is currently in state PENDING in the host group "%s"', + 'List %u hosts which are currently in state PENDING in the host group "%s"', + array($hostGroup->hosts_pending, $hostGroup->hostgroup_alias) + ); + echo $stateBadges->render(); + ?> + + qlink( + $hostGroup->services_total, + 'monitoring/list/services', + array('hostgroup_name' => $hostGroup->hostgroup_name), + array('title' => sprintf( + $this->translate('List all services of all hosts in host group "%s"'), + $hostGroup->hostgroup_alias + ), 'class' => 'badge') + ) ?> + + setUrl('monitoring/list/services') + ->add( + StateBadges::STATE_OK, + $hostGroup->services_ok, + array( + 'service_state' => 0, + 'hostgroup_name' => $hostGroup->hostgroup_name, + 'sort' => 'service_severity' + ), + 'List %u service that is currently in state OK on hosts in the host group "%s"', + 'List %u services which are currently in state OK on hosts in the host group "%s"', + array($hostGroup->services_ok, $hostGroup->hostgroup_alias) + ) + ->add( + StateBadges::STATE_CRITICAL, + $hostGroup->services_critical_unhandled, + array( + 'service_state' => 2, + 'service_acknowledged' => 0, + 'service_in_downtime' => 0, + 'host_problem' => 0, + 'hostgroup_name' => $hostGroup->hostgroup_name, + 'sort' => 'service_severity' + ), + 'List %u service that is currently in state CRITICAL on hosts in the host group "%s"', + 'List %u services which are currently in state CRITICAL on hosts in the host group "%s"', + array($hostGroup->services_critical_unhandled, $hostGroup->hostgroup_alias) + ) + ->add( + StateBadges::STATE_CRITICAL_HANDLED, + $hostGroup->services_critical_handled, + array( + 'service_state' => 2, + 'service_handled' => 1, + 'hostgroup_name' => $hostGroup->hostgroup_name, + 'sort' => 'service_severity' + ), + 'List %u service that is currently in state CRITICAL (Acknowledged) on hosts in the host group "%s"', + 'List %u services which are currently in state CRITICAL (Acknowledged) on hosts in the host group "%s"', + array($hostGroup->services_critical_unhandled, $hostGroup->hostgroup_alias) + ) + ->add( + StateBadges::STATE_UNKNOWN, + $hostGroup->services_unknown_unhandled, + array( + 'service_state' => 3, + 'service_acknowledged' => 0, + 'service_in_downtime' => 0, + 'host_problem' => 0, + 'hostgroup_name' => $hostGroup->hostgroup_name, + 'sort' => 'service_severity' + ), + 'List %u service that is currently in state UNKNOWN on hosts in the host group "%s"', + 'List %u services which are currently in state UNKNOWN on hosts in the host group "%s"', + array($hostGroup->services_unknown_unhandled, $hostGroup->hostgroup_alias) + ) + ->add( + StateBadges::STATE_UNKNOWN_HANDLED, + $hostGroup->services_unknown_handled, + array( + 'service_state' => 3, + 'service_handled' => 1, + 'hostgroup_name' => $hostGroup->hostgroup_name, + 'sort' => 'service_severity' + ), + 'List %u service that is currently in state UNKNOWN (Acknowledged) on hosts in the host group "%s"', + 'List %u services which are currently in state UNKNOWN (Acknowledged) on hosts in the host group "%s"', + array($hostGroup->services_unknown_handled, $hostGroup->hostgroup_alias) - ) - ->add( - StateBadges::STATE_WARNING, - $hostgroup->services_warning_unhandled, - array( - 'service_state' => 1, - 'service_acknowledged' => 0, - 'service_in_downtime' => 0, - 'host_problem' => 0, - 'hostgroup_name' => $hostgroup->hostgroup_name, - 'sort' => 'service_severity' - ), - 'List %u service that is currently in state WARNING on hosts in the host group "%s"', - 'List %u services which are currently in state WARNING on hosts in the host group "%s"', - array($hostgroup->services_warning_unhandled, $hostgroup->hostgroup_alias) - ) - ->add( - StateBadges::STATE_WARNING_HANDLED, - $hostgroup->services_warning_handled, - array( - 'service_state' => 1, - 'service_handled' => 1, - 'hostgroup_name' => $hostgroup->hostgroup_name, - 'sort' => 'service_severity' - ), - 'List %u service that is currently in state WARNING (Acknowledged) on hosts in the host group "%s"', - 'List %u services which are currently in state WARNING (Acknowledged) on hosts in the host group "%s"', - array($hostgroup->services_warning_handled, $hostgroup->hostgroup_alias) - ) - ->add( - StateBadges::STATE_PENDING, - $hostgroup->services_pending, - array( - 'service_state' => 99, - 'hostgroup_name' => $hostgroup->hostgroup_name, - 'sort' => 'service_severity' - ), - 'List %u service that is currently in state PENDING on hosts in the host group "%s"', - 'List %u services which are currently in state PENDING on hosts in the host group "%s"', - array($hostgroup->services_pending, $hostgroup->hostgroup_alias) - ); - echo $stateBadges->render(); - ?> -
-hasMore()): ?> -qlink( - $this->translate('Show More'), - $this->url()->without(array('view', 'limit')), - null, - array( - 'data-base-target' => '_next', - 'class' => 'pull-right action-link' - ) -) ?> + ) + ->add( + StateBadges::STATE_WARNING, + $hostGroup->services_warning_unhandled, + array( + 'service_state' => 1, + 'service_acknowledged' => 0, + 'service_in_downtime' => 0, + 'host_problem' => 0, + 'hostgroup_name' => $hostGroup->hostgroup_name, + 'sort' => 'service_severity' + ), + 'List %u service that is currently in state WARNING on hosts in the host group "%s"', + 'List %u services which are currently in state WARNING on hosts in the host group "%s"', + array($hostGroup->services_warning_unhandled, $hostGroup->hostgroup_alias) + ) + ->add( + StateBadges::STATE_WARNING_HANDLED, + $hostGroup->services_warning_handled, + array( + 'service_state' => 1, + 'service_handled' => 1, + 'hostgroup_name' => $hostGroup->hostgroup_name, + 'sort' => 'service_severity' + ), + 'List %u service that is currently in state WARNING (Acknowledged) on hosts in the host group "%s"', + 'List %u services which are currently in state WARNING (Acknowledged) on hosts in the host group "%s"', + array($hostGroup->services_warning_handled, $hostGroup->hostgroup_alias) + ) + ->add( + StateBadges::STATE_PENDING, + $hostGroup->services_pending, + array( + 'service_state' => 99, + 'hostgroup_name' => $hostGroup->hostgroup_name, + 'sort' => 'service_severity' + ), + 'List %u service that is currently in state PENDING on hosts in the host group "%s"', + 'List %u services which are currently in state PENDING on hosts in the host group "%s"', + array($hostGroup->services_pending, $hostGroup->hostgroup_alias) + ); + echo $stateBadges->render(); + ?> +
+hasMore()): ?> +
From c1dce54b71d86d52d16441020b97b23d33b3b5ac Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 09:49:02 +0200 Subject: [PATCH 16/29] monitoring: Use descriptive variable names in hostsAction() --- .../controllers/ListController.php | 51 ++++++++++++------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 9e8a085cd..5e1e678c5 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -39,10 +39,18 @@ class ListController extends Controller } /** - * Display host list + * List hosts */ public function hostsAction() { + $this->addTitleTab( + 'hosts', + $this->translate('Hosts'), + $this->translate('List hosts') + ); + + $this->setAutorefreshInterval(10); + // Handle soft and hard states if (strtolower($this->params->shift('stateType', 'soft')) === 'hard') { $stateColumn = 'host_hard_state'; @@ -51,9 +59,8 @@ class ListController extends Controller $stateColumn = 'host_state'; $stateChangeColumn = 'host_last_state_change'; } - $this->addTitleTab('hosts', $this->translate('Hosts'), $this->translate('List hosts')); - $this->setAutorefreshInterval(10); - $query = $this->backend->select()->from('hoststatus', array_merge(array( + + $hosts = $this->backend->select()->from('hoststatus', array_merge(array( 'host_icon_image', 'host_icon_image_alt', 'host_name', @@ -71,9 +78,20 @@ class ListController extends Controller 'host_active_checks_enabled', 'host_passive_checks_enabled' ), $this->addColumns())); - $this->applyRestriction('monitoring/filter/objects', $query); - $this->filterQuery($query); - $this->view->hosts = $query; + $this->applyRestriction('monitoring/filter/objects', $hosts); + $this->filterQuery($hosts); + + $this->setupPaginationControl($hosts); + $this->setupLimitControl(); + $this->setupSortControl(array( + 'host_severity' => $this->translate('Severity'), + 'host_state' => $this->translate('Current State'), + 'host_display_name' => $this->translate('Hostname'), + 'host_address' => $this->translate('Address'), + 'host_last_check' => $this->translate('Last Check'), + 'host_last_state_change' => $this->translate('Last State Change') + ), $hosts); + $stats = $this->backend->select()->from('hoststatussummary', array( 'hosts_total', 'hosts_up', @@ -86,20 +104,12 @@ class ListController extends Controller 'hosts_pending', )); $this->applyRestriction('monitoring/filter/objects', $stats); - $this->view->stats = $stats; - $this->setupLimitControl(); - $this->setupPaginationControl($this->view->hosts); - $this->setupSortControl(array( - 'host_severity' => $this->translate('Severity'), - 'host_state' => $this->translate('Current State'), - 'host_display_name' => $this->translate('Hostname'), - 'host_address' => $this->translate('Address'), - 'host_last_check' => $this->translate('Last Check'), - 'host_last_state_change' => $this->translate('Last State Change') - ), $query); - $summary = $query->getQuery()->queryServiceProblemSummary(); + $summary = $hosts->getQuery()->queryServiceProblemSummary(); $this->applyRestriction('monitoring/filter/objects', $summary); + + $this->view->hosts = $hosts; + $this->view->stats = $stats; $this->view->summary = $summary->fetchPairs(); } @@ -468,6 +478,9 @@ class ListController extends Controller ), $query); } + /** + * List host groups + */ public function hostgroupsAction() { $this->addTitleTab( From 107a06df4ea59a541e258391c3e93f2767fc4a01 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 09:49:25 +0200 Subject: [PATCH 17/29] monitoring: Update controls markup in hosts refs #11145 --- .../views/scripts/list/hosts.phtml | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index f5ff2569a..6de773435 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -4,14 +4,12 @@ use Icinga\Module\Monitoring\Object\Host; if (! $this->compact): ?>
tabs ?> -
- render('list/components/hostssummary.phtml') ?> - render('list/components/selectioninfo.phtml') ?> -
-
- sortBox ?> + render('list/components/hostssummary.phtml') ?> + render('list/components/selectioninfo.phtml') ?> + paginator ?> +
limiter ?> - paginator ?> + sortBox ?>
filterEditor ?>
@@ -19,7 +17,7 @@ if (! $this->compact): ?>
hasResult()): ?>

translate('No hosts found matching the filter.') ?>

-
+
compact): ?>
hasMore()): ?> -
+ From 9e4d5387ab2a2cd3f5dc9021a3cac0ddbff304ef Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 09:52:11 +0200 Subject: [PATCH 18/29] monitoring: Use descriptive variable names in notificatiosnAction() --- .../application/controllers/ListController.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 5e1e678c5..7f5201d07 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -257,7 +257,7 @@ class ListController extends Controller } /** - * Display notification overview + * List notifications */ public function notificationsAction() { @@ -266,9 +266,10 @@ class ListController extends Controller $this->translate('Notifications'), $this->translate('List notifications') ); + $this->setAutorefreshInterval(15); - $query = $this->backend->select()->from('notification', array( + $notifications = $this->backend->select()->from('notification', array( 'host_name', 'service_description', 'notification_output', @@ -278,15 +279,16 @@ class ListController extends Controller 'host_display_name', 'service_display_name' )); - $this->applyRestriction('monitoring/filter/objects', $query); - $this->filterQuery($query); - $this->view->notifications = $query; + $this->applyRestriction('monitoring/filter/objects', $notifications); + $this->filterQuery($notifications); + $this->setupPaginationControl($notifications); $this->setupLimitControl(); - $this->setupPaginationControl($this->view->notifications); $this->setupSortControl(array( 'notification_start_time' => $this->translate('Notification Start') - ), $query); + ), $notifications); + + $this->view->notifications = $notifications; } /** From 09892d54901511defef595f33ffdca91f4e7b3c5 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 09:52:54 +0200 Subject: [PATCH 19/29] monitoring: Update controls markup in notifications refs #11145 --- .../application/views/scripts/list/notifications.phtml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/notifications.phtml b/modules/monitoring/application/views/scripts/list/notifications.phtml index 6428055cc..8316665d1 100644 --- a/modules/monitoring/application/views/scripts/list/notifications.phtml +++ b/modules/monitoring/application/views/scripts/list/notifications.phtml @@ -4,11 +4,11 @@ use Icinga\Module\Monitoring\Object\Service; if (! $this->compact): ?>
- -
- sortBox ?> + tabs ?> + paginator ?> +
limiter ?> - paginator ?> + sortBox ?>
filterEditor ?>
@@ -77,7 +77,7 @@ if (! $this->compact): ?> hasMore()): ?> -
+ From f50906dade99f3dd93d13825a045cd8bc49154b6 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 10:05:21 +0200 Subject: [PATCH 23/29] monitoring: Use descriptive variable names in servicesAction() --- .../controllers/ListController.php | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index f6209be15..8e493ed44 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -114,10 +114,16 @@ class ListController extends Controller } /** - * Display service list + * List services */ public function servicesAction() { + $this->addTitleTab( + 'services', + $this->translate('Services'), + $this->translate('List services') + ); + // Handle soft and hard states if (strtolower($this->params->shift('stateType', 'soft')) === 'hard') { $stateColumn = 'service_hard_state'; @@ -127,14 +133,9 @@ class ListController extends Controller $stateChangeColumn = 'service_last_state_change'; } - $this->addTitleTab('services', $this->translate('Services'), $this->translate('List services')); - $this->view->showHost = true; - if (strpos($this->params->get('host_name', '*'), '*') === false) { - $this->view->showHost = false; - } $this->setAutorefreshInterval(10); - $columns = array_merge(array( + $services = $this->backend->select()->from('servicestatus', array_merge(array( 'host_name', 'host_display_name', 'host_state', @@ -157,14 +158,12 @@ class ListController extends Controller 'service_notifications_enabled', 'service_active_checks_enabled', 'service_passive_checks_enabled' - ), $this->addColumns()); - $query = $this->backend->select()->from('servicestatus', $columns); - $this->applyRestriction('monitoring/filter/objects', $query); - $this->filterQuery($query); - $this->view->services = $query; + ), $this->addColumns())); + $this->applyRestriction('monitoring/filter/objects', $services); + $this->filterQuery($services); + $this->setupPaginationControl($services); $this->setupLimitControl(); - $this->setupPaginationControl($this->view->services); $this->setupSortControl(array( 'service_severity' => $this->translate('Service Severity'), 'service_state' => $this->translate('Current Service State'), @@ -176,7 +175,7 @@ class ListController extends Controller 'host_display_name' => $this->translate('Hostname'), 'host_address' => $this->translate('Host Address'), 'host_last_check' => $this->translate('Last Host Check') - ), $query); + ), $services); $stats = $this->backend->select()->from('servicestatussummary', array( 'services_critical', @@ -193,7 +192,14 @@ class ListController extends Controller 'services_warning_unhandled' )); $this->applyRestriction('monitoring/filter/objects', $stats); + + $this->view->services = $services; $this->view->stats = $stats; + if (strpos($this->params->get('host_name', '*'), '*') === false) { + $this->view->showHost = false; + } else { + $this->view->showHost = true; + } } /** From ad6d8dca2ee9f7c6bf79b0cda15a63e13de0db4d Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 10:05:53 +0200 Subject: [PATCH 24/29] monitoring: Update controls markup in services refs #11145 --- .../views/scripts/list/services.phtml | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index 211347f53..d8fd5d4b5 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -5,14 +5,12 @@ use Icinga\Module\Monitoring\Object\Service; if (! $this->compact): ?>
tabs ?> -
- render('list/components/servicesummary.phtml') ?> - render('list/components/selectioninfo.phtml') ?> -
-
- sortBox ?> + render('list/components/servicesummary.phtml') ?> + render('list/components/selectioninfo.phtml') ?> + paginator ?> +
limiter ?> - paginator ?> + sortBox ?>
filterEditor ?>
@@ -101,16 +99,16 @@ if (! $this->compact): ?> hasMore()): ?> -
- qlink( - $this->translate('Show More'), - $this->url()->without(array('view', 'limit')), - null, - array( - 'data-base-target' => '_next', - 'class' => 'action-link' - ) - ) ?> -
+
From 6267001053be4e80eb5540b1cee05f748e1d921e Mon Sep 17 00:00:00 2001 From: Florian Strohmaier Date: Tue, 16 Feb 2016 14:32:38 +0100 Subject: [PATCH 25/29] monitoring: float state-summaries left refs #11145 --- modules/monitoring/public/css/module.less | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/monitoring/public/css/module.less b/modules/monitoring/public/css/module.less index c0c2fb023..87427fe9a 100644 --- a/modules/monitoring/public/css/module.less +++ b/modules/monitoring/public/css/module.less @@ -79,6 +79,11 @@ } } +.controls > .hosts-summary, +.controls > .services-summary { + float: left; +} + // State table in the host and service multi-selection and detail views .host-detail-state, .service-detail-state { From 13f8da254cf4d3b35dabeb39efde064e1a488021 Mon Sep 17 00:00:00 2001 From: Florian Strohmaier Date: Tue, 16 Feb 2016 14:35:00 +0100 Subject: [PATCH 26/29] CSS: Fix controls floating refs #11145 --- public/css/icinga/controls.less | 17 +++++++++++++++++ public/css/icinga/main.less | 3 --- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/public/css/icinga/controls.less b/public/css/icinga/controls.less index a4582a56d..b57293b17 100644 --- a/public/css/icinga/controls.less +++ b/public/css/icinga/controls.less @@ -1,5 +1,14 @@ /*! Icinga Web 2 | (c) 2015 Icinga Development Team | GPLv2+ */ +.filter { + clear: both; +} + +.limiter-control, +.sort-control { + display: inline-block; +} + .limiter-control > .control-group { padding: 0; @@ -19,6 +28,9 @@ } .pagination-control { + clear: both; + float: left; + li { &.active { > a, @@ -78,6 +90,11 @@ } } +.sort-controls-container { + clear: right; + float: right; +} + html.no-js .sort-control form { display: table; margin-left: auto; diff --git a/public/css/icinga/main.less b/public/css/icinga/main.less index 61373e772..402c76f05 100644 --- a/public/css/icinga/main.less +++ b/public/css/icinga/main.less @@ -177,10 +177,8 @@ a:hover > .icon-cancel { width: @name-value-table-name-width; } -// TODO(el): Fix .controls { .limiter-control { - float: right; padding: @vertical-padding / 2 0; margin-bottom: 0.25em; } @@ -191,7 +189,6 @@ a:hover > .icon-cancel { } .sort-control { - float: right; padding: @vertical-padding / 2 0; margin-bottom: 0.25em; margin-left: 0.5em; From 4ea1e054e98f36399cc042f2a552126ab5c69517 Mon Sep 17 00:00:00 2001 From: Florian Strohmaier Date: Tue, 16 Feb 2016 15:59:07 +0100 Subject: [PATCH 27/29] Update user and group list controls markup refs #11145 --- application/views/scripts/group/list.phtml | 14 ++++++-------- application/views/scripts/user/list.phtml | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/application/views/scripts/group/list.phtml b/application/views/scripts/group/list.phtml index cf0645633..b4e27d8a6 100644 --- a/application/views/scripts/group/list.phtml +++ b/application/views/scripts/group/list.phtml @@ -5,16 +5,14 @@ use Icinga\Data\Reducible; if (! $this->compact): ?>
- -
- sortBox ?> + tabs ?> + paginator ?> +
limiter ?> - paginator ?> -
-
- backendSelection; ?> - filterEditor; ?> + sortBox ?>
+ backendSelection ?> + filterEditor ?>
diff --git a/application/views/scripts/user/list.phtml b/application/views/scripts/user/list.phtml index 182e26e87..7e045d8a9 100644 --- a/application/views/scripts/user/list.phtml +++ b/application/views/scripts/user/list.phtml @@ -5,16 +5,14 @@ use Icinga\Data\Reducible; if (! $this->compact): ?>
- -
- sortBox ?> + tabs ?> + paginator ?> +
limiter ?> - paginator ?> -
-
- backendSelection ?> - filterEditor ?> + sortBox ?>
+ backendSelection ?> + filterEditor ?>
From a492839097ee18ee07338effbf7884f60602df13 Mon Sep 17 00:00:00 2001 From: Florian Strohmaier Date: Tue, 16 Feb 2016 15:59:49 +0100 Subject: [PATCH 28/29] CSS: add style for backend-selection refs #11145 --- public/css/icinga/controls.less | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/css/icinga/controls.less b/public/css/icinga/controls.less index b57293b17..325954877 100644 --- a/public/css/icinga/controls.less +++ b/public/css/icinga/controls.less @@ -1,5 +1,9 @@ /*! Icinga Web 2 | (c) 2015 Icinga Development Team | GPLv2+ */ +.backend-selection { + float: left; +} + .filter { clear: both; } From 793acd8475694a0fb23040f14f6f778fffd7f9ce Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 31 Mar 2016 12:38:25 +0200 Subject: [PATCH 29/29] CSS: Move styles related to controls to controls.less refs #11145 --- modules/monitoring/public/css/module.less | 11 ------ public/css/icinga/controls.less | 48 ++++++++++++++++++++--- public/css/icinga/main.less | 32 --------------- 3 files changed, 43 insertions(+), 48 deletions(-) diff --git a/modules/monitoring/public/css/module.less b/modules/monitoring/public/css/module.less index 87427fe9a..2c0fe1a46 100644 --- a/modules/monitoring/public/css/module.less +++ b/modules/monitoring/public/css/module.less @@ -47,17 +47,6 @@ } } -// Multi-selection info -.selection-info { - float: right; - font-size: @font-size-small; - padding: @vertical-padding / 2 0; - - &:hover { - cursor: help; - } -} - // Performance data pie charts .sparkline { height: 1em; diff --git a/public/css/icinga/controls.less b/public/css/icinga/controls.less index 325954877..9bc611dcd 100644 --- a/public/css/icinga/controls.less +++ b/public/css/icinga/controls.less @@ -1,20 +1,34 @@ /*! Icinga Web 2 | (c) 2015 Icinga Development Team | GPLv2+ */ +// TODO(el): Rename .filter to .filter-control + +// Backend selection control in user and group list views .backend-selection { float: left; } -.filter { - clear: both; +.backend-selection, +.pagination-control, +.selection-info, +.sort-controls-container { + margin-bottom: 0.5em; } -.limiter-control, -.sort-control { - display: inline-block; +.backend-selection, +.pagination-control, +.sort-controls-container { + // Select controls may not respect font-size thus leading to improperly vertical alignment w/o big enough line-height + line-height: 2em; +} + +.filter { + // Display filter control on a new line + clear: both; } .limiter-control > .control-group { padding: 0; + // Note that the sort-control form does not have padding as it's utilizing different decorators > .control-label-group { text-align: left; @@ -31,7 +45,14 @@ } } +.limiter-control, +.sort-control { + // Display limiter and sort control both on the same line; floating could be used here too to achieve the same + display: inline-block; +} + .pagination-control { + // Display the pagination-control on a new line clear: both; float: left; @@ -73,7 +94,19 @@ } } +// Multi-selection info +.selection-info { + float: right; + font-size: @font-size-small; + + &:hover { + cursor: help; + } +} + .sort-control { + margin-left: 0.25em; + label { width: auto; margin-right: 0.5em; @@ -99,6 +132,11 @@ float: right; } +.sort-direction-control { + margin-left: 0.25em; + width: 1em; +} + html.no-js .sort-control form { display: table; margin-left: auto; diff --git a/public/css/icinga/main.less b/public/css/icinga/main.less index 402c76f05..fa5066064 100644 --- a/public/css/icinga/main.less +++ b/public/css/icinga/main.less @@ -177,38 +177,6 @@ a:hover > .icon-cancel { width: @name-value-table-name-width; } -.controls { - .limiter-control { - padding: @vertical-padding / 2 0; - margin-bottom: 0.25em; - } - - .pagination-control { - padding: @vertical-padding / 2 0; - margin-bottom: 0.25em; - } - - .sort-control { - padding: @vertical-padding / 2 0; - margin-bottom: 0.25em; - margin-left: 0.5em; - } - - .sort-direction-control { - margin-bottom: 0.5em; - margin-left: 0.5em; - width: 1em; - } - - .filter { - margin-bottom: 0.5em; - } - - .selection-info { - margin-left: 0.5em; - } -} - /* Styles for centering content of unknown width and height both horizontally and vertically * * Example markup: