Eventhistory Overview: Remove pagination and provide a load more link instead
refs #8615
This commit is contained in:
parent
7662545c2a
commit
8cf3b99335
|
@ -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);
|
||||
|
|
|
@ -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): ?>
|
||||
<div class="controls">
|
||||
<?= $this->tabs; ?>
|
||||
<?= $this->sortBox; ?>
|
||||
<?= $this->limiter; ?>
|
||||
<?= $this->paginator; ?>
|
||||
<a class="load-more-hint" href="#load-more">
|
||||
<?= $this->translate('Scroll to the bottom of this page to load additional events'); ?>
|
||||
</a>
|
||||
<?= $this->filterEditor; ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<div class="content">
|
||||
<table data-base-target="_next" class="action">
|
||||
<tbody>
|
||||
<?php foreach ($history as $event): ?>
|
||||
<?php foreach ($history->peekAhead() as $event): ?>
|
||||
<?php
|
||||
$icon = 'help';
|
||||
$msg = $event->output;
|
||||
|
@ -71,6 +79,9 @@ if (! $this->compact): ?>
|
|||
?>
|
||||
<tr class="state <?= $stateName; ?>">
|
||||
<td class="state">
|
||||
<?php if ($history->getIteratorPosition() % $limit === 0): ?>
|
||||
<a name="page-<?= $history->getIteratorPosition() / $limit + 1; ?>"></a>
|
||||
<?php endif ?>
|
||||
<strong><?= $this->escape($title); ?></strong>
|
||||
<br>
|
||||
<?= $this->timeAgo($event->timestamp, $this->compact); ?>
|
||||
|
@ -95,14 +106,28 @@ if (! $this->compact): ?>
|
|||
<?php if (! $history->hasResult()): ?>
|
||||
<?= $this->translate('No history events found matching the filter'); ?>
|
||||
<?php elseif ($history->hasMore()): ?>
|
||||
<?php if ($this->compact): ?>
|
||||
<?= $this->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'
|
||||
)
|
||||
); ?>
|
||||
<?php else: ?>
|
||||
<?= $this->qlink(
|
||||
$this->translate('Load More'),
|
||||
$url->setAnchor('page-' . ($page + 1)),
|
||||
array(
|
||||
'page' => $page + 1,
|
||||
),
|
||||
array(
|
||||
'name' => 'load-more',
|
||||
'class' => 'pull-right load-more'
|
||||
)
|
||||
); ?>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
|
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue