jmix icon indicating copy to clipboard operation
jmix copied to clipboard

Dynamic attributes refactor/redesign with improvement

Open KartnDev opened this issue 1 year ago • 0 comments

Refactor dynamic attributes

Super-task for re-thinking of dynamic attributes

Problem:

Right now we have several problems about Jmix DynAttr:

  1. UI Views: there is a lot of legacy code, views wrote in one file, no fragments. Ex.: io.jmix.dynattrflowui.view.categoryattr.CategoryAttributesDetailView
  2. UI Module: Hard to extend UI components generation strategy. But logics is much harder to understand and recognize patterns.
  3. Data Structure: Right now, data structure is hard and wierd a bit. For each time reserved a column, which brings issues with hard read, extendability, etc
  4. Extendability: If user want new dynattr type, he need to "hack" jmix and dynattrs. Yes this is possible but too slowly and expensive
  5. Strategy: Dynamic Attributes works only if programmer assign facet for target view, this is strange for "no-code" add-on.

Strategy

We need to do a lot of work to improvement

Step 1. Refactor UI part for dynamic attributes.

  • Refactor views, decompose views into readable fragments, avoid dependancy mess anti-patterns within new views and fragments
  • Refactor other (whole, almost all) ui module of dynamic attributes. Strategy of component generation for each form and grid type should be more extendable and more readable/cognitive
  • Support other UI components where we can inject dynamic ui component

Step 2. Re-design data structure

Here is probable problem with back compatibility so this step should be discussed. But this step is necessary for support broken parts of dynamic attributes like generic filter on list values

  • Re-think and re-build how we are storing values of dynamic attribute. This should be unified format for all type and for custom format also
  • Re-design features of dynamic properties: min/max and other validations, default values, enums, list-props and other
  • Don't forget that this solution a) should not broke current users applications b) should be friended with generic filter
  • Don't forget and Support cross data store references for each sides of entity placement

Step 3. Support UI and its feature

  • After data re-design we need to support all changes in UI part.

Step 4. Feature design

  • Add extendability for custom types of dynamic attributes (Setting, Rendering, Type suppling)
  • Backport previous features from CUBA/Jmix 1.x (Setting column order and other)

KartnDev avatar Oct 02 '24 13:10 KartnDev