diff --git a/library/Icinga/Data/SimpleQuery.php b/library/Icinga/Data/SimpleQuery.php index 2d0eeef6f..e4b9f1f9b 100644 --- a/library/Icinga/Data/SimpleQuery.php +++ b/library/Icinga/Data/SimpleQuery.php @@ -36,6 +36,13 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator */ protected $iteratorPosition; + /** + * The amount of rows previously calculated + * + * @var int + */ + protected $cachedCount; + /** * The target you are going to query * @@ -450,7 +457,7 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator */ public function hasResult() { - return $this->iteratorPosition !== null || $this->fetchRow() !== false; + return $this->cachedCount > 0 || $this->iteratorPosition !== null || $this->fetchRow() !== false; } /** @@ -647,6 +654,7 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator $query->limit(0, 0); Benchmark::measure('Counting all results started'); $count = $this->ds->count($query); + $this->cachedCount = $count; Benchmark::measure('Counting all results finished'); return $count; } diff --git a/modules/monitoring/application/views/scripts/partials/event-history.phtml b/modules/monitoring/application/views/scripts/partials/event-history.phtml index c9bae1aba..73eb33bf4 100644 --- a/modules/monitoring/application/views/scripts/partials/event-history.phtml +++ b/modules/monitoring/application/views/scripts/partials/event-history.phtml @@ -29,19 +29,17 @@ if (! $url->hasParam('page') || ($page = (int) $url->getParam('page')) < 1) { $history->limit($limit * $page); ?>
-hasResult()): ?> -

translate('No historical events found matching the filter.') ?>

-
- translate('%A, %B %e, %Y', 'date.verbose'); $lastDate = null; $flappingMsg = $this->translate('Flapping with a %.2f%% state change rate'); $rowAction = Url::fromPath('monitoring/event/show'); ?> + peekAhead() as $event): ?> + - - peekAhead() as $event): + +service_description); @@ -240,8 +238,10 @@ $rowAction = Url::fromPath('monitoring/event/show'); +
+ hasMore()): ?>