[MGNLUI-5919] linkField from M6 to M5 app too complicated to configure Created: 04/Jun/20  Updated: 24/Aug/20  Resolved: 13/Jul/20

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: 6.2.1
Fix Version/s: 6.2.2

Type: Bug Priority: Critical
Reporter: Viet Nguyen Assignee: Adam Siska
Resolution: Fixed Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: 0.95h
Original Estimate: Not Specified

Attachments: PNG File add property.png     File categories-ui6.yaml     PNG File error with categories app.png     Text File error.categories-app.log.txt     PNG File verify.png    
Issue Links:
Issue split
split to MGNLUI-6044 LinkField to M5 app not working in de... Closed
Relates
relates to MGNLUI-5978 Cannot use m6 linkfield to link to m5... Closed
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: UI FW 6
Story Points: 0

 Description   

API described at https://documentation.magnolia-cms.com/display/DOCS62/Link+field documentation does not work when linking from an M6 app to an M5 app.

Linking from an M6 to an M5 app will continue to be a frequent use case. Some Magnoila shipped apps are M5 apps, such as the Stories app and the Categories app, and the apps in the Travel Demo.
Apps created for projects will be M5 apps. And apps created by partners or used in Incubator modules or in 3rd party extensions will continue to be M5 apps until they are migrated.

Ideally the API documented would work as-is when linking from an M6 to an M5 app. Alternatively the API should be as straightforward to configure as the current M6->M5 app or M5->M5 app.

A specific example:

When adding a linkField to a dialog, the select chooser is empty, see attached screenshot. Tested on demo author, contacts-v8 app

// code placeholder
categoryLinkField:
  label: Categories
  $type: linkField
  buttonSelectNewLabel: Select new ...
  buttonSelectOtherLabel: Select another ...
  chooser:
    workbenchChooser:
      datasource:
        $type: jcrDatasource
        workspace: category
        rootPath: /
        previewDefinition:
          nodeName: name

Note: the config above doesn't have an app reference nor a custom workbench config so could not work.



 Comments   
Comment by Viet Nguyen [ 04/Jun/20 ]

Workaround:
Use any "JCR" compatible browser or configure one similar to "contacts-v8" app as a place holder and put it to "appName" property like below - as a workaround:

appName: contacts-v8

Configuration:

Result:

Comment by Roman Kovařík [ 04/Jun/20 ]

It might work just by targeting the app like:

        linkField:
          chooser:
            workbenchChooser:
              appName: categories #appName

If that doesn't work I'd just use a comboBox. 

Comment by Viet Nguyen [ 04/Jun/20 ]

Question from tomwespi:

Hello
I use the categories app delivered with the system. If there is no such v8 app, does this mean it is not possible to upgrade to 6.2.1 except i convert the app myself?

Comment by Viet Nguyen [ 04/Jun/20 ]

Hello rkovarik,

Using "appName: categories" causing below error when we click on the "choose" button:

Some log:
error.categories-app.log.txt

Hope this helps!

Comment by Tom Wespi [ 04/Jun/20 ]

I upgraded the categorisation app to new UI framework, now it works fine with

        linkField:
          chooser:
            workbenchChooser:
              appName: categories-ui6

I attached the app yaml, maybe someone can use this as well.

categories-ui6.yaml

Comment by Roman Kovařík [ 09/Jun/20 ]

Hi Tom,

Thanks.
I've created MGNLCAT-183 on your behalf.

Roman

Comment by Christopher Zimmermann [ 19/Jun/20 ]

viet.nguyen I tried just adding `appName: contacts-v8` as in your example of a workaround above shows - but that did not change the behaviour for me. Am I missing something? Did you also have to change a definition elsewhere?

I don't understand "Use any "JCR" compatible browser or configure one similar to "contacts-v8" app as a place holder " - can you provide more instruction or an example?

Comment by Viet Nguyen [ 22/Jun/20 ]

Hello czimmermann,

but that did not change the behaviour for me

--> I am not sure what behaviour are you expecting, w/o the "v8" app, we run into the error that the chooser dialog does not work properly.
--> "Use any "JCR" compatible browser or configure one similar to "contacts-v8" app as a place holder " means that we need any kind of "content app" configured into appName with the overloading of the datasource and root path, then it just works like any default content app.

Cheers,

Comment by Roman Kovařík [ 22/Jun/20 ]

You should be able to specify the datasource and workbench column by column instead of just referencing an app (it’s not converting the old app to the new one automagically, that happens only if you have the old framework definition) https://git.magnolia-cms.com/projects/PLATFORM/repos/ui/browse/magnolia-ui-framework/src/main/java/info/magnolia/ui/chooser/definition/AppAwareWorkbenchChooserDefinition.java#74

Long term fix for this problem is to migrate all apps to new framework.

Comment by Christopher Zimmermann [ 23/Jun/20 ]

I got it to work with this definition.

Obviously this is too complicated and there should be a shorthand way to have a chooser selecting from an m5 app, just as there is a shorthand way to have a chooser selecting from an m6 app.

// M6 Dialog definition - linking to an m5 app (Stories app)

label: Article
form:
  properties:    
    article:
      label: Article
      $type: linkField
      chooser:
        workbenchChooser:          
          datasource:
            $type: jcrDatasource
            workspace: stories
            rootPath: /
            previewDefinition:
              nodeName: name
            allowedNodeTypes: 
              - mgnl:composition
              - mgnl:folder     
     
          workbench:
            contentViews:
              - name: tree
                $type: treeView
                columns: &columns
                  - name: jcrName
                    label: name
                    $type: jcrTitleColumn
                    nodeTypeToIcon:
                      mgnl:composition: icon-node-content
                      mgnl:folder: icon-folder                  
                  - name: author
                    label: name                  
                  - name: mgnl:lastModified
                    $type: dateColumn
                    label: date                
              - name: list
                columns: *columns
                $type: listView

Comment by Adam Siska [ 13/Jul/20 ]

definitions with old apps in appName parameter should work with provided fix:

form:
  properties:    
    article:
      $type: linkField
      chooser:
        workbenchChooser:          
          appName: categories
Comment by Roman Kovařík [ 14/Jul/20 ]

Using the above configuration in contacts-v8 results in:

Caused by: info.magnolia.objectfactory.MgnlInstantiationException: Unable to resolve parameters [ActionbarPresenter at 1] of ctor [ContextAwareActionPopup(AbstractComponent, ActionbarPresenter)]
	at info.magnolia.objectfactory.ObjectManufacturer.newInstance(ObjectManufacturer.java:97) ~[magnolia-core-6.2.2-SNAPSHOT.jar:?]
	at info.magnolia.objectfactory.guice.GuiceComponentProvider.newInstanceWithParameterResolvers(GuiceComponentProvider.java:134) ~[magnolia-core-6.2.2-SNAPSHOT.jar:?]
	at info.magnolia.ui.framework.ioc.UiComponentProvider.lambda$newInstanceWithParameterResolvers$3(UiComponentProvider.java:137) ~[magnolia-ui-framework-6.2.2-SNAPSHOT.jar:?]
	at info.magnolia.ui.framework.ioc.UiComponentProvider.provideInCurrentScope(UiComponentProvider.java:177) ~[magnolia-ui-framework-6.2.2-SNAPSHOT.jar:?]
	at info.magnolia.ui.framework.ioc.UiComponentProvider.newInstanceWithParameterResolvers(UiComponentProvider.java:137) ~[magnolia-ui-framework-6.2.2-SNAPSHOT.jar:?]
	at info.magnolia.ui.framework.ioc.UiComponentProvider.newInstance(UiComponentProvider.java:128) ~[magnolia-ui-framework-6.2.2-SNAPSHOT.jar:?]
	at info.magnolia.ui.UIComponent.create(UIComponent.java:155) ~[magnolia-ui-framework-6.2.2-SNAPSHOT.jar:?]
	at info.magnolia.ui.contentapp.browser.GridView.<init>(GridView.java:81) ~[magnolia-ui-framework-6.2.2-SNAPSHOT.jar:?]
	at info.magnolia.ui.contentapp.browser.TreeView.<init>(TreeView.java:53) ~[magnolia-ui-framework-6.2.2-SNAPSHOT.jar:?]
	at sun.reflect.GeneratedConstructorAccessor369.newInstance(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_181]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_181]
	at info.magnolia.objectfactory.ObjectManufacturer.newInstance(ObjectManufacturer.java:129) ~[magnolia-core-6.2.2-SNAPSHOT.jar:?]
	at info.magnolia.objectfactory.ObjectManufacturer.newInstance(ObjectManufacturer.java:99) ~[magnolia-core-6.2.2-SNAPSHOT.jar:?]
	at info.magnolia.objectfactory.guice.GuiceComponentProvider.newInstanceWithParameterResolvers(GuiceComponentProvider.java:134) ~[magnolia-core-6.2.2-SNAPSHOT.jar:?]
	... 211 more

The config is usable for dialogs (pages-app) though so closing this ticket.

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