ui.js: Don't trigger layout-change before the app is initialized

This commit is contained in:
Johannes Meyer 2022-04-29 12:42:23 +02:00
parent 26f3fa0dc1
commit e602db3073

View File

@ -291,7 +291,7 @@
this.currentLayout = matched[1]; this.currentLayout = matched[1];
if (this.currentLayout === 'poor' || this.currentLayout === 'minimal') { if (this.currentLayout === 'poor' || this.currentLayout === 'minimal') {
this.layout1col(); this.layout1col();
} else { } else if (this.icinga.initialized) {
// layout1col() also triggers this, that's why an else is required // layout1col() also triggers this, that's why an else is required
$('#layout').trigger('layout-change'); $('#layout').trigger('layout-change');
} }
@ -319,7 +319,11 @@
this.icinga.logger.debug('Switching to single col'); this.icinga.logger.debug('Switching to single col');
$('#layout').removeClass('twocols'); $('#layout').removeClass('twocols');
this.closeContainer($('#col2')); this.closeContainer($('#col2'));
$('#layout').trigger('layout-change');
if (this.icinga.initialized) {
$('#layout').trigger('layout-change');
}
// one-column layouts never have any selection active // one-column layouts never have any selection active
$('#col1').removeData('icinga-actiontable-former-href'); $('#col1').removeData('icinga-actiontable-former-href');
this.icinga.behaviors.actiontable.clearAll(); this.icinga.behaviors.actiontable.clearAll();
@ -340,7 +344,10 @@
if (! this.isOneColLayout()) { return; } if (! this.isOneColLayout()) { return; }
this.icinga.logger.debug('Switching to double col'); this.icinga.logger.debug('Switching to double col');
$('#layout').addClass('twocols'); $('#layout').addClass('twocols');
$('#layout').trigger('layout-change');
if (this.icinga.initialized) {
$('#layout').trigger('layout-change');
}
}, },
prepareColumnFor: function ($el, $target) { prepareColumnFor: function ($el, $target) {