list/services: Ensure dashboard compliance

refs #7876
This commit is contained in:
Johannes Meyer 2015-04-17 16:12:56 +02:00
parent 74cf3cf375
commit 29648191e4
2 changed files with 20 additions and 36 deletions

View File

@ -205,11 +205,12 @@ class Monitoring_ListController extends Controller
'max_check_attempts' => 'service_max_check_attempts'
), $this->extraColumns());
$query = $this->backend->select()->from('serviceStatus', $columns);
$this->filterQuery($query);
$this->applyRestriction('monitoring/services/filter', $query);
$this->view->services = $query->paginate();
$this->setupLimitControl();
$this->setupPaginationControl($this->view->services);
$this->setupSortControl(array(
'service_severity' => $this->translate('Service Severity'),
'service_state' => $this->translate('Current Service State'),
@ -221,14 +222,6 @@ class Monitoring_ListController extends Controller
'host_address' => $this->translate('Host Address'),
'host_last_check' => $this->translate('Last Host Check')
));
$limit = $this->params->get('limit');
$this->view->limit = $limit;
if ($limit === 0) {
$this->view->services = $query->getQuery()->fetchAll();
} else {
// TODO: Workaround, paginate should be able to fetch limit from new params
$this->view->services = $query->paginate($this->params->get('limit'));
}
$this->view->stats = $this->backend->select()->from('statusSummary', array(
'services_total',
@ -247,7 +240,6 @@ class Monitoring_ListController extends Controller
'services_unknown_handled',
'services_pending',
))->getQuery()->fetchRow();
}
/**

View File

@ -4,41 +4,33 @@ use Icinga\Module\Monitoring\Object\Service;
$selfUrl = 'monitoring/list/services';
if (!$this->compact): ?>
if (! $this->compact): ?>
<div class="controls">
<?= $this->tabs ?>
<div style="margin: 1em;" class="dontprint">
<?= $this->render('list/components/selectioninfo.phtml') ?>
<?= $this->render('list/components/servicesummary.phtml') ?>
<div style="float: right">
<?= $this->translate('Sort by') ?> <?= $this->sortControl ?>
<?= $this->tabs; ?>
<div class="dontprint">
<?= $this->render('list/components/selectioninfo.phtml'); ?>
<?= $this->render('list/components/servicesummary.phtml'); ?>
</div>
<?= $this->sortBox; ?>
<?= $this->limiter; ?>
<?= $this->paginator; ?>
<?= $this->filterEditor; ?>
</div>
</div>
<?php if ($this->limit === 0): ?>
<?= $this->widget('limiter') ?>
<?php else: ?>
<?= $this->widget('limiter')->setCurrentPageCount($this->services->count()) ?>
<?= $this->paginationControl($services, null, null, array('preserve' => $this->preserve)) ?>
<?php endif ?>
</div>
<div class="content">
<?= $this->filterEditor ?>
<?php else: ?>
<?php
<div class="content">
<?php endif ?>
if (count($services) === 0) {
echo $this->translate('No services found matching the filter') . '</div>';
return;
}
?>
<table data-base-target="_next"
class="action multiselect <?php if ($this->compact): ?> compact<?php endif ?>" style="table-layout: auto;"
data-icinga-multiselect-url="<?= $this->href("monitoring/services/show") ?>"
data-icinga-multiselect-data="service_description,host_name">
<tbody>
<?php
if (count($services) === 0) {
echo mt('monitoring', 'No services matching the filter');
}
foreach ($services as $service):
<?php foreach ($services as $service):
$serviceLink = $this->href(
'monitoring/service/show',
array(