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:
parent
10d1520711
commit
86f70e0a4f
|
@ -168,8 +168,14 @@ class Monitoring_ListController extends Controller
|
||||||
'host_address' => 'Host Address',
|
'host_address' => 'Host Address',
|
||||||
'host_last_check' => 'Last Host Check'
|
'host_last_check' => 'Last Host Check'
|
||||||
));
|
));
|
||||||
// TODO: Workaround, paginate should be able to fetch limit from new params
|
$limit = $this->params->get('limit');
|
||||||
$this->view->services = $query->paginate($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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,9 +10,12 @@ if (!$this->compact): ?>
|
||||||
<?= $this->filterPreview ?>
|
<?= $this->filterPreview ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
|
<?php if ($this->limit): ?>
|
||||||
<?= $this->widget('limiter')->setCurrentPageCount($this->services->count()) ?>
|
<?= $this->widget('limiter')->setCurrentPageCount($this->services->count()) ?>
|
||||||
<?= $this->paginationControl($services, null, null, array('preserve' => $this->preserve)) ?>
|
<?= $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())) ?>
|
<?= $this->selectionToolbar('multi', $this->href('monitoring/multi/service?' . $this->filter->toQueryString())) ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue