From f932a4a44c64df16663a6db8841ec32000b1a396 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 7 Feb 2022 14:12:44 +0100 Subject: [PATCH] application-state.js: Only run once when the layout is rendered --- public/js/icinga/behavior/application-state.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/js/icinga/behavior/application-state.js b/public/js/icinga/behavior/application-state.js index 7cd655b44..213c96c26 100644 --- a/public/js/icinga/behavior/application-state.js +++ b/public/js/icinga/behavior/application-state.js @@ -1,6 +1,5 @@ /*! Icinga Web 2 | (c) 2015 Icinga Development Team | GPLv2+ */ -// @TODO(el): https://dev.icinga.com/issues/10646 (function(Icinga, $) { 'use strict'; @@ -9,13 +8,18 @@ var ApplicationState = function (icinga) { Icinga.EventListener.call(this, icinga); - this.on('rendered', this.onRendered, this); + this.on('rendered', '#layout', this.onRendered, this); this.icinga = icinga; }; ApplicationState.prototype = new Icinga.EventListener(); ApplicationState.prototype.onRendered = function(e) { + if (e.currentTarget !== e.target) { + // Nested containers are ignored + return; + } + if (! $('#application-state').length && ! $('#login').length && ! $('#guest-error').length