Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master snippet options owl ard #164668

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

detrouxdev
Copy link
Contributor

@detrouxdev detrouxdev commented May 7, 2024

/!\ The high diff is because some files were duplicated to ensure that Odoo would still load while partially adapted to OWL

The duplication will of course be deleted when all components are adapted. (This will remove ~9 761 + 4 195 = 13 956 lines)

  • UserValueWidgets are no OWL Components but split in 2
    • A Component that will be rendered which is private
    • A StateModel, which is an object that manages the state of that Component
  • Options are now ES6 classes and do not have a direct $el

Work still needs to be done for options which share a state to their widgets beyond _computeWidgetState

task-3850413

@robodoo
Copy link
Contributor

robodoo commented May 7, 2024

Pull request status dashboard.

@detrouxdev detrouxdev force-pushed the master-snippet-options-owl-ard branch from c73bc85 to c1fa12d Compare May 7, 2024 07:24
@C3POdoo C3POdoo added the RD research & development, internal work label May 7, 2024
@detrouxdev detrouxdev force-pushed the master-snippet-options-owl-ard branch from 105fcdc to ee275b6 Compare May 17, 2024 06:16
@detrouxdev detrouxdev force-pushed the master-snippet-options-owl-ard branch from a8e963d to ca980ac Compare May 27, 2024 09:42
@detrouxdev detrouxdev force-pushed the master-snippet-options-owl-ard branch 2 times, most recently from 8f65bde to 6b1012e Compare June 5, 2024 09:19
detrouxdev and others added 4 commits June 5, 2024 11:25
This will allow both the OWL Option system and the Legacy system to work
alongside each other. Making it easier to convert step by step.

The original file will be the one used for the conversion. This will
allow any fix done in the master branch to hit the OWL file when rebased
since this is the file that will be kept at the end of the conversion.

task-3850413
The widget will be turned into a "state model" in future commits and
most of its code will be rewritten, but the first step is to turn it
into an ES6 class instead of a "Legacy" widget

task-3850413
@detrouxdev detrouxdev force-pushed the master-snippet-options-owl-ard branch from 6b1012e to 82f0d03 Compare June 5, 2024 09:25
detrouxdev and others added 14 commits June 5, 2024 11:28
This is the first step of a major refactoring to accommodate the current
SnippetsMenu stack to OWL. To do so, it split some of the logic, to
separate (as much as possible) state from UI HTML.

Previously, a lot of the widgets in the SnippetsMenu would rely on DOM
to handle their states and values. SnippetOption also had direct access
to the widgets and templates. This allowed Options to request values
from the child widgets and update their state accordingly.

The template for the option was also rendered using its own system.

Now, the SnippetOption is a simple ES6 class, and has no direct element
in the DOM. Instead, a SnippetOptionRendering component is passed to the
SnippetsMenu to render the "UserValueComponent" which is the UI the use
will interact with.

The state of these UserValueComponents are still handled by the
SnippetOption however. Which allows the SnippetOption to modify the
state of a component, and the component will re-render accordingly.

This means the XML rendering is no longer handled by the option and
widgets, but by OWL.

===== NOTE =====
This commit message is WIP but any suggestion is welcomed :D

task-3850413
This follows the previous commit logic, with the added complexity of
handling the state of a toggler.

task-3850413
This commit adds WeButtonGroup which replaces the
ButtonGroupUserValueWidget
This commit SHOULD not reach master as this solution has not been
discussed and is IMO a big downgrade to the old tooltip system.
This commit changes the old SnippetOptionWidget class to an ES6 class
and adapts the template to OWL.
This commit combines we-datetimepicker and we-datepicker into one
Component with different props and converts the API to the new OWL api.

task-3850413

Co-authored-by: Arthur Detroux (ard) <ard@odoo.com>
In this commit, some properties are renamed to better fit the new
framework. The `user_value_widget_request` trigger_up which was
previously a trigger_up is changed to a "callback".

The dependency system remains almost identical. Component just use the
state to apply d-none or not.

task-3850413
This commit convert we-row to owl and introduces the concept of layout
elements. Their state is also shared with the option so that it can
properly hide the layout elements when all of the layout's widgets are
hidden.

task-3850413
The templates are now static templates and the options are now ES6
classes. The layout mixin was also adapted so that it works with this
type of class.
This commit adapts the code so that it may work inside an OWL Component
while retaining most of its previous functionality.

task-3850413
This commit converts the API of the Mediapicker widget to OWL and
combines the Imagepicker and the Videopicker widgets into a common
WeMediapicker whose behavior depends on its props (specifically
`mediaType`, being either "images" or "videos").

task-3850413
@detrouxdev detrouxdev force-pushed the master-snippet-options-owl-ard branch from 82f0d03 to f3594f8 Compare June 5, 2024 09:28
Converted option's extend into a SnippetOption patch.
Adapted refreshPublicWidget.

Note that the signatures had to be adapted to the modern style for
methods that call `super`.

task-3850413
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants