diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index ac1d41590..a1e22d442 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -117,18 +117,8 @@ class Monitoring_ListController extends Controller 'host_current_check_attempt', 'host_max_check_attempts' ), $this->extraColumns())); - $this->filterQuery($query); - $this->applyRestriction('monitoring/hosts/filter', $query); - - $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') - )); $this->view->hosts = $query->paginate(); $this->view->stats = $this->backend->select()->from('statusSummary', array( @@ -142,6 +132,16 @@ class Monitoring_ListController extends Controller 'hosts_unreachable_unhandled', 'hosts_pending', ))->getQuery()->fetchRow(); + + $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') + )); } /** diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index a7511fcd8..3efb70320 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -1,33 +1,25 @@ <?php use Icinga\Module\Monitoring\Object\Host; -if ($this->compact): ?> -<div class="content"> -<?php else: ?> +if (! $this->compact): ?> <div class="controls"> - <?= $this->tabs ?> - <div style="margin: 1em;" class="dontprint"> - <?= $this->render('list/components/selectioninfo.phtml') ?> - <?= $this->render('list/components/hostssummary.phtml') ?> - <?= $this->translate('Sort by') ?> <?= $this->sortControl->render($this) ?> + <?= $this->tabs; ?> + <div class="dontprint"> + <?= $this->render('list/components/selectioninfo.phtml'); ?> + <?= $this->render('list/components/hostssummary.phtml'); ?> </div> - -<?= $this->widget('limiter')->setMaxLimit($this->hosts->count()) ?> -<?= $this->paginationControl($hosts, null, null, array('preserve' => $this->preserve)) ?> -<?= $this->selectionToolbar('multi', $this->href('monitoring/hosts/show?' . $this->filter->toQueryString())) ?> + <?= $this->sortBox; ?> + <?= $this->limiter; ?> + <?= $this->paginator; ?> + <?= $this->selectionToolbar('multi', $this->href('monitoring/hosts/show?' . $this->filter->toQueryString())); ?> + <?= $this->filterEditor; ?> </div> - +<?php endif ?> <div class="content"> -<?= $this->filterEditor ?> <?php -endif; - -if ($hosts->count() === 0) { - echo $this->translate('No hosts matching the filter'); - if (! $this->compact) { - echo '</div>'; - } +if (count($hosts) === 0) { + echo $this->translate('No hosts found matching the filter') . '</div>'; return; } ?>