Merge pull request #4823 from Icinga/fix/new-user-menu-forgets-active-states-4791

Fix that the new user menu forgets active states
This commit is contained in:
Johannes Meyer 2022-06-15 08:43:09 +02:00 committed by GitHub
commit 01a348ff8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View File

@ -263,7 +263,7 @@ class ConfigMenu extends BaseHtmlElement
[
HtmlElement::create(
'a',
Attributes::create(['href' => $item['url']]),
Attributes::create(['href' => Url::fromPath($item['url'])]),
[
$item['label'],
isset($healthBadge) ? $healthBadge : ''

View File

@ -221,8 +221,19 @@
};
Navigation.prototype.setActiveAndSelected = function ($el) {
this.setActive($el);
this.setSelected($el);
if ($el.length > 1) {
$el.each(el => {
if (! this.active) {
this.setActiveAndSelected($(el));
}
});
} else if ($el.length) {
if ($el[0].offsetWidth || $el[0].offsetHeight || $el.closest('.config-menu').length) {
// It's either a visible menu item or a config menu item
this.setActive($el);
this.setSelected($el);
}
}
};
/**