From 42b499cf482cbbd6d264fbed1def75ba290814ce Mon Sep 17 00:00:00 2001 From: robertSt7 <104770750+robertSt7@users.noreply.github.com> Date: Tue, 16 Jan 2024 10:45:19 +0100 Subject: [PATCH] [BUG, EC] Rendering of localized classification store is slow in backend for many languages (#395) * Fix: Lazy load the languages of CS * Fix: Lazy load the languages of CS * Fix: Lazy load the languages of CS --- .../object/tags/classificationstore.js | 44 +++++++++++-------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/public/js/pimcore/object/tags/classificationstore.js b/public/js/pimcore/object/tags/classificationstore.js index 5712453189..52aa48548a 100644 --- a/public/js/pimcore/object/tags/classificationstore.js +++ b/public/js/pimcore/object/tags/classificationstore.js @@ -152,21 +152,6 @@ pimcore.object.tags.classificationstore = Class.create(pimcore.object.tags.abstr this.languageElements[this.currentLanguage] = []; this.groupElements[this.currentLanguage] = {}; - var childItems = []; - - - for (var groupId in this.fieldConfig.activeGroupDefinitions) { - var groupedChildItems = []; - - if (this.fieldConfig.activeGroupDefinitions.hasOwnProperty(groupId)) { - var group = this.fieldConfig.activeGroupDefinitions[groupId]; - - var fieldset = this.createGroupFieldset(this.currentLanguage, group, groupedChildItems); - - childItems.push(fieldset); - - } - } var title = this.frontendLanguages[i]; if (title != "default") { var title = t(pimcore.available_languages[title]); @@ -184,9 +169,32 @@ pimcore.object.tags.classificationstore = Class.create(pimcore.object.tags.abstr hideMode: "offsets", iconCls: icon, title: title, - items: childItems - }); + listeners: { + activate: function(frontendLanguage, tab) { + if (tab.items.length !== 0) { + return; + } + + this.currentLanguage = frontendLanguage; + + const childItems = []; + for (const groupId in this.fieldConfig.activeGroupDefinitions) { + const groupedChildItems = []; + + if (this.fieldConfig.activeGroupDefinitions.hasOwnProperty(groupId)) { + const group = this.fieldConfig.activeGroupDefinitions[groupId]; + + const fieldset = this.createGroupFieldset(this.currentLanguage, group, groupedChildItems); + childItems.push(fieldset); + } + } + + tab.add(childItems); + this.component.updateLayout(); + }.bind(this, this.frontendLanguages[i]) + } + }) this.languagePanels[this.currentLanguage] = item; if (this.fieldConfig.labelWidth) { @@ -207,11 +215,9 @@ pimcore.object.tags.classificationstore = Class.create(pimcore.object.tags.abstr } - this.currentLanguage = this.frontendLanguages[0]; this.component = new Ext.Panel(wrapperConfig); - this.component.updateLayout(); return this.component; },