list/hosts: Ensure dashboard compliance

refs #7876
This commit is contained in:
Johannes Meyer 2015-04-17 16:12:35 +02:00
parent 073dc31128
commit 74cf3cf375
2 changed files with 23 additions and 31 deletions

View File

@ -117,18 +117,8 @@ class Monitoring_ListController extends Controller
'host_current_check_attempt', 'host_current_check_attempt',
'host_max_check_attempts' 'host_max_check_attempts'
), $this->extraColumns())); ), $this->extraColumns()));
$this->filterQuery($query); $this->filterQuery($query);
$this->applyRestriction('monitoring/hosts/filter', $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->hosts = $query->paginate();
$this->view->stats = $this->backend->select()->from('statusSummary', array( $this->view->stats = $this->backend->select()->from('statusSummary', array(
@ -142,6 +132,16 @@ class Monitoring_ListController extends Controller
'hosts_unreachable_unhandled', 'hosts_unreachable_unhandled',
'hosts_pending', 'hosts_pending',
))->getQuery()->fetchRow(); ))->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')
));
} }
/** /**

View File

@ -1,33 +1,25 @@
<?php <?php
use Icinga\Module\Monitoring\Object\Host; use Icinga\Module\Monitoring\Object\Host;
if ($this->compact): ?> if (! $this->compact): ?>
<div class="content">
<?php else: ?>
<div class="controls"> <div class="controls">
<?= $this->tabs ?> <?= $this->tabs; ?>
<div style="margin: 1em;" class="dontprint"> <div class="dontprint">
<?= $this->render('list/components/selectioninfo.phtml') ?> <?= $this->render('list/components/selectioninfo.phtml'); ?>
<?= $this->render('list/components/hostssummary.phtml') ?> <?= $this->render('list/components/hostssummary.phtml'); ?>
<?= $this->translate('Sort by') ?> <?= $this->sortControl->render($this) ?>
</div> </div>
<?= $this->sortBox; ?>
<?= $this->widget('limiter')->setMaxLimit($this->hosts->count()) ?> <?= $this->limiter; ?>
<?= $this->paginationControl($hosts, null, null, array('preserve' => $this->preserve)) ?> <?= $this->paginator; ?>
<?= $this->selectionToolbar('multi', $this->href('monitoring/hosts/show?' . $this->filter->toQueryString())) ?> <?= $this->selectionToolbar('multi', $this->href('monitoring/hosts/show?' . $this->filter->toQueryString())); ?>
<?= $this->filterEditor; ?>
</div> </div>
<?php endif ?>
<div class="content"> <div class="content">
<?= $this->filterEditor ?>
<?php <?php
endif; if (count($hosts) === 0) {
echo $this->translate('No hosts found matching the filter') . '</div>';
if ($hosts->count() === 0) {
echo $this->translate('No hosts matching the filter');
if (! $this->compact) {
echo '</div>';
}
return; return;
} }
?> ?>