Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions application/controllers/HistoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@
use Icinga\Module\Icingadb\Web\Controller;
use Icinga\Module\Icingadb\Web\Control\ViewModeSwitcher;
use Icinga\Module\Icingadb\Widget\ItemList\LoadMoreObjectList;
use ipl\Html\Attributes;
use ipl\Html\HtmlElement;
use ipl\Stdlib\Filter;
use ipl\Web\Control\LimitControl;
use ipl\Web\Control\SortControl;
use ipl\Web\Url;
use ipl\Web\Widget\ActionLink;
use ipl\Web\Widget\ButtonLink;

class HistoryController extends Controller
{
Expand Down Expand Up @@ -89,6 +93,14 @@ public function indexAction()

yield $this->export($history);

$this->addControl(
new ActionLink(
'Scroll to top',
$this->getRequest()->getUrl() . '#page-1',
'angles-up',
new Attributes(['class' => 'scroll-to-top'])
)
);
$this->addControl($sortControl);
$this->addControl($limitControl);
$this->addControl($viewModeSwitcher);
Expand All @@ -109,6 +121,7 @@ public function indexAction()
if ($compact && $page > 1) {
$this->document->addFrom($historyList);
} else {
$this->addContent(new HtmlElement('span', new Attributes(['id' => 'page-1'])));
$this->addContent($historyList);
}

Expand Down
18 changes: 18 additions & 0 deletions public/css/common.less
Original file line number Diff line number Diff line change
Expand Up @@ -309,3 +309,21 @@ form[name="form_confirm_removal"] {
opacity: .9;
}
}

.scroll-to-top {
border-radius: .4em;
padding: .25em;
display: inline-flex;
align-items: baseline;
}

.scroll-to-top:hover {
background: @control-hover-bg;
text-decoration: none;
}

#page-1 {
display: block;
width: 1px;
margin: -1em 0 1em -1em;
}
1 change: 1 addition & 0 deletions public/js/action-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@

// Set data-icinga-url to make it available for Icinga.History.getCurrentState()
req.$target.closest('.container').data('icingaUrl', url);
req.$target.closest('.container').find('.controls .scroll-to-top').attr('href', url.split('#')[0] + '#page-1');

this.icinga.history.replaceCurrentState();
});
Expand Down
Loading