[MGNLUI-6168] Override directive not disabling tabs under new UI config Created: 28/Aug/20  Updated: 28/Sep/20  Resolved: 24/Sep/20

Status: Closed
Project: Magnolia UI
Component/s: app framework
Affects Version/s: 6.2.2
Fix Version/s: 6.2.4

Type: Bug Priority: Neutral
Reporter: Carlos Cantalapiedra Assignee: Oanh Thai Hoang
Resolution: Fixed Votes: 0
Labels: compatibility-module, maintenance, quickwin
Remaining Estimate: 0d
Time Spent: 0.75d
Original Estimate: Not Specified

Issue Links:
causality
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)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Epic Link: UI framework implementation
Sprint: Maintenance 26
Story Points: 2

 Description   

Overriding (disabling) a tab using new YAML syntax doesn't work.

Steps to reproduce:

  1. Create a dialog like
    form:
      tabs:
        tabMain:
          label: Main
          fields:
            - name: title
              class: info.magnolia.ui.form.field.definition.TextFieldDefinition
              label: Title
        tabCookie:
          label: Cookie
          fields:
            - name: showCookieMessage
              class: info.magnolia.ui.form.field.definition.CheckboxFieldDefinition
              defaultValue: false
              type: Boolean
              label:  Cookies
              buttonLabel: Set Cookies
  1. At other dialog, include the dialog above and override the tabCookie:
    !include:/my-module/dialogs/components/myDialog.yaml
    form:
      tabs:
        tabCookie: !override
  1. Check that if you open the dialog, tho the tabCookie shouldn't appear, it does.

Actual result:
The tabCookie is visible

Expected result:
The tabCookie is not shown

Dev notes:
Using the old YAML syntax, the tab is hidden:

form:
  tabs:
    - name: cookie
      label: My Cookie tab
      fields:
        - name: showCookieMessage
          class: info.magnolia.ui.form.field.definition.CheckboxFieldDefinition
          defaultValue: false
          i18n: false
          type: Boolean
          label: Cookies
          buttonLabel: Label button


 Comments   
Comment by Carlos Cantalapiedra [ 21/Sep/20 ]

Workaround provided by pmueller:

Patch info.magnolia.ui.form.definition.DefinitionConverter on line 16 with the following lline of code:

        tabbedLayoutDefinition.setTabs(oldDefinition.getTabs().stream().filter(t -> t.getFields() != null && !t.getFields().isEmpty()).map(TAB::convert).collect(Collectors.toList()));
Comment by Philip Müller [ 21/Sep/20 ]

It's line 167

Comment by Richard Gange [ 21/Sep/20 ]

Perfect, I will create a PR.

Generated at Mon Feb 12 09:33:49 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.