list/services: don't count with no limit

This is a performance evaluation right now, we might delegate such
logic to paginator later on. Cuts load time for lists and/or dashlets
with complicated filters by 50% - only for those with limit=0 of course.
This commit is contained in:
Thomas Gelf 2014-06-25 20:45:08 +02:00
parent 10d1520711
commit 86f70e0a4f
2 changed files with 12 additions and 3 deletions

View File

@ -168,8 +168,14 @@ class Monitoring_ListController extends Controller
'host_address' => 'Host Address',
'host_last_check' => 'Last Host Check'
));
// TODO: Workaround, paginate should be able to fetch limit from new params
$this->view->services = $query->paginate($this->params->get('limit'));
$limit = $this->params->get('limit');
$this->view->limit = $limit;
if ($limit) {
// TODO: Workaround, paginate should be able to fetch limit from new params
$this->view->services = $query->paginate($this->params->get('limit'));
} else {
$this->view->services = $query->getQuery()->fetchAll();
}
}
/**

View File

@ -10,9 +10,12 @@ if (!$this->compact): ?>
<?= $this->filterPreview ?>
<?php endif ?>
</div>
<?php if ($this->limit): ?>
<?= $this->widget('limiter')->setCurrentPageCount($this->services->count()) ?>
<?= $this->paginationControl($services, null, null, array('preserve' => $this->preserve)) ?>
<?php else: ?>
<?= $this->widget('limiter') ?>
<?php endif ?>
<?= $this->selectionToolbar('multi', $this->href('monitoring/multi/service?' . $this->filter->toQueryString())) ?>
</div>