From e602db30738705291e798d198ab1b7a08ed98302 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 29 Apr 2022 12:42:23 +0200 Subject: [PATCH] ui.js: Don't trigger `layout-change` before the app is initialized --- public/js/icinga/ui.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/public/js/icinga/ui.js b/public/js/icinga/ui.js index 66fed28ef..2522f9f13 100644 --- a/public/js/icinga/ui.js +++ b/public/js/icinga/ui.js @@ -291,7 +291,7 @@ this.currentLayout = matched[1]; if (this.currentLayout === 'poor' || this.currentLayout === 'minimal') { this.layout1col(); - } else { + } else if (this.icinga.initialized) { // layout1col() also triggers this, that's why an else is required $('#layout').trigger('layout-change'); } @@ -319,7 +319,11 @@ this.icinga.logger.debug('Switching to single col'); $('#layout').removeClass('twocols'); this.closeContainer($('#col2')); - $('#layout').trigger('layout-change'); + + if (this.icinga.initialized) { + $('#layout').trigger('layout-change'); + } + // one-column layouts never have any selection active $('#col1').removeData('icinga-actiontable-former-href'); this.icinga.behaviors.actiontable.clearAll(); @@ -340,7 +344,10 @@ if (! this.isOneColLayout()) { return; } this.icinga.logger.debug('Switching to double col'); $('#layout').addClass('twocols'); - $('#layout').trigger('layout-change'); + + if (this.icinga.initialized) { + $('#layout').trigger('layout-change'); + } }, prepareColumnFor: function ($el, $target) {