on ‎2019 Apr 26 12:03 AM
Hi All,
We've good amount of classification attributes, spanned across multiple categories. Currently backoffice takes forever to load this tab and business users cannot do any manipulation on the attributes. It tries to load all the attributes from all the categories assigned to the product.
It was way more optimized in Product Cockpit where each category used to represent one section and hybris was not loading the attributes until someone clicks on the category section.
I know that OOTB backoffice tries to load all the locales by default on the UI which also takes time, but I've provided only one locale read/write access to the user. Even with single locale access the tab take huge amount of time.
This is critical for our business, will highly appreciate if someone can help in this.
Thanks Pratik
Request clarification before answering.
Hi Pratik,
I think you should be able to achieve lazy loading of classification sections with following customizations:
You need to override class ClassificationTabEditorAreaRenderer and the corresponding bean.
Then you need to override method renderAttributes and leave it empty, so that it won't render the attributes straight away
Then you override method renderSection with following code:
super.rederSection(classificationClassModel, features, parent, widgetInstanceManager);
Component expandButton = Selectors.find(parent, ".yw-expandCollapse").iterator().next();
Component groupBox = Selectors.find(parent, ".yw-editorarea-tabbox-tabpanels-tabpanel-groupbox").iterator().next();
expandButton.addEventListener(Events.ON_CLICK, e -> super.renderAttributes(groupBox, features, widgetInstanceManager));
The super.renderSection will create everything but the attributes, which will be later rendered by the ON_CLICK event listener, with a call to super.renderAttributes. The Selectors.find is a convenient ZK method to search elements using CSS-style selectors.
Maybe it's not the most convenient solution, but I think it will do the work, and I thinkg it's the only solution when you don't have access to the sources.
Thanks, Marcin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Marcin,
I've completed the code changes as you suggested. It works okay now. But still to render the tab with all the classification classes, it still takes huge amount. I saw that in the prepareDataForRendering method it fetches all the features associated to the product and then figures out how many classes should there be. This is again taking good amount of time 😞
Also since we've good amount of attributes, when I click on the expand icon it takes good amount of time to load it. 😞
I've made some tweaks from your code.
Made it to work when there are multiple classification classes
By default the sections will be in closed state
The UI for attribute editors will be loaded only once and if it is already loaded then it will show that.
Let me know if any performance improvements can be made.
MyClassificationTabEditorAreaRenderer
Thanks
Pratik
Hi Pratik,
Unfortunately I don't have any quick solution. Lazy loading usually is quick to do, but if it's slow even then, I think you need to search for more sophisticated solution, by looking what the code does right now and what you can tweak. As a last resort you can write your own classification tab renderer from scratch, but this will require a lot of work I suppose.
Perhaps you can do some profiling that will direct you where the optimizations should be done.
Thanks, Marcin
I did some more analysis. There are two times it takes more time.
When it fetches the categories to show them as section on the UI, it actually fetches all of their attributes which takes lot of time and the time grows as we've more data.
When it loads the value on the Localized editor, it already knows data for all locales. Irrespective of whether the user has permission or not to see that locale it always load all the data and then cancels out the UI creation if the user doesn't have read/write access for locale.
All in all it is taking lot of time to load the attributes even if we've optimized the section load time.
I'm going to raise a SAP post on this and see if they have any answer for it.
Thanks for all the help. Pratik
Hi Pratik, did SAP Responded or do you hve any better solution you implemented. Anything helps.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.