From 8cf3b99335fe138db262dfcf3b1adb72339383de Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 6 Aug 2015 10:23:44 +0200 Subject: [PATCH] Eventhistory Overview: Remove pagination and provide a load more link instead refs #8615 --- .../controllers/ListController.php | 1 - .../views/scripts/list/eventhistory.phtml | 33 ++++++++++++++++--- public/css/icinga/pagination.less | 7 +++- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 3625043a6..7c749a2a3 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -576,7 +576,6 @@ class Monitoring_ListController extends Controller $this->view->history = $query; $this->setupLimitControl(); - $this->setupPaginationControl($this->view->history); $this->setupSortControl(array( 'timestamp' => $this->translate('Occurence') ), $query); diff --git a/modules/monitoring/application/views/scripts/list/eventhistory.phtml b/modules/monitoring/application/views/scripts/list/eventhistory.phtml index 47375c054..e01528583 100644 --- a/modules/monitoring/application/views/scripts/list/eventhistory.phtml +++ b/modules/monitoring/application/views/scripts/list/eventhistory.phtml @@ -2,21 +2,29 @@ use Icinga\Module\Monitoring\Object\Host; use Icinga\Module\Monitoring\Object\Service; -$history->peekAhead($this->compact); +$url = $this->url(); +$limit = (int) $url->getParam('limit', 25); +if (! $url->hasParam('page') || ($page = (int) $url->getParam('page')) < 1) { + $page = 1; +} + +$history->limit($limit * $page); if (! $this->compact): ?>
tabs; ?> sortBox; ?> limiter; ?> - paginator; ?> + + translate('Scroll to the bottom of this page to load additional events'); ?> + filterEditor; ?>
- + peekAhead() as $event): ?> output; @@ -71,6 +79,9 @@ if (! $this->compact): ?> ?>
+ getIteratorPosition() % $limit === 0): ?> + + escape($title); ?>
timeAgo($event->timestamp, $this->compact); ?> @@ -95,14 +106,28 @@ if (! $this->compact): ?> hasResult()): ?> translate('No history events found matching the filter'); ?> hasMore()): ?> + compact): ?> qlink( $this->translate('Show More'), - $this->url()->without(array('view', 'limit')), + $url->without(array('view', 'limit')), null, array( 'data-base-target' => '_next', 'class' => 'pull-right show-more' ) ); ?> + + qlink( + $this->translate('Load More'), + $url->setAnchor('page-' . ($page + 1)), + array( + 'page' => $page + 1, + ), + array( + 'name' => 'load-more', + 'class' => 'pull-right load-more' + ) + ); ?> + diff --git a/public/css/icinga/pagination.less b/public/css/icinga/pagination.less index b7dc6c606..a3a74c47c 100644 --- a/public/css/icinga/pagination.less +++ b/public/css/icinga/pagination.less @@ -62,7 +62,12 @@ ul.pagination { cursor: default; } -a.show-more { +a.show-more, a.load-more { display: block; margin: 0.5em; +} + +a.load-more-hint { + display: inline-block; + margin-left: 1em; } \ No newline at end of file