From 27e16118314f53b2aff63f29ad4b64efdb9d9448 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 28 Sep 2015 18:28:46 +0200 Subject: [PATCH 01/10] Navigation: Change Config/Application tabs refs #5543 --- application/controllers/ConfigController.php | 7 +++++-- .../controllers/UsergroupbackendController.php | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php index 5a33f9792..3df16630b 100644 --- a/application/controllers/ConfigController.php +++ b/application/controllers/ConfigController.php @@ -55,13 +55,13 @@ class ConfigController extends Controller $tabs = $this->getTabs(); $tabs->add('userbackend', array( 'title' => $this->translate('Configure how users authenticate with and log into Icinga Web 2'), - 'label' => $this->translate('User Backends'), + 'label' => $this->translate('Authentication'), 'url' => 'config/userbackend', 'baseTarget' => '_main' )); $tabs->add('usergroupbackend', array( 'title' => $this->translate('Configure how users are associated with groups by Icinga Web 2'), - 'label' => $this->translate('User Group Backends'), + 'label' => $this->translate('User Groups'), 'url' => 'usergroupbackend/list', 'baseTarget' => '_main' )); @@ -95,6 +95,7 @@ class ConfigController extends Controller $this->view->form = $form; $this->createApplicationTabs()->activate('general'); + $this->createAuthenticationTabs(); } /** @@ -199,6 +200,7 @@ class ConfigController extends Controller $form->handleRequest(); $this->view->form = $form; + $this->createApplicationTabs(); $this->createAuthenticationTabs()->activate('userbackend'); $this->render('userbackend/reorder'); } @@ -337,6 +339,7 @@ class ConfigController extends Controller $this->assertPermission('config/application/resources'); $this->view->resources = Config::app('resources', true); $this->createApplicationTabs()->activate('resource'); + $this->createAuthenticationTabs(); } /** diff --git a/application/controllers/UsergroupbackendController.php b/application/controllers/UsergroupbackendController.php index 112a244c1..b2fb1d960 100644 --- a/application/controllers/UsergroupbackendController.php +++ b/application/controllers/UsergroupbackendController.php @@ -154,14 +154,26 @@ class UsergroupbackendController extends Controller protected function createListTabs() { $tabs = $this->getTabs(); + $tabs->add('general', array( + 'title' => $this->translate('Adjust the general configuration of Icinga Web 2'), + 'label' => $this->translate('General'), + 'url' => 'config/general', + 'baseTarget' => '_main' + )); + $tabs->add('resource', array( + 'title' => $this->translate('Configure which resources are being utilized by Icinga Web 2'), + 'label' => $this->translate('Resources'), + 'url' => 'config/resource', + 'baseTarget' => '_main' + )); $tabs->add('userbackend', array( 'title' => $this->translate('Configure how users authenticate with and log into Icinga Web 2'), - 'label' => $this->translate('User Backends'), + 'label' => $this->translate('Authentication'), 'url' => 'config/userbackend' )); $tabs->add('usergroupbackend', array( 'title' => $this->translate('Configure how users are associated with groups by Icinga Web 2'), - 'label' => $this->translate('User Group Backends'), + 'label' => $this->translate('User Groups'), 'url' => 'usergroupbackend/list' )); return $tabs; From 65a2b539f1cc888d3a28b8c5e9ba06801e0cad34 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Mon, 28 Sep 2015 19:16:13 +0200 Subject: [PATCH 02/10] Allow filtering for contactgroups in contact list refs #5543 --- .../Backend/Ido/Query/ContactQuery.php | 25 +++++++++++++++++++ .../library/Monitoring/DataView/Contact.php | 5 +++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ContactQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ContactQuery.php index bd156e176..4926a3fd3 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ContactQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ContactQuery.php @@ -20,6 +20,11 @@ class ContactQuery extends IdoQuery 'instances' => array( 'instance_name' => 'i.instance_name' ), + 'contactgroups' => array( + 'contactgroup' => 'cgo.name1 COLLATE latin1_general_ci', + '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', @@ -186,6 +191,26 @@ class ContactQuery extends IdoQuery ); } + /** + * Join contacts + */ + protected function joinContactgroups() + { + $this->select->joinLeft( + array('cgm' => $this->prefix . 'contactgroup_members'), + 'co.object_id = cgm.contact_object_id', + array() + )->joinLeft( + array('cg' => $this->prefix . 'contactgroups'), + 'cgm.contactgroup_id = cg.contactgroup_id', + array() + )->joinLeft( + array('cgo' => $this->prefix . 'objects'), + 'cg.contactgroup_object_id = cgo.object_id AND cgo.is_active = 1 AND cgo.objecttype_id = 11', + array() + ); + } + /** * Join instances */ diff --git a/modules/monitoring/library/Monitoring/DataView/Contact.php b/modules/monitoring/library/Monitoring/DataView/Contact.php index 5add208cd..64500f9a9 100644 --- a/modules/monitoring/library/Monitoring/DataView/Contact.php +++ b/modules/monitoring/library/Monitoring/DataView/Contact.php @@ -33,7 +33,10 @@ class Contact extends DataView 'contact_notify_host_flapping', 'contact_notify_host_downtime', 'contact_notify_host_timeperiod', - 'contact_notify_service_timeperiod' + 'contact_notify_service_timeperiod', + 'contactgroup', + 'contactgroup_name', + 'contactgroup_alias' ); } From b1c48c02cfd2649608eb1ada7eedbbd5859e7f14 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 29 Sep 2015 10:23:33 +0200 Subject: [PATCH 03/10] CSS: Style blockquote refs #5543 --- public/css/icinga/base.less | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/public/css/icinga/base.less b/public/css/icinga/base.less index a0987aeea..f86aaa69a 100644 --- a/public/css/icinga/base.less +++ b/public/css/icinga/base.less @@ -25,6 +25,15 @@ a { } } +blockquote { + border-left: 6px solid @gray-light; + color: @text-color-light; + // Reset default margin + margin: 0; + font-family: @font-family-fixed; + padding: @vertical-padding @horizontal-padding; +} + body { background-color: @body-bg-color; color: @text-color; @@ -35,14 +44,14 @@ body { h1 { font-size: 18px; - line-height: 22px; font-weight: normal; + line-height: 22px; } h2 { font-size: 16px; - line-height: 19px; font-weight: normal; + line-height: 19px; } p { From 2b0e8803be1c4ee87607f36463b1e8a2dce8173f Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 29 Sep 2015 10:23:49 +0200 Subject: [PATCH 04/10] CSS: Use color: inherit for *-default mixins refs #5543 --- public/css/icinga/colors.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/css/icinga/colors.less b/public/css/icinga/colors.less index c79b3e2ad..f8fe951ec 100644 --- a/public/css/icinga/colors.less +++ b/public/css/icinga/colors.less @@ -1,7 +1,7 @@ /*! Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */ .bg-color-default() { - background-color: @body-bg-color; + background-color: inherit; } .bg-color-ok, @@ -89,7 +89,7 @@ } .fg-color-default { - color: @text-color; + color: inherit; } .fg-color-inverted() { From 818115a7db22332d7b3eabd3d2efd2791b1786af Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 29 Sep 2015 10:33:43 +0200 Subject: [PATCH 05/10] CSS: Set form label and input width refs #5543 --- public/css/icinga/forms.less | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public/css/icinga/forms.less b/public/css/icinga/forms.less index 054b01bc9..a3f4364e8 100644 --- a/public/css/icinga/forms.less +++ b/public/css/icinga/forms.less @@ -20,6 +20,10 @@ input.search { background-position: 0em; } +input, select, textarea { + width: 320px; +} + form { // Disable icons for the moment i { @@ -37,17 +41,13 @@ form { display: inline-block; padding-right: @horizontal-padding; text-align: right; - width: 240px; + width: 160px; } .control-group { padding: @vertical-padding @horizontal-padding; } -select { - display: table-cell; -} - button.link, input[type="submit"].link { // Reset defaults From 8f33fca3d45146ae63a52792478e3105648d37b1 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 29 Sep 2015 10:36:21 +0200 Subject: [PATCH 06/10] CSS: Optimize background property for input.search refs #5543 --- public/css/icinga/forms.less | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/public/css/icinga/forms.less b/public/css/icinga/forms.less index a3f4364e8..26e778563 100644 --- a/public/css/icinga/forms.less +++ b/public/css/icinga/forms.less @@ -14,10 +14,8 @@ input { input.search { padding-left: 20px; - background-image: url('../img/icons/search.png'); + background: url('../img/icons/search.png') no-repeat 0; background-size: 12px 12px; - background-repeat: no-repeat; - background-position: 0em; } input, select, textarea { From f23aebaf95875d766b3331dac547af599177ee66 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Tue, 29 Sep 2015 10:37:32 +0200 Subject: [PATCH 07/10] Turn contact and contactgroup view into list refs #5543 --- .../views/scripts/list/contactgroups.phtml | 78 +++++++------ .../views/scripts/list/contacts.phtml | 110 ++++++++++-------- 2 files changed, 100 insertions(+), 88 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/contactgroups.phtml b/modules/monitoring/application/views/scripts/list/contactgroups.phtml index 099db3979..6176feea8 100644 --- a/modules/monitoring/application/views/scripts/list/contactgroups.phtml +++ b/modules/monitoring/application/views/scripts/list/contactgroups.phtml @@ -1,4 +1,7 @@ -compact): ?> +compact): ?>
tabs; ?> sortBox; ?> @@ -15,41 +18,40 @@ if (count($groupData) === 0) { return; } ?> -
- $groupInfo): ?> -
-
-

- -

- -
-
- -
- img('static/gravatar', array('email' => $c->contact_email)); ?> - qlink( - $c->contact_alias, - 'monitoring/show/contact', - array('contact_name' => $c->contact_name), - array('title' => sprintf( - $this->translate('Show detailed information about %s'), - $c->contact_alias - )) - ); ?> -

-contact_email): ?> - contact_email; ?> -contact_pager): ?> -
- contact_pager; ?> - -

-
- -
-
- -
+ + + + + + + + + + + + $groupInfo): ?> + + + + + + + +
translate('Hostgroup') ?>translate('Alias') ?>
+ + + qlink( + $groupName, + 'monitoring/list/contacts', + array('contactgroup' => $groupName), + array('title' => sprintf( + $this->translate('Show detailed information about %s'), + $groupName + )) + ); ?> + + + + +
diff --git a/modules/monitoring/application/views/scripts/list/contacts.phtml b/modules/monitoring/application/views/scripts/list/contacts.phtml index 4cb32101d..851a53980 100644 --- a/modules/monitoring/application/views/scripts/list/contacts.phtml +++ b/modules/monitoring/application/views/scripts/list/contacts.phtml @@ -7,62 +7,72 @@ filterEditor; ?> -
+ + + + + + + + + + peekAhead($this->compact) as $contact): ?> -
- img('static/gravatar', array('email' => $contact->contact_email)); ?> - qlink( +
+ + + + + contact_notify_service_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( $this->translate('Show detailed information about %s'), $contact->contact_alias - )) - ); ?> (contact_alias; ?>) -
- translate('Email'); ?>: - escape($contact->contact_email); ?> - -
+ ), 'class' => 'rowaction') + ); ?> +
+ translate('Email'); ?>: + + escape($contact->contact_email); ?> + + contact_pager): ?> -
- translate('Pager') ?>: - escape($contact->contact_pager) ?> -
+
+ escape($contact->contact_pager) ?> +
-
-
- contact_notify_service_timeperiod): ?> -
- translate('Service notification period') ?>: - escape($contact->contact_notify_service_timeperiod) ?> -
- - contact_notify_host_timeperiod): ?> -
- translate('Host notification period') ?>: - escape($contact->contact_notify_host_timeperiod) ?> -
- -
- - -
- - hasResult()): ?> - translate('No contacts found matching the filter'); ?> - hasMore()): ?> - qlink( - $this->translate('Show More'), - $this->url()->without(array('view', 'limit')), - null, - array( - 'data-base-target' => '_next', - 'class' => 'pull-right show-more' - ) - ); ?> - - +
+ escape($contact->contact_notify_service_timeperiod) ?> + + escape($contact->contact_notify_host_timeperiod) ?> +
+ +hasResult()): ?> + translate('No contacts found matching the filter'); ?> +hasMore()): ?> + qlink( + $this->translate('Show More'), + $this->url()->without(array('view', 'limit')), + null, + array( + 'data-base-target' => '_next', + 'class' => 'pull-right show-more' + ) + ); ?> + + From b7121c538452fa3baf733d0d75bb0cf17b29a186 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Tue, 29 Sep 2015 10:37:56 +0200 Subject: [PATCH 08/10] Do not display the wrong amount of users for empty groups refs #5543 --- modules/monitoring/application/controllers/ListController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 487d9b2b2..adbe78678 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -388,7 +388,9 @@ class ListController extends Controller 'contacts' => array() ); } - $groupData[$c->contactgroup_name]['contacts'][] = $c; + if (isset ($c->contact_name)) { + $groupData[$c->contactgroup_name]['contacts'][] = $c; + } } // TODO: Find a better naming From a0b9a06461683b5a96c42b57a6ea71621a64a176 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 29 Sep 2015 10:44:19 +0200 Subject: [PATCH 09/10] monitoring/CSS: Fix action-table class in the service groups overview refs #5543 --- .../application/views/scripts/list/servicegroups.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/application/views/scripts/list/servicegroups.phtml b/modules/monitoring/application/views/scripts/list/servicegroups.phtml index 865bc27dd..a8082cf50 100644 --- a/modules/monitoring/application/views/scripts/list/servicegroups.phtml +++ b/modules/monitoring/application/views/scripts/list/servicegroups.phtml @@ -14,7 +14,7 @@ if (! $this->compact): ?>

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

- +
From 77f5203bbf284bf1296968de42ed9e21453e50b3 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Tue, 29 Sep 2015 11:12:45 +0200 Subject: [PATCH 10/10] Do not display table when there are no results and fix code style refs #5543 --- .../views/scripts/list/contactgroups.phtml | 71 +++++----- .../views/scripts/list/contacts.phtml | 126 +++++++++--------- 2 files changed, 97 insertions(+), 100 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/contactgroups.phtml b/modules/monitoring/application/views/scripts/list/contactgroups.phtml index 6176feea8..3a1a5bae1 100644 --- a/modules/monitoring/application/views/scripts/list/contactgroups.phtml +++ b/modules/monitoring/application/views/scripts/list/contactgroups.phtml @@ -1,5 +1,4 @@ compact): ?>
@@ -12,46 +11,44 @@ if (! $this->compact): ?>
translate('No contactgroups found matching the filter') . '
'; return; } ?> +
translate('Service Group') ?>
+ + + + + + + + -
translate('Hostgroup') ?>translate('Alias') ?>
- - - - - - - - - - $groupInfo): ?> - - - - - - - -
translate('Hostgroup') ?>translate('Alias') ?>
- - - qlink( - $groupName, - 'monitoring/list/contacts', - array('contactgroup' => $groupName), - array('title' => sprintf( - $this->translate('Show detailed information about %s'), - $groupName - )) - ); ?> - - - - -
+ $groupInfo): ?> + + + + + + qlink( + $groupName, + 'monitoring/list/contacts', + array('contactgroup' => $groupName), + array('title' => sprintf( + $this->translate('Show detailed information about %s'), + $groupName + )) + ) ?> + + + + + + + + + + diff --git a/modules/monitoring/application/views/scripts/list/contacts.phtml b/modules/monitoring/application/views/scripts/list/contacts.phtml index 851a53980..5a365ffa7 100644 --- a/modules/monitoring/application/views/scripts/list/contacts.phtml +++ b/modules/monitoring/application/views/scripts/list/contacts.phtml @@ -8,71 +8,71 @@ - - - - - - - - - - peekAhead($this->compact) as $contact): ?> +
+hasResult()): ?> +
translate('Name') ?>translate('Email') ?>translate('Pager') ?>
+ - - - - - contact_notify_service_timeperiod): ?> - - - - contact_notify_host_timeperiod): ?> - - + + + - - -
- 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); ?> - - - contact_pager): ?> -
- escape($contact->contact_pager) ?> -
- -
- escape($contact->contact_notify_service_timeperiod) ?> - - escape($contact->contact_notify_host_timeperiod) ?> - translate('Name') ?>translate('Email') ?>translate('Pager') ?>
+ + + peekAhead($this->compact) as $contact): ?> + + + 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); ?> + + + + contact_pager): ?> + escape($contact->contact_pager) ?> + + -hasResult()): ?> + contact_notify_service_timeperiod): ?> + + escape($contact->contact_notify_service_timeperiod) ?> + + + + contact_notify_host_timeperiod): ?> + + escape($contact->contact_notify_host_timeperiod) ?> + + + + + + + hasMore()): ?> + qlink( + $this->translate('Show More'), + $this->url()->without(array('view', 'limit')), + null, + array( + 'data-base-target' => '_next', + 'class' => 'pull-right show-more' + ) + ); ?> + + translate('No contacts found matching the filter'); ?> -hasMore()): ?> - qlink( - $this->translate('Show More'), - $this->url()->without(array('view', 'limit')), - null, - array( - 'data-base-target' => '_next', - 'class' => 'pull-right show-more' - ) - ); ?> - + \ No newline at end of file