Skip to content

Commit

Permalink
list/hosts: Ensure dashboard compliance
Browse files Browse the repository at this point in the history
refs #7876
  • Loading branch information
Johannes Meyer committed Apr 17, 2015
1 parent 073dc31 commit 74cf3cf
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 31 deletions.
20 changes: 10 additions & 10 deletions modules/monitoring/application/controllers/ListController.php
Expand Up @@ -117,18 +117,8 @@ public function hostsAction()
'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(
Expand All @@ -142,6 +132,16 @@ public function hostsAction()
'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')
));
}

/**
Expand Down
34 changes: 13 additions & 21 deletions 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;
}
?>
Expand Down

0 comments on commit 74cf3cf

Please sign in to comment.