This commit is contained in:
jrauh01 2026-03-27 20:58:45 +00:00 committed by GitHub
commit cf145f20a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 32 additions and 0 deletions

View file

@ -12,10 +12,14 @@ use Icinga\Module\Icingadb\Web\Control\SearchBar\ObjectSuggestions;
use Icinga\Module\Icingadb\Web\Control\ViewModeSwitcher;
use Icinga\Module\Icingadb\Web\Controller;
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
{
@ -93,6 +97,14 @@ class HistoryController extends Controller
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);
@ -113,6 +125,7 @@ class HistoryController extends Controller
if ($compact && $page > 1) {
$this->document->addFrom($historyList);
} else {
$this->addContent(new HtmlElement('span', new Attributes(['id' => 'page-1'])));
$this->addContent($historyList);
}

View file

@ -314,3 +314,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;
}

View file

@ -644,6 +644,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();
});