Merge pull request #4693 from Icinga/allow-flyovers-to-suspend-auto-refreshes

Allow flyovers to suspend auto refreshes
This commit is contained in:
Johannes Meyer 2022-03-07 15:11:49 +01:00 committed by GitHub
commit 26d8b2a051
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 6 deletions

View File

@ -40,14 +40,13 @@
};
Flyover.prototype.onClick = function(event) {
// Close flyover on click outside the flyover
var $target = $(event.target);
if (! $target.closest('.flyover').length) {
var _this = event.data.self;
$target.closest('#main').find('.flyover.flyover-expanded').each(function() {
$(this).find('.flyover-toggle:first').each(function() {
_this.onClickFlyoverToggle({target: this});
});
$.each(expandedFlyovers, function (id) {
_this.onClickFlyoverToggle({target: $('.flyover-toggle', id)[0]});
});
}
};
@ -57,17 +56,24 @@
$flyover.toggleClass('flyover-expanded');
var $container = $flyover.closest('.container');
if ($flyover.hasClass('flyover-expanded')) {
var $container = $flyover.closest('.container');
if ($flyover.offset().left - $container.offset().left > $container.innerWidth() / 2) {
$flyover.addClass('flyover-right');
}
if ($flyover.is('[data-flyover-suspends-auto-refresh]')) {
$container[0].dataset.suspendAutorefresh = '';
}
expandedFlyovers['#' + $flyover.attr('id')] = null;
} else {
$flyover.removeClass('flyover-right');
if ($flyover.is('[data-flyover-suspends-auto-refresh]')) {
delete $container[0].dataset.suspendAutorefresh;
}
delete expandedFlyovers['#' + $flyover.attr('id')];
}
};