From a0d5509f191ef79094b3841b8927ab249528efda Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 5 Aug 2015 10:54:14 +0200 Subject: [PATCH 01/14] DbQuery: Drop attribute $maxCount It's not used anywhere and completely useless the way it's implemented. --- library/Icinga/Data/Db/DbQuery.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/library/Icinga/Data/Db/DbQuery.php b/library/Icinga/Data/Db/DbQuery.php index 8bf57867e..b3f53cb1b 100644 --- a/library/Icinga/Data/Db/DbQuery.php +++ b/library/Icinga/Data/Db/DbQuery.php @@ -47,16 +47,6 @@ class DbQuery extends SimpleQuery */ protected $useSubqueryCount = false; - /** - * Set the count maximum - * - * If the count maximum is set, count queries will not count more than that many rows. You should set this - * property only for really heavy queries. - * - * @var int - */ - protected $maxCount; - /** * Count query result * @@ -339,9 +329,6 @@ class DbQuery extends SimpleQuery $columns = array('cnt' => 'COUNT(*)'); return $this->db->select()->from($count, $columns); } - if ($this->maxCount !== null) { - return $this->db->select()->from($count->limit($this->maxCount)); - } $count->columns(array('cnt' => 'COUNT(*)')); return $count; From c891b9d3564b71aad9cc96c1f8183f6767dfc01d Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 6 Aug 2015 07:54:03 +0200 Subject: [PATCH 02/14] HostgroupsummaryQuery: Fix group statement ambiguity --- .../Monitoring/Backend/Ido/Query/HostgroupsummaryQuery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/HostgroupsummaryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/HostgroupsummaryQuery.php index b35f50a19..ce5e0f85b 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/HostgroupsummaryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/HostgroupsummaryQuery.php @@ -115,7 +115,7 @@ class HostgroupsummaryQuery extends IdoQuery $this->subQueries[] = $services; $this->summaryQuery = $this->db->select()->union(array($hosts, $services), Zend_Db_Select::SQL_UNION_ALL); $this->select->from(array('statussummary' => $this->summaryQuery), array()); - $this->group(array('hostgroup_name', 'hostgroup_alias')); + $this->group(array('statussummary.hostgroup_name', 'statussummary.hostgroup_alias')); $this->joinedVirtualTables['hoststatussummary'] = true; } From 7662545c2a325fb86fa56ded9211a94d99cc07d2 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 6 Aug 2015 09:39:23 +0200 Subject: [PATCH 03/14] SimpleQuery: Provide a getter for the current iterator position refs #8615 --- library/Icinga/Data/SimpleQuery.php | 10 ++++++++++ library/Icinga/Repository/RepositoryQuery.php | 10 ++++++++++ .../library/Monitoring/DataView/DataView.php | 10 ++++++++++ 3 files changed, 30 insertions(+) diff --git a/library/Icinga/Data/SimpleQuery.php b/library/Icinga/Data/SimpleQuery.php index 2dcecfc9c..ecfaa3aaa 100644 --- a/library/Icinga/Data/SimpleQuery.php +++ b/library/Icinga/Data/SimpleQuery.php @@ -143,6 +143,16 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator return $this->ds; } + /** + * Return the current position of this query's iterator + * + * @return int + */ + public function getIteratorPosition() + { + return $this->iteratorPosition; + } + /** * Start or rewind the iteration */ diff --git a/library/Icinga/Repository/RepositoryQuery.php b/library/Icinga/Repository/RepositoryQuery.php index c975654db..98ed6e81f 100644 --- a/library/Icinga/Repository/RepositoryQuery.php +++ b/library/Icinga/Repository/RepositoryQuery.php @@ -605,6 +605,16 @@ class RepositoryQuery implements QueryInterface, SortRules, Iterator return $this->query->count(); } + /** + * Return the current position of this query's iterator + * + * @return int + */ + public function getIteratorPosition() + { + return $this->query->getIteratorPosition(); + } + /** * Start or rewind the iteration */ diff --git a/modules/monitoring/library/Monitoring/DataView/DataView.php b/modules/monitoring/library/Monitoring/DataView/DataView.php index 11543351c..31ca426d5 100644 --- a/modules/monitoring/library/Monitoring/DataView/DataView.php +++ b/modules/monitoring/library/Monitoring/DataView/DataView.php @@ -69,6 +69,16 @@ abstract class DataView implements QueryInterface, SortRules, IteratorAggregate return $this->getQuery(); } + /** + * Return the current position of the result set's iterator + * + * @return int + */ + public function getIteratorPosition() + { + return $this->query->getIteratorPosition(); + } + /** * Get the query name this data view relies on * From 8cf3b99335fe138db262dfcf3b1adb72339383de Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 6 Aug 2015 10:23:44 +0200 Subject: [PATCH 04/14] 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 From 5ccd4a9ef8084d6e47d0d99f587da78a9e8c5155 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 6 Aug 2015 10:24:56 +0200 Subject: [PATCH 05/14] js: Do not handle anchor jumps, the browser is able to do it by itself refs #8615 --- public/js/icinga/events.js | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index e29b7d0e7..368ef6931 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -322,21 +322,6 @@ return false; }, - /** - * Handle anchor, i.e. focus the element which is referenced by the anchor - * - * @param {string} query jQuery selector - */ - handleAnchor: function(query) { - var $element = $(query); - if ($element.length > 0) { - if (typeof $element.attr('tabindex') === 'undefined') { - $element.attr('tabindex', -1); - } - $element.focus(); - } - }, - /** * Someone clicked a link or tr[href] */ @@ -397,17 +382,15 @@ return; } + // This is an anchor only + if (href.substr(0, 1) === '#' && href.length > 1 && href.substr(1, 1) !== '!') { + return; + } + // Handle all other links as XHR requests event.stopPropagation(); event.preventDefault(); - // This is an anchor only - if (href.substr(0, 1) === '#' && href.length > 1 - && href.substr(1, 1) !== '!') { - self.handleAnchor(href); - return; - } - // activate spinner indicator if ($a.hasClass('spinner')) { $a.addClass('active'); From de24f5f4b67e5e2ef5dc2108543c51e96d2d4776 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 6 Aug 2015 10:57:41 +0200 Subject: [PATCH 06/14] Revert "js: Do not handle anchor jumps, the browser is able to do it by itself" This reverts commit 5ccd4a9ef8084d6e47d0d99f587da78a9e8c5155. refs #8615 --- public/js/icinga/events.js | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index 368ef6931..e29b7d0e7 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -322,6 +322,21 @@ return false; }, + /** + * Handle anchor, i.e. focus the element which is referenced by the anchor + * + * @param {string} query jQuery selector + */ + handleAnchor: function(query) { + var $element = $(query); + if ($element.length > 0) { + if (typeof $element.attr('tabindex') === 'undefined') { + $element.attr('tabindex', -1); + } + $element.focus(); + } + }, + /** * Someone clicked a link or tr[href] */ @@ -382,15 +397,17 @@ return; } - // This is an anchor only - if (href.substr(0, 1) === '#' && href.length > 1 && href.substr(1, 1) !== '!') { - return; - } - // Handle all other links as XHR requests event.stopPropagation(); event.preventDefault(); + // This is an anchor only + if (href.substr(0, 1) === '#' && href.length > 1 + && href.substr(1, 1) !== '!') { + self.handleAnchor(href); + return; + } + // activate spinner indicator if ($a.hasClass('spinner')) { $a.addClass('active'); From 5c80486b23e7097f72cf07df163062c59e5139e2 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 6 Aug 2015 10:58:15 +0200 Subject: [PATCH 07/14] js: Properly handle anchor tags with names refs #8615 --- public/js/icinga/events.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index e29b7d0e7..1d9680ea0 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -325,11 +325,18 @@ /** * Handle anchor, i.e. focus the element which is referenced by the anchor * - * @param {string} query jQuery selector + * @param {string} element The name or id of the element to focus */ - handleAnchor: function(query) { - var $element = $(query); - if ($element.length > 0) { + handleAnchor: function(element) { + var $element = $('#' + element); + if (! $element.length) { + // The name attribute is actually deprecated, on anchor tags, + // but we'll possibly handle links from another source + // (module etc) so that's used as a fallback + $element = $('[name="' + element + '"]'); + } + + if ($element.length) { if (typeof $element.attr('tabindex') === 'undefined') { $element.attr('tabindex', -1); } @@ -404,7 +411,7 @@ // This is an anchor only if (href.substr(0, 1) === '#' && href.length > 1 && href.substr(1, 1) !== '!') { - self.handleAnchor(href); + self.handleAnchor(href.substr(1)); return; } From bdc61a5f628ce6e8e647d440edc7fe914b0cec8a Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 6 Aug 2015 11:49:16 +0200 Subject: [PATCH 08/14] js: Introduce new function ui.focusElement() refs #8615 --- public/js/icinga/ui.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/public/js/icinga/ui.js b/public/js/icinga/ui.js index 4ab802ca7..897a82d06 100644 --- a/public/js/icinga/ui.js +++ b/public/js/icinga/ui.js @@ -122,6 +122,40 @@ return this; }, + /** + * Focus the given element and scroll to its position + * + * @param {string} element The name or id of the element to focus + * @param {object} $container Optional, the container containing the element + */ + focusElement: function(element, $container) { + var $element = $('#' + element); + + if (! $element.length) { + // The name attribute is actually deprecated, on anchor tags, + // but we'll possibly handle links from another source + // (module etc) so that's used as a fallback + $element = $('[name="' + element.replace(/'/, '\\\'') + '"]'); + } + + if ($element.length) { + if (typeof $element.attr('tabindex') === 'undefined') { + $element.attr('tabindex', -1); + } + + if (typeof $container === 'undefined') { + $container = $element.closest('.container'); + } + + $element.focus(); + + if ($container.length) { + $container.scrollTop(0); + $container.scrollTop($element.first().position().top); + } + } + }, + moveToLeft: function () { var col2 = this.cutContainer($('#col2')); var kill = this.cutContainer($('#col1')); From 153f3ba2f95af858e3427aa74a010ba5785389aa Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 6 Aug 2015 11:51:57 +0200 Subject: [PATCH 09/14] js: Drop function events.handleAnchor() and ui.scrollContainerToAnchor() There is ui.focusElement() now which handles ids as well. refs #8615 --- public/js/icinga/events.js | 26 ++------------------------ public/js/icinga/loader.js | 2 +- public/js/icinga/ui.js | 12 ------------ 3 files changed, 3 insertions(+), 37 deletions(-) diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index 1d9680ea0..c74c9e97a 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -322,28 +322,6 @@ return false; }, - /** - * Handle anchor, i.e. focus the element which is referenced by the anchor - * - * @param {string} element The name or id of the element to focus - */ - handleAnchor: function(element) { - var $element = $('#' + element); - if (! $element.length) { - // The name attribute is actually deprecated, on anchor tags, - // but we'll possibly handle links from another source - // (module etc) so that's used as a fallback - $element = $('[name="' + element + '"]'); - } - - if ($element.length) { - if (typeof $element.attr('tabindex') === 'undefined') { - $element.attr('tabindex', -1); - } - $element.focus(); - } - }, - /** * Someone clicked a link or tr[href] */ @@ -411,7 +389,7 @@ // This is an anchor only if (href.substr(0, 1) === '#' && href.length > 1 && href.substr(1, 1) !== '!') { - self.handleAnchor(href.substr(1)); + icinga.ui.focusElement(href.substr(1)); return; } @@ -441,7 +419,7 @@ formerUrl = $target.data('icingaUrl'); if (typeof formerUrl !== 'undefined' && formerUrl.split(/#/)[0] === href.split(/#/)[0]) { - icinga.ui.scrollContainerToAnchor($target, href.split(/#/)[1]); + icinga.ui.focusElement(href.split(/#/)[1], $target); $target.data('icingaUrl', href); if (formerUrl !== href) { icinga.history.pushCurrentState(); diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js index 32722cb6b..56e2f8532 100644 --- a/public/js/icinga/loader.js +++ b/public/js/icinga/loader.js @@ -560,7 +560,7 @@ oldNotifications.appendTo($('#notifications')); } if (url.match(/#/)) { - this.icinga.ui.scrollContainerToAnchor(req.$target, url.split(/#/)[1]); + this.icinga.ui.focusElement(url.split(/#/)[1], req.$target); } if (newBody) { this.icinga.ui.fixDebugVisibility().triggerWindowResize(); diff --git a/public/js/icinga/ui.js b/public/js/icinga/ui.js index 897a82d06..b9cff23fd 100644 --- a/public/js/icinga/ui.js +++ b/public/js/icinga/ui.js @@ -193,18 +193,6 @@ $col.data('icingaModule', backup['data']['data-icinga-module']); }, - scrollContainerToAnchor: function ($container, anchorName) { - // TODO: Generic issue -> we probably should escape attribute value selectors!? - var $anchor = $("a[name='" + anchorName.replace(/'/, '\\\'') + "']", $container); - if ($anchor.length) { - $container.scrollTop(0); - $container.scrollTop($anchor.first().position().top); - this.icinga.logger.debug('Scrolling ', $container, ' to ', anchorName); - } else { - this.icinga.logger.info('Anchor "' + anchorName + '" not found in ', $container); - } - }, - triggerWindowResize: function () { this.onWindowResize({data: {self: this}}); }, From ea3e0bc013e62874ad5017e4ba74be453f0dfede Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 6 Aug 2015 11:52:35 +0200 Subject: [PATCH 10/14] Eventhistory Overview: Use id attribues as the name attribute is deprecated refs #8615 --- .../application/views/scripts/list/eventhistory.phtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/eventhistory.phtml b/modules/monitoring/application/views/scripts/list/eventhistory.phtml index e01528583..c414c859c 100644 --- a/modules/monitoring/application/views/scripts/list/eventhistory.phtml +++ b/modules/monitoring/application/views/scripts/list/eventhistory.phtml @@ -80,7 +80,7 @@ if (! $this->compact): ?>
getIteratorPosition() % $limit === 0): ?> - + escape($title); ?>
@@ -124,7 +124,7 @@ if (! $this->compact): ?> 'page' => $page + 1, ), array( - 'name' => 'load-more', + 'id' => 'load-more', 'class' => 'pull-right load-more' ) ); ?> From b9e0a80479c8ee368242f5fad78560300a56c0b7 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 6 Aug 2015 12:50:17 +0200 Subject: [PATCH 11/14] EventHistory Overview: Show the load more link as button and centered refs #8615 --- .../application/views/scripts/list/eventhistory.phtml | 6 +++--- public/css/icinga/pagination.less | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/eventhistory.phtml b/modules/monitoring/application/views/scripts/list/eventhistory.phtml index c414c859c..8cf9dadb9 100644 --- a/modules/monitoring/application/views/scripts/list/eventhistory.phtml +++ b/modules/monitoring/application/views/scripts/list/eventhistory.phtml @@ -117,7 +117,7 @@ if (! $this->compact): ?> ) ); ?> - qlink( +
qlink( $this->translate('Load More'), $url->setAnchor('page-' . ($page + 1)), array( @@ -125,9 +125,9 @@ if (! $this->compact): ?> ), array( 'id' => 'load-more', - 'class' => 'pull-right load-more' + 'class' => 'pull-right load-more button-like' ) - ); ?> + ); ?>
diff --git a/public/css/icinga/pagination.less b/public/css/icinga/pagination.less index a3a74c47c..35e0e7edd 100644 --- a/public/css/icinga/pagination.less +++ b/public/css/icinga/pagination.less @@ -70,4 +70,10 @@ a.show-more, a.load-more { a.load-more-hint { display: inline-block; margin-left: 1em; +} + +div.load-more-container { + display: table; + margin: 0 auto; + margin-top: 0.5em; } \ No newline at end of file From b8b649f1792b8598560e07e34107ea4b6d0e85a4 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 6 Aug 2015 13:08:36 +0200 Subject: [PATCH 12/14] js: Require a container in ui.focusElement() refs #8615 --- public/js/icinga/events.js | 2 +- public/js/icinga/ui.js | 17 +++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index c74c9e97a..4bbba72fc 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -389,7 +389,7 @@ // This is an anchor only if (href.substr(0, 1) === '#' && href.length > 1 && href.substr(1, 1) !== '!') { - icinga.ui.focusElement(href.substr(1)); + icinga.ui.focusElement(href.substr(1), $a.closest('.container')); return; } diff --git a/public/js/icinga/ui.js b/public/js/icinga/ui.js index b9cff23fd..5d65e1277 100644 --- a/public/js/icinga/ui.js +++ b/public/js/icinga/ui.js @@ -126,16 +126,16 @@ * Focus the given element and scroll to its position * * @param {string} element The name or id of the element to focus - * @param {object} $container Optional, the container containing the element + * @param {object} $container The container containing the element */ focusElement: function(element, $container) { - var $element = $('#' + element); + var $element = $('#' + element, $container); if (! $element.length) { // The name attribute is actually deprecated, on anchor tags, // but we'll possibly handle links from another source // (module etc) so that's used as a fallback - $element = $('[name="' + element.replace(/'/, '\\\'') + '"]'); + $element = $('[name="' + element.replace(/'/, '\\\'') + '"]', $container); } if ($element.length) { @@ -143,16 +143,9 @@ $element.attr('tabindex', -1); } - if (typeof $container === 'undefined') { - $container = $element.closest('.container'); - } - $element.focus(); - - if ($container.length) { - $container.scrollTop(0); - $container.scrollTop($element.first().position().top); - } + $container.scrollTop(0); + $container.scrollTop($element.first().position().top); } }, From 63650518eed66be3f00ccdd56c08b53fdf264ab1 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 6 Aug 2015 13:09:24 +0200 Subject: [PATCH 13/14] Host history: Remove pagination and provide a load more link instead refs #8615 --- .../views/scripts/host/history.phtml | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/application/views/scripts/host/history.phtml b/modules/monitoring/application/views/scripts/host/history.phtml index f70d2d156..82b6f752d 100644 --- a/modules/monitoring/application/views/scripts/host/history.phtml +++ b/modules/monitoring/application/views/scripts/host/history.phtml @@ -17,6 +17,14 @@ function contactsLink($match, $view) { $self = $this; +$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; ?> @@ -24,14 +32,16 @@ if (! $this->compact): ?>

translate('This Host\'s Event History'); ?>

sortBox; ?> limiter; ?> - paginator; ?> + + translate('Scroll to the bottom of this page to load additional events'); ?> + filterEditor; ?>
- + peekAhead() as $event): ?> escape($event->output); @@ -102,6 +112,9 @@ if (! $this->compact): ?> ?>
+ getIteratorPosition() % $limit === 0): ?> + + escape($title); ?>
timestamp); ?> @@ -139,5 +152,17 @@ if (! $this->compact): ?>
hasResult()): ?> translate('No history events found matching the filter'); ?> +hasMore()): ?> +
qlink( + $this->translate('Load More'), + $url->setAnchor('page-' . ($page + 1)), + array( + 'page' => $page + 1, + ), + array( + 'id' => 'load-more', + 'class' => 'pull-right load-more button-like' + ) + ); ?>
From 9dad63b5129d29cb74990691eb65c29d677ac3d9 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 6 Aug 2015 13:09:35 +0200 Subject: [PATCH 14/14] Service history: Remove pagination and provide a load more link instead refs #8615 --- .../views/scripts/service/history.phtml | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/application/views/scripts/service/history.phtml b/modules/monitoring/application/views/scripts/service/history.phtml index 49c5f9993..75e0e608f 100644 --- a/modules/monitoring/application/views/scripts/service/history.phtml +++ b/modules/monitoring/application/views/scripts/service/history.phtml @@ -16,6 +16,14 @@ function contactsLink($match, $view) { $self = $this; +$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; ?> @@ -23,14 +31,16 @@ if (! $this->compact): ?>

translate('This Service\'s Event History'); ?>

sortBox; ?> limiter; ?> - paginator; ?> + + translate('Scroll to the bottom of this page to load additional events'); ?> + filterEditor; ?>
- + peekAhead() as $event): ?> escape($event->output); @@ -100,6 +110,9 @@ if (! $this->compact): ?> ?>
+ getIteratorPosition() % $limit === 0): ?> + + escape($title); ?>
timestamp); ?> @@ -121,5 +134,17 @@ if (! $this->compact): ?>
hasResult()): ?> translate('No history events found matching the filter'); ?> +hasMore()): ?> +
qlink( + $this->translate('Load More'), + $url->setAnchor('page-' . ($page + 1)), + array( + 'page' => $page + 1, + ), + array( + 'id' => 'load-more', + 'class' => 'pull-right load-more button-like' + ) + ); ?>