From 86f70e0a4f6644bd5b2ef425c21099a261291fb7 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 25 Jun 2014 20:45:08 +0200 Subject: [PATCH] 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. --- .../application/controllers/ListController.php | 10 ++++++++-- .../application/views/scripts/list/services.phtml | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index cba841db0..8f939bf91 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -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(); + } } /** diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index a8a8429fb..75258c9db 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -10,9 +10,12 @@ if (!$this->compact): ?> filterPreview ?> - +limit): ?> widget('limiter')->setCurrentPageCount($this->services->count()) ?> paginationControl($services, null, null, array('preserve' => $this->preserve)) ?> + +widget('limiter') ?> + selectionToolbar('multi', $this->href('monitoring/multi/service?' . $this->filter->toQueryString())) ?>