[MAGNOLIA-7343] Respect order of keys coming from decorators Created: 28/Jun/18  Updated: 04/Sep/18  Resolved: 09/Jul/18

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: None
Fix Version/s: 5.7.1

Type: Improvement Priority: Neutral
Reporter: Oanh Thai Hoang Assignee: Oanh Thai Hoang
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 5d 3h
Original Estimate: Not Specified

Attachments: Zip Archive decorate-tour-example.zip     PNG File expect-output.png     PNG File output.png    
Issue Links:
Cloners
is cloned by MAGNOLIA-7348 Backport to 5.6.x - Respect order of ... Accepted
Relates
relates to MAGNOLIA-7080 Decorators: Provide possibility to de... Accepted
dependency
is depended upon by MGNLUI-4474 Tune the presentation of the browser UI Closed
relation
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Release notes required:
Yes
Documentation update required:
Yes
Date of First Response:
Sprint: Saigon 148, Saigon 149
Story Points: 3

 Description   

Say, we want to decorate tours app and change order of path column in tree view. See attached example decorate-tour-example.zip.
Update: More example you can find in https://git.magnolia-cms.com/projects/PLATFORM/repos/main/pull-requests/622/overview and declaring map keys are enough to respect order

 

Output: orders of list and columns are no changes

Expected output: 



 Comments   
Comment by Mikaël Geljić [ 03/Jul/18 ]

To validate primarily by overriding template values in the app descriptor enabled with the !with-type directive.
There it's not using YAML inherits, so there is no !override either. Can we estimate how much effort it would be to add override capabilities for the generated apps? (we don't have to, imo, but then we have an idea if it's a quick win or not)

Secondarily, I agree it should work with decoration as well, although maybe the order of content-views is not flexible enough Try it mainly with form fields or columns.

Comment by Dai Ha [ 13/Jul/18 ]
  • Case 01: reordering nodes in definition with inherit and override worked
  • Case 02: reordering nodes with decoration and override (tours app - in particular) seems not working as expected. Nodes are sorted but cannot open Tours app.

Double checking with oanh.thai to see whether it's regression or unrelated issue.

Comment by Oanh Thai Hoang [ 16/Jul/18 ]

dai.ha: Regarding your concern about case 02 and you use my my example in PR. This is not a bug. It works as expectation.

The impressive thing is there are 2 modules decorated tours at your case: 1 is your and 1 is travel-demo-content-tags. And travel-demo-content-tags always apply decoration after your module. So the final decoration from travel is more important than yours. And problem come from decoration of search views. Travel-demo-content-tags does not declare property class in search view and your module is overrided search views and remove it already.

 

Just change your app config like and it will be fine

subApps:
  browser:
    workbench:
      contentViews: !override
        list:  # we want to order list before tree
          active: true
        tree:
          class: info.magnolia.ui.workbench.tree.TreePresenterDefinition
          columns: !override # we want to override tree with new column path2 and order path before name
            - name: path2 # create a new column formatter and want it to be the the first column
              enabled: true
              expandRatio: 2
              formatterClass: info.magnolia.ui.workbench.column.PathColumnFormatter
              class: info.magnolia.ui.workbench.column.definition.MetaDataColumnDefinition
            - name: path # we want to order path before name
              enabled: true
            - name: name
        search:
          class: info.magnolia.ui.workbench.search.SearchPresenterDefinition

 

 

Comment by Dai Ha [ 16/Jul/18 ]

Closed as clarification is clear.

Comment by Christopher Zimmermann [ 23/Jul/18 ]

I want to provide a simple example for docs. 

I think there are at least 2 important things to document concerning re-ordering.

  1. Previously, when providing new config with the !override flag - the new config would be "picked up", but the any change in the order of the nodes (at the level of the !override) would not be respected. This is fixed.
  2. A common use-case is that developers don't want to change any of the existing configuration, they ONLY want to reorder. This is supported.

Here is an example for point 2:

This will reorder the columns of the tree.

Decoration filename: /mymodule/decorations/tours/apps/tours.yaml

subApps:
  browser:
    workbench:
      contentViews:
        tree:
          columns: !override
            path:
            name:
            author:
            moddate:
            tags:
Generated at Mon Feb 12 04:22:56 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.