Daily updates from Odoo
Thursday, June 8, 2023
1 change · master
Code cleanup and technical improvements
The Knowledge sidebar has been redesigned to load much faster and update without reloading the whole page, especially for workspaces with many articles. Users also get smoother article moving, clearer drag-and-drop feedback, easier trash access, and fewer sidebar-related errors.
Original PR description
Purpose: -------- Previously, the sidebar was rendered server side. The generated html fragment was sent to the client which appended it into the DOM. This was meant to be temporary since the…
Purpose: -------- Previously, the sidebar was rendered server side. The generated html fragment was sent to the client which appended it into the DOM. This was meant to be temporary since the owlification of the application, and had several flaws (slow, lots of DOM manipulations, no reactivity). This commit introduces a sidebar component that is fully autonomous (other components do not have to force a full reload of the page to update the sidebar). It improves the performances (~0.7s vs >3s to load the home page with +1500 articles in the sidebar), reduces the number of RPCs, remove the need of DOM manipulations and allows for more customization. This commit also introduces a "SortableList" hook, that removes the need of the external Jquery library "NestedSortable", and allows for more freedom concerning the drag&drop behaviour. The revamped sidebar also comes with a few new features and fixes: - The MoveArticleDialog (dialog shown when clicking on the "Move To" button) does not ask for confirmation anymore when moving the article to another category. We consider that the user knows what he is doing when using this button, and he has a visual feedback of what happened since the article which has been moved is the active one, and is therefore highlighted in the sidebar. Moreover, clicking on the "move to" button, clicking on the selection input, clicking on a category, clicking on the "move article" button and clicking on "ok" on the confirmation dialog was a long process to just move the current article. Moving an article using drag&drop in the sidebar still asks for confirmation. - When dragging an article in the sidebar, if the current drop position is not allowed, the position hint is shown in red (for example if one only has read access for the parent under which one tries to place the article). This way, one does not need to drop it and receive an access error to know that the position was not allowed. - Articles in the sidebar can be sent to the trash by dragging them onto the trash manager at the bottom of the sidebar. This makes it easier to delete articles from the form view. - The current article is now always shown when it is present in the sidebar (previously, it was not always the case (when using the "MoveArticleDialog" and moving the article under a folded parent). - Resequencing favorites does not crash anymore if you lost access to one of your favorite articles but did not reload the page to show the change in the sidebar yet. Previously, if you did so, you tried to change the sequence of a restricted article (which raised an access error). Now, restricted articles are filtered out when resequencing favorites. - One cannot change from the sidebar the emoji of an article one just locked (and inversely, one can change the emoji if one just unlocked the article). Previously, you could (not) do it until the sidebar was reloaded. - The "Open the trash" button is now always visible. Previously, if you had a lot of articles, you had to scroll to the bottom of the tree to be able to open the trash. These improvements are not available for the public view (from website_knowledge), which still appends into the DOM the sidebar fragment generated server side. Task-3074123