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_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')
));
}
/**

View File

@ -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;
}
?>