Merge branch 'bugfix/pagination-floating-11145'

fixes #11145
This commit is contained in:
Eric Lippmann 2016-03-31 12:43:34 +02:00
commit f8891a96ce
19 changed files with 819 additions and 810 deletions

View File

@ -5,16 +5,14 @@ use Icinga\Data\Reducible;
if (! $this->compact): ?>
<div class="controls separated">
<?= $tabs; ?>
<div class="grid">
<?= $this->sortBox ?>
<?= $this->tabs ?>
<?= $this->paginator ?>
<div class="sort-controls-container">
<?= $this->limiter ?>
<?= $this->paginator ?>
</div>
<div>
<?= $this->backendSelection; ?>
<?= $this->filterEditor; ?>
<?= $this->sortBox ?>
</div>
<?= $this->backendSelection ?>
<?= $this->filterEditor ?>
</div>
<?php endif ?>
<div class="content">

View File

@ -5,16 +5,14 @@ use Icinga\Data\Reducible;
if (! $this->compact): ?>
<div class="controls separated">
<?= $tabs ?>
<div class="grid">
<?= $this->sortBox ?>
<?= $this->tabs ?>
<?= $this->paginator ?>
<div class="sort-controls-container">
<?= $this->limiter ?>
<?= $this->paginator ?>
</div>
<div>
<?= $this->backendSelection ?>
<?= $this->filterEditor ?>
<?= $this->sortBox ?>
</div>
<?= $this->backendSelection ?>
<?= $this->filterEditor ?>
</div>
<?php endif ?>
<div class="content">

View File

@ -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,28 +104,26 @@ 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();
}
/**
* 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';
@ -117,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',
@ -147,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'),
@ -166,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',
@ -183,18 +192,30 @@ 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;
}
}
/**
* 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 +236,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 +252,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();
@ -242,7 +263,7 @@ class ListController extends Controller
}
/**
* Display notification overview
* List notifications
*/
public function notificationsAction()
{
@ -251,9 +272,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',
@ -263,22 +285,30 @@ 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;
}
/**
* 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 +316,19 @@ 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);
'contact_pager' => $this->translate('Pager Address / Number')
), $contacts);
$this->view->contacts = $contacts;
}
public function eventgridAction()
@ -342,6 +371,9 @@ class ListController extends Controller
$this->view->orientation = $orientation;
}
/**
* List contact groups
*/
public function contactgroupsAction()
{
$this->addTitleTab(
@ -350,47 +382,38 @@ 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;
}
/**
* 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 +427,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,15 +440,20 @@ 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();
}
}
/**
* List service groups
*/
public function servicegroupsAction()
{
$this->addTitleTab(
@ -434,9 +461,10 @@ class ListController extends Controller
$this->translate('Service Groups'),
$this->translate('List service groups')
);
$this->setAutorefreshInterval(12);
$query = $this->backend->select()->from('servicegroupsummary', array(
$serviceGroups = $this->backend->select()->from('servicegroupsummary', array(
'servicegroup_alias',
'servicegroup_name',
'services_critical_handled',
@ -449,25 +477,34 @@ class ListController extends Controller
'services_warning_handled',
'services_warning_unhandled'
));
$this->applyRestriction('monitoring/filter/objects', $query);
$this->filterQuery($query);
$this->view->servicegroups = $query;
$this->applyRestriction('monitoring/filter/objects', $serviceGroups);
$this->filterQuery($serviceGroups);
$this->setupPaginationControl($serviceGroups);
$this->setupLimitControl();
$this->setupPaginationControl($this->view->servicegroups);
$this->setupSortControl(array(
'services_severity' => $this->translate('Severity'),
'servicegroup_alias' => $this->translate('Service Group Name'),
'services_total' => $this->translate('Total Services')
), $query);
), $serviceGroups);
$this->view->serviceGroups = $serviceGroups;
}
/**
* List host groups
*/
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',
@ -487,18 +524,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()

View File

@ -1,11 +1,11 @@
<?php if (! $this->compact): ?>
<div class="controls">
<?= $tabs ?>
<?= $this->tabs ?>
<?= $this->render('list/components/selectioninfo.phtml') ?>
<div class="grid">
<?= $this->sortBox ?>
<?= $this->paginator ?>
<div class="sort-controls-container">
<?= $this->limiter ?>
<?= $this->paginator ?>
<?= $this->sortBox ?>
</div>
<?= $this->filterEditor ?>
</div>

View File

@ -2,52 +2,49 @@
if (! $this->compact): ?>
<div class="controls">
<?= $tabs ?>
<div class="grid">
<?= $this->sortBox ?>
<?= $this->tabs ?>
<?= $this->paginator ?>
<div class="sort-controls-container">
<?= $this->limiter ?>
<?= $this->paginator ?>
<?= $this->sortBox ?>
</div>
<?= $this->filterEditor ?>
</div>
<?php endif ?>
<div class="content">
<?php
if (count($groupData) === 0) {
echo $this->translate('No contactgroups found matching the filter') . '</div>';
return;
}
?>
<table class="action table-row-selectable common-table" data-base-target="_next">
<?php if (! $contactGroups->hasResult()): ?>
<p><?= $this->translate('No contact groups found matching the filter') ?></p>
</div>
<?php return; endif ?>
<table class="common-table table-row-selectable" data-base-target="_next">
<thead>
<tr>
<th></th>
<th><?= $this->translate('Contact Group ') ?></th>
<th><?= $this->translate('Alias') ?></th>
</tr>
<tr>
<th></th>
<th><?= $this->translate('Contact Group ') ?></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>
<?php foreach ($contactGroups as $contactGroup): ?>
<tr>
<td class="count-col">
<span class="badge"><?= $contactGroup->contact_count ?></span>
</td>
<td>
<?= $this->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
))
) ?>
</td>
<td>
<?= $this->qlink(
$groupName,
'monitoring/list/contacts',
array('contactgroup_name' => $groupName),
array('title' => sprintf(
$this->translate('Show detailed information about %s'),
$groupName
))
) ?>
</td>
<td>
<?php if ($groupInfo['alias'] !== $groupName): ?>
<?= $groupInfo['alias'] ?>
<?php endif ?>
<?php if ($contactGroup->contactgroup_name !== $contactGroup->contactgroup_alias): ?>
<?= $contactGroup->contactgroup_alias ?>
<?php endif ?>
</td>
</tr>
<?php endforeach ?>

View File

@ -1,79 +1,83 @@
<?php if (! $this->compact): ?>
<div class="controls">
<?= $tabs ?>
<div class="grid">
<?= $this->sortBox ?>
<?= $this->tabs ?>
<?= $this->paginator ?>
<div class="sort-controls-container">
<?= $this->limiter ?>
<?= $this->paginator ?>
<?= $this->sortBox ?>
</div>
<?= $this->filterEditor ?>
</div>
<?php endif ?>
<div class="content">
<?php if ($contacts->hasResult()): ?>
<table class="action table-row-selectable common-table" data-base-target="_next">
<thead>
<?php if (! $contacts->hasResult()): ?>
<p><?= $this->translate('No contacts found matching the filter') ?></p>
</div>
<?php return; endif ?>
<table class="common-table table-row-selectable" 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(
</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>
<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>
</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>
<?php if ($contact->contact_pager): ?>
<?= $this->escape($contact->contact_pager) ?>
<?php endif ?>
</td>
<td>
<?php if ($contact->contact_pager): ?>
<?= $this->escape($contact->contact_pager) ?>
<?php endif; ?>
</td>
<?php if ($contact->contact_notify_service_timeperiod): ?>
<td>
<?= $this->escape($contact->contact_notify_service_timeperiod) ?>
</td>
<?php endif; ?>
<?php if ($contact->contact_notify_service_timeperiod): ?>
<td>
<?= $this->escape($contact->contact_notify_service_timeperiod) ?>
</td>
<?php endif ?>
<?php if ($contact->contact_notify_host_timeperiod): ?>
<td>
<?= $this->escape($contact->contact_notify_host_timeperiod) ?>
</td>
<?php endif; ?>
</tr>
<?php endforeach ?>
</tbody>
<?php if ($contact->contact_notify_host_timeperiod): ?>
<td>
<?= $this->escape($contact->contact_notify_host_timeperiod) ?>
</td>
<?php endif ?>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if ($contacts->hasMore()): ?>
<?php if ($contacts->hasMore()): ?>
<div class="action-links">
<?= $this->qlink(
$this->translate('Show More'),
$this->url()->without(array('view', 'limit')),
null,
array(
'data-base-target' => '_next',
'class' => 'pull-right action-link'
'class' => 'action-link',
'data-base-target' => '_next'
)
); ?>
<?php endif ?>
<?php else: ?>
<?= $this->translate('No contacts found matching the filter'); ?>
) ?>
</div>
<?php endif ?>
</div>

View File

@ -3,51 +3,56 @@ use Icinga\Module\Monitoring\Object\Host;
use Icinga\Module\Monitoring\Object\Service;
if (! $this->compact): ?>
<div class="controls separated">
<?= $tabs ?>
<div class="controls">
<?= $this->tabs ?>
<?= $this->render('list/components/selectioninfo.phtml') ?>
<div class="grid">
<?= $this->sortBox ?>
<?= $this->paginator ?>
<div class="sort-controls-container">
<?= $this->limiter ?>
<?= $this->paginator ?>
<?= $this->sortBox ?>
</div>
<?= $this->filterEditor ?>
</div>
<?php endif ?>
<div class="content">
<table data-base-target="_next"
class="table-row-selectable state-table multiselect common-table"
data-icinga-multiselect-url="<?= $this->href('monitoring/downtimes/show'); ?>"
data-icinga-multiselect-controllers="<?= $this->href("monitoring/downtimes") ?>"
data-icinga-multiselect-data="downtime_id">
<?php if (! $downtimes->hasResult()): ?>
<p><?= $this->translate('No downtimes found matching the filter.') ?></p>
</div>
<?php return; endif ?>
<table class="common-table state-table table-row-selectable multiselect"
data-base-target="_next"
data-icinga-multiselect-url="<?= $this->href('monitoring/downtimes/show') ?>"
data-icinga-multiselect-controllers="<?= $this->href("monitoring/downtimes") ?>"
data-icinga-multiselect-data="downtime_id">
<tbody>
<?php foreach ($downtimes->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;
?>
<tr href="<?= $this->href('monitoring/downtime/show', array('downtime_id' => $downtime->id)) ?>">
<?= $this->render('partials/downtime/downtime-header.phtml'); ?>
</tr>
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;
?>
<tr href="<?= $this->href('monitoring/downtime/show', array('downtime_id' => $downtime->id)) ?>">
<?= $this->render('partials/downtime/downtime-header.phtml') ?>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if (! $downtimes->hasResult()): ?>
<?= $this->translate('No downtimes found matching the filter, maybe the downtime already expired.'); ?>
<?php elseif ($downtimes->hasMore()): ?>
<?= $this->qlink(
$this->translate('Show More'),
$this->url()->without(array('view', 'limit')),
null,
array(
'data-base-target' => '_next',
'class' => 'pull-right action-link'
)
); ?>
</table>
<?php if ($downtimes->hasMore()): ?>
<div class="action-links">
<?= $this->qlink(
$this->translate('Show More'),
$this->url()->without(array('view', 'limit')),
null,
array(
'class' => 'action-link',
'data-base-target' => '_next'
)
) ?>
</div>
<?php endif ?>
</div>

View File

@ -4,12 +4,8 @@ use Icinga\Web\Widget\Chart\HistoryColorGrid;
if (! $this->compact): ?>
<div class="controls">
<?= $this->tabs; ?>
<?= $this->sortBox; ?>
<?= $this->limiter; ?>
<?= $this->paginator; ?>
<?= $this->filterEditor; ?>
<?= $form; ?>
<?= $this->tabs ?>
<?= $this->form ?>
</div>
<?php endif ?>
<div class="content" data-base-target="_next">

View File

@ -3,11 +3,11 @@
if (! $this->compact): ?>
<div class="controls">
<?= $this->tabs ?>
<div class="grid">
<?= $this->sortBox ?>
<div class="sort-controls-container">
<?= $this->limiter ?>
<?= $this->filterEditor ?>
<?= $this->sortBox ?>
</div>
<?= $this->filterEditor ?>
</div>
<?php endif ?>
<?= $this->partial(

View File

@ -1,278 +1,280 @@
<?php
use Icinga\Module\Monitoring\Web\Widget\StateBadges;
/** @var \Icinga\Module\Monitoring\DataView\Hostgroup $hostgroups */
if (! $this->compact): ?>
<div class="controls">
<?= $tabs ?>
<div class="grid">
<?= $this->sortBox ?>
<?= $this->tabs ?>
<?= $this->paginator ?>
<div class="sort-controls-container">
<?= $this->limiter ?>
<?= $this->paginator ?>
<?= $this->sortBox ?>
</div>
<?= $this->filterEditor ?>
</div>
<?php endif ?>
<div class="content">
<?php if (! $hostgroups->hasResult()): ?>
<?php /** @var \Icinga\Module\Monitoring\DataView\Hostgroup $hostGroups */ if (! $hostGroups->hasResult()): ?>
<p><?= $this->translate('No host groups found matching the filter.') ?></p>
</div>
<?php return; endif ?>
<table class="table-row-selectable common-table" data-base-target="_next">
<thead>
<tr>
<th></th>
<th><?= $this->translate('Host Group') ?></th>
<th><?= $this->translate('Host States') ?></th>
<th></th>
<th><?= $this->translate('Service States') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($hostgroups->peekAhead($this->compact) as $hostgroup): ?>
<tr>
<td class="count-col">
<span class="badge"><?= $hostgroup->hosts_total ?></span>
</td>
<th>
<?= $this->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
))
) ?>
</th>
<td>
<?php
$stateBadges = new StateBadges();
$stateBadges
->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();
?>
</td>
<td class="count-col">
<?= $this->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')
) ?>
</td>
<td>
<?php
$stateBadges = new StateBadges();
$stateBadges
->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)
<table class="common-table table-row-selectable" data-base-target="_next">
<thead>
<tr>
<th></th>
<th><?= $this->translate('Host Group') ?></th>
<th><?= $this->translate('Host States') ?></th>
<th></th>
<th><?= $this->translate('Service States') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($hostGroups->peekAhead($this->compact) as $hostGroup): ?>
<tr>
<td class="count-col">
<span class="badge"><?= $hostGroup->hosts_total ?></span>
</td>
<th>
<?= $this->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
))
) ?>
</th>
<td>
<?php
$stateBadges = new StateBadges();
$stateBadges
->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();
?>
</td>
<td class="count-col">
<?= $this->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')
) ?>
</td>
<td>
<?php
$stateBadges = new StateBadges();
$stateBadges
->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();
?>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if ($hostgroups->hasMore()): ?>
<?= $this->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();
?>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if ($hostGroups->hasMore()): ?>
<div class="action-links">
<?= $this->qlink(
$this->translate('Show More'),
$this->url()->without(array('view', 'limit')),
null,
array(
'class' => 'action-link',
'data-base-target' => '_next'
)
) ?>
</div>
<?php endif ?>
</div>

View File

@ -4,14 +4,12 @@ use Icinga\Module\Monitoring\Object\Host;
if (! $this->compact): ?>
<div class="controls">
<?= $this->tabs ?>
<div class="grid">
<?= $this->render('list/components/hostssummary.phtml') ?>
<?= $this->render('list/components/selectioninfo.phtml') ?>
</div>
<div class="grid">
<?= $this->sortBox ?>
<?= $this->render('list/components/hostssummary.phtml') ?>
<?= $this->render('list/components/selectioninfo.phtml') ?>
<?= $this->paginator ?>
<div class="sort-controls-container">
<?= $this->limiter ?>
<?= $this->paginator ?>
<?= $this->sortBox ?>
</div>
<?= $this->filterEditor ?>
</div>
@ -19,7 +17,7 @@ if (! $this->compact): ?>
<div class="content">
<?php if (! $hosts->hasResult()): ?>
<p><?= $this->translate('No hosts found matching the filter.') ?></p>
</div>
</div>
<?php return; endif ?>
<table data-base-target="_next"
class="table-row-selectable state-table multiselect"
@ -96,14 +94,14 @@ if (! $this->compact): ?>
</tbody>
</table>
<?php if ($hosts->hasMore()): ?>
<div class="text-right">
<div class="action-links">
<?= $this->qlink(
$this->translate('Show More'),
$this->url()->without(array('view', 'limit')),
null,
array(
'data-base-target' => '_next',
'class' => 'action-link'
'class' => 'action-link',
'data-base-target' => '_next'
)
) ?>
</div>

View File

@ -4,11 +4,11 @@ use Icinga\Module\Monitoring\Object\Service;
if (! $this->compact): ?>
<div class="controls">
<?= $tabs ?>
<div class="grid">
<?= $this->sortBox ?>
<?= $this->tabs ?>
<?= $this->paginator ?>
<div class="sort-controls-container">
<?= $this->limiter ?>
<?= $this->paginator ?>
<?= $this->sortBox ?>
</div>
<?= $this->filterEditor ?>
</div>
@ -77,7 +77,7 @@ if (! $this->compact): ?>
</tbody>
</table>
<?php if ($notifications->hasMore()): ?>
<div class="text-right">
<div class="action-links">
<?= $this->qlink(
$this->translate('Show More'),
$this->url(isset($notificationsUrl) ? $notificationsUrl : null)->without(array('view', 'limit')),

View File

@ -2,173 +2,175 @@
if (! $this->compact): ?>
<div class="controls">
<?= $tabs ?>
<div class="grid">
<?= $this->sortBox ?>
<?= $this->tabs ?>
<?= $this->paginator ?>
<div class="sort-controls-container">
<?= $this->limiter ?>
<?= $this->paginator ?>
<?= $this->sortBox ?>
</div>
<?= $this->filterEditor ?>
</div>
<?php endif ?>
<div class="content">
<?php if (! $servicegroups->hasResult()): ?>
<?php if (! $serviceGroups->hasResult()): ?>
<p><?= $this->translate('No service groups found matching the filter.') ?></p>
</div>
<?php return; endif ?>
<table class="table-row-selectable common-table" data-base-target="_next">
<thead>
<tr>
<th></th>
<th><?= $this->translate('Service Group') ?></th>
<th><?= $this->translate('Service States') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($servicegroups->peekAhead($this->compact) as $serviceGroup): ?>
<tr>
<td class="count-col">
<span class="badge"><?= $serviceGroup->services_total ?></span>
</td>
<th>
<?= $this->qlink(
$serviceGroup->servicegroup_alias,
'monitoring/list/services',
array('servicegroup_name' => $serviceGroup->servicegroup_name),
array('title' => sprintf($this->translate('List all services in the group "%s"'), $serviceGroup->servicegroup_alias))
) ?>
</th>
<td>
<?php
$stateBadges = new StateBadges();
$stateBadges
->setUrl('monitoring/list/services')
->setBaseFilter($this->filterEditor->getFilter())
->add(
StateBadges::STATE_OK,
$serviceGroup->services_ok,
array(
'service_state' => 0,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currently in state OK in service group "%s"',
'List %s services which are currently in state OK in service group "%s"',
array($serviceGroup->services_ok, $serviceGroup->servicegroup_alias)
)
->add(
StateBadges::STATE_CRITICAL,
$serviceGroup->services_critical_unhandled,
array(
'service_state' => 2,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currently in state CRITICAL in service group "%s"',
'List %s services which are currently in state CRITICAL in service group "%s"',
array($serviceGroup->services_critical_unhandled, $serviceGroup->servicegroup_alias)
)
->add(
StateBadges::STATE_CRITICAL_HANDLED,
$serviceGroup->services_critical_handled,
array(
'service_state' => 2,
'service_handled' => 1,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currently in state CRITICAL (Acknowledged) in service group "%s"',
'List %s services which are currently in state CRITICAL (Acknowledged) in service group "%s"',
array($serviceGroup->services_critical_unhandled, $serviceGroup->servicegroup_alias)
)
->add(
StateBadges::STATE_UNKNOWN,
$serviceGroup->services_unknown_unhandled,
array(
'service_state' => 3,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currently in state UNKNOWN in service group "%s"',
'List %s services which are currently in state UNKNOWN in service group "%s"',
array($serviceGroup->services_unknown_unhandled, $serviceGroup->servicegroup_alias)
)
->add(
StateBadges::STATE_UNKNOWN_HANDLED,
$serviceGroup->services_unknown_handled,
array(
'service_state' => 3,
'service_handled' => 1,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currently in state UNKNOWN (Acknowledged) in service group "%s"',
'List %s services which are currently in state UNKNOWN (Acknowledged) in service group "%s"',
array($serviceGroup->services_unknown_handled, $serviceGroup->servicegroup_alias)
<table class="table-row-selectable common-table" data-base-target="_next">
<thead>
<tr>
<th></th>
<th><?= $this->translate('Service Group') ?></th>
<th><?= $this->translate('Service States') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($serviceGroups->peekAhead($this->compact) as $serviceGroup): ?>
<tr>
<td class="count-col">
<span class="badge"><?= $serviceGroup->services_total ?></span>
</td>
<th>
<?= $this->qlink(
$serviceGroup->servicegroup_alias,
'monitoring/list/services',
array('servicegroup_name' => $serviceGroup->servicegroup_name),
array('title' => sprintf($this->translate('List all services in the group "%s"'), $serviceGroup->servicegroup_alias))
) ?>
</th>
<td>
<?php
$stateBadges = new StateBadges();
$stateBadges
->setUrl('monitoring/list/services')
->setBaseFilter($this->filterEditor->getFilter())
->add(
StateBadges::STATE_OK,
$serviceGroup->services_ok,
array(
'service_state' => 0,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currently in state OK in service group "%s"',
'List %s services which are currently in state OK in service group "%s"',
array($serviceGroup->services_ok, $serviceGroup->servicegroup_alias)
)
->add(
StateBadges::STATE_CRITICAL,
$serviceGroup->services_critical_unhandled,
array(
'service_state' => 2,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currently in state CRITICAL in service group "%s"',
'List %s services which are currently in state CRITICAL in service group "%s"',
array($serviceGroup->services_critical_unhandled, $serviceGroup->servicegroup_alias)
)
->add(
StateBadges::STATE_CRITICAL_HANDLED,
$serviceGroup->services_critical_handled,
array(
'service_state' => 2,
'service_handled' => 1,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currently in state CRITICAL (Acknowledged) in service group "%s"',
'List %s services which are currently in state CRITICAL (Acknowledged) in service group "%s"',
array($serviceGroup->services_critical_unhandled, $serviceGroup->servicegroup_alias)
)
->add(
StateBadges::STATE_UNKNOWN,
$serviceGroup->services_unknown_unhandled,
array(
'service_state' => 3,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currently in state UNKNOWN in service group "%s"',
'List %s services which are currently in state UNKNOWN in service group "%s"',
array($serviceGroup->services_unknown_unhandled, $serviceGroup->servicegroup_alias)
)
->add(
StateBadges::STATE_UNKNOWN_HANDLED,
$serviceGroup->services_unknown_handled,
array(
'service_state' => 3,
'service_handled' => 1,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currently in state UNKNOWN (Acknowledged) in service group "%s"',
'List %s services which are currently in state UNKNOWN (Acknowledged) in service group "%s"',
array($serviceGroup->services_unknown_handled, $serviceGroup->servicegroup_alias)
)
->add(
StateBadges::STATE_WARNING,
$serviceGroup->services_warning_unhandled,
array(
'service_state' => 1,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currently in state WARNING in service group "%s"',
'List %s services which are currently in state WARNING in service group "%s"',
array($serviceGroup->services_warning_unhandled, $serviceGroup->servicegroup_alias)
)
->add(
StateBadges::STATE_WARNING_HANDLED,
$serviceGroup->services_warning_handled,
array(
'service_state' => 1,
'service_handled' => 1,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currently in state WARNING (Acknowledged) in service group "%s"',
'List %s services which are currently in state WARNING (Acknowledged) in service group "%s"',
array($serviceGroup->services_warning_handled, $serviceGroup->servicegroup_alias)
)
->add(
StateBadges::STATE_PENDING,
$serviceGroup->services_pending,
array(
'service_state' => 99,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currenlty in state PENDING in service group "%s"',
'List %s services which are currently in state PENDING in service group "%s"',
array($serviceGroup->services_pending, $serviceGroup->servicegroup_alias)
);
echo $stateBadges->render();
?>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if ($servicegroups->hasMore()): ?>
<?= $this->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,
$serviceGroup->services_warning_unhandled,
array(
'service_state' => 1,
'service_acknowledged' => 0,
'service_in_downtime' => 0,
'host_problem' => 0,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currently in state WARNING in service group "%s"',
'List %s services which are currently in state WARNING in service group "%s"',
array($serviceGroup->services_warning_unhandled, $serviceGroup->servicegroup_alias)
)
->add(
StateBadges::STATE_WARNING_HANDLED,
$serviceGroup->services_warning_handled,
array(
'service_state' => 1,
'service_handled' => 1,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currently in state WARNING (Acknowledged) in service group "%s"',
'List %s services which are currently in state WARNING (Acknowledged) in service group "%s"',
array($serviceGroup->services_warning_handled, $serviceGroup->servicegroup_alias)
)
->add(
StateBadges::STATE_PENDING,
$serviceGroup->services_pending,
array(
'service_state' => 99,
'servicegroup_name' => $serviceGroup->servicegroup_name,
'sort' => 'service_severity'
),
'List %s service that is currenlty in state PENDING in service group "%s"',
'List %s services which are currently in state PENDING in service group "%s"',
array($serviceGroup->services_pending, $serviceGroup->servicegroup_alias)
);
echo $stateBadges->render();
?>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if ($serviceGroups->hasMore()): ?>
<div class="action-links">
<?= $this->qlink(
$this->translate('Show More'),
$this->url()->without(array('view', 'limit')),
null,
array(
'class' => 'action-link',
'data-base-target' => '_next'
)
) ?>
</div>
<?php endif ?>
</div>

View File

@ -5,14 +5,12 @@ use Icinga\Module\Monitoring\Object\Service;
if (! $this->compact): ?>
<div class="controls">
<?= $this->tabs ?>
<div class="grid">
<?= $this->render('list/components/servicesummary.phtml') ?>
<?= $this->render('list/components/selectioninfo.phtml') ?>
</div>
<div class="grid">
<?= $this->sortBox ?>
<?= $this->render('list/components/servicesummary.phtml') ?>
<?= $this->render('list/components/selectioninfo.phtml') ?>
<?= $this->paginator ?>
<div class="sort-controls-container">
<?= $this->limiter ?>
<?= $this->paginator ?>
<?= $this->sortBox ?>
</div>
<?= $this->filterEditor ?>
</div>
@ -101,16 +99,16 @@ if (! $this->compact): ?>
</tbody>
</table>
<?php if ($services->hasMore()): ?>
<div class="text-right">
<?= $this->qlink(
$this->translate('Show More'),
$this->url()->without(array('view', 'limit')),
null,
array(
'data-base-target' => '_next',
'class' => 'action-link'
)
) ?>
</div>
<div class="action-links">
<?= $this->qlink(
$this->translate('Show More'),
$this->url()->without(array('view', 'limit')),
null,
array(
'class' => 'action-link',
'data-base-target' => '_next'
)
) ?>
</div>
<?php endif ?>
</div>

View File

@ -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()
);
}

View File

@ -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'
);

View File

@ -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;
@ -79,6 +68,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 {

View File

@ -1,7 +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;
}
.backend-selection,
.pagination-control,
.selection-info,
.sort-controls-container {
margin-bottom: 0.5em;
}
.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;
@ -18,7 +45,17 @@
}
}
.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;
li {
&.active {
> a,
@ -57,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;
@ -78,6 +127,16 @@
}
}
.sort-controls-container {
clear: right;
float: right;
}
.sort-direction-control {
margin-left: 0.25em;
width: 1em;
}
html.no-js .sort-control form {
display: table;
margin-left: auto;

View File

@ -177,41 +177,6 @@ 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;
}
.pagination-control {
padding: @vertical-padding / 2 0;
margin-bottom: 0.25em;
}
.sort-control {
float: right;
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: