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; 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 diff --git a/modules/monitoring/application/views/scripts/list/contactgroups.phtml b/modules/monitoring/application/views/scripts/list/contactgroups.phtml index 099db3979..3a1a5bae1 100644 --- a/modules/monitoring/application/views/scripts/list/contactgroups.phtml +++ b/modules/monitoring/application/views/scripts/list/contactgroups.phtml @@ -1,4 +1,6 @@ -<?php if (! $this->compact): ?> +<?php + +if (! $this->compact): ?> <div class="controls"> <?= $this->tabs; ?> <?= $this->sortBox; ?> @@ -9,47 +11,44 @@ <?php endif ?> <div class="content"> <?php - if (count($groupData) === 0) { echo $this->translate('No contactgroups found matching the filter') . '</div>'; return; } ?> - <div class="boxview" data-base-target="_next"> -<?php foreach ($groupData as $groupName => $groupInfo): ?> - <div class="box contactgroup"> - <div class="box header"> - <h2><?= $groupInfo['alias']; ?></h2> -<?php if ($groupInfo['alias'] !== $groupName): ?> - <h2><?= $groupName; ?></h2> -<?php endif ?> - </div> - <div class="box contents"> -<?php foreach ($groupInfo['contacts'] as $c): ?> - <div class="box entry"> - <?= $this->img('static/gravatar', array('email' => $c->contact_email)); ?> - <?= $this->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 - )) - ); ?> - <p> -<?php if ($c->contact_email): ?> - <?= $c->contact_email; ?> -<?php endif; -if ($c->contact_pager): ?> - <br> - <?= $c->contact_pager; ?> -<?php endif ?> - </p> - </div> -<?php endforeach ?> - </div> - </div> -<?php endforeach ?> - </div> + <table class="action action-table listing-table" data-base-target="_next"> + <thead> + <tr> + <th></th> + <th><?= $this->translate('Hostgroup') ?></th> + <th><?= $this->translate('Alias') ?></th> + </tr> + </thead> + <tbody> + + <?php foreach ($groupData as $groupName => $groupInfo): ?> + <tr> + <td class="count-col"> + <span class="badge"><?= count($groupInfo['contacts']) ?></span> + </td> + <td> + <?= $this->qlink( + $groupName, + 'monitoring/list/contacts', + array('contactgroup' => $groupName), + array('title' => sprintf( + $this->translate('Show detailed information about %s'), + $groupName + )) + ) ?> + </td> + <td> + <?php if ($groupInfo['alias'] !== $groupName): ?> + <?= $groupInfo['alias'] ?> + <?php endif ?> + </td> + </tr> + <?php endforeach ?> + </tbody> + </table> </div> diff --git a/modules/monitoring/application/views/scripts/list/contacts.phtml b/modules/monitoring/application/views/scripts/list/contacts.phtml index 4cb32101d..5a365ffa7 100644 --- a/modules/monitoring/application/views/scripts/list/contacts.phtml +++ b/modules/monitoring/application/views/scripts/list/contacts.phtml @@ -7,54 +7,61 @@ <?= $this->filterEditor; ?> </div> <?php endif ?> -<div data-base-target="_next" class="content contacts"> - <?php foreach ($contacts->peekAhead($this->compact) as $contact): ?> - <div class="contact"> - <?= $this->img('static/gravatar', array('email' => $contact->contact_email)); ?> - <strong><?= $this->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 - )) - ); ?></strong> (<?= $contact->contact_alias; ?>) - <div> - <?= $this->translate('Email'); ?>: <a href="mailto:<?= $contact->contact_email; ?>" title="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias); ?>" aria-label="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias); ?>"> + +<div class="content"> +<?php if ($contacts->hasResult()): ?> + <table class="action action-table listing-table" data-base-target="_next"> + <thead> + <tr> + <th><?= $this->translate('Name') ?></th> + <th><?= $this->translate('Email') ?></th> + <th><?= $this->translate('Pager') ?></th> + </tr> + </thead> + <tbody> + <?php foreach ($contacts->peekAhead($this->compact) as $contact): ?> + <tr> + <td> + <?= $this->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') + ); ?> + </td> + <td> + <?= $this->translate('Email') ?>: + <a href="mailto:<?= $contact->contact_email; ?>" + title="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias); ?>" + aria-label="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias); ?>"> <?= $this->escape($contact->contact_email); ?> </a> - </div> - <?php if ($contact->contact_pager): ?> - <div> - <?= $this->translate('Pager') ?>: - <?= $this->escape($contact->contact_pager) ?> - </div> - <?php endif; ?> - <div style="clear: both;"></div> - <div class="notification-periods"> + </td> + <td> + <?php if ($contact->contact_pager): ?> + <?= $this->escape($contact->contact_pager) ?> + <?php endif; ?> + </td> + <?php if ($contact->contact_notify_service_timeperiod): ?> - <div> - <?= $this->translate('Service notification period') ?>: + <td> <?= $this->escape($contact->contact_notify_service_timeperiod) ?> - </div> + </td> <?php endif; ?> + <?php if ($contact->contact_notify_host_timeperiod): ?> - <div> - <?= $this->translate('Host notification period') ?>: + <td> <?= $this->escape($contact->contact_notify_host_timeperiod) ?> - </div> + </td> <?php endif; ?> - </div> - </div> - <?php - endforeach; - if (true): /* The following piece of HTML MUST be nested in <?php */ ?> - <div style="clear: both;"></div> - <?php endif; ?> - <?php if (! $contacts->hasResult()): ?> - <?= $this->translate('No contacts found matching the filter'); ?> - <?php elseif ($contacts->hasMore()): ?> + </tr> + <?php endforeach ?> + </tbody> + </table> + <?php if ($contacts->hasMore()): ?> <?= $this->qlink( $this->translate('Show More'), $this->url()->without(array('view', 'limit')), @@ -65,4 +72,7 @@ ) ); ?> <?php endif ?> -</div> +<?php else: ?> + <?= $this->translate('No contacts found matching the filter'); ?> +<?php endif ?> +</div> \ No newline at end of file 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): ?> <p><?= $this->translate('No service groups found matching the filter.') ?></p> </div> <?php return; endif ?> -<table class="action-tabline listing-table" data-base-target="_next"> +<table class="action-table listing-table" data-base-target="_next"> <thead> <th></th> <th><?= $this->translate('Service Group') ?></th> 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' ); } 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 { 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() { diff --git a/public/css/icinga/forms.less b/public/css/icinga/forms.less index 054b01bc9..26e778563 100644 --- a/public/css/icinga/forms.less +++ b/public/css/icinga/forms.less @@ -14,10 +14,12 @@ 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 { + width: 320px; } form { @@ -37,17 +39,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