Improve Upload Field implementation
Description
Attachments
- 20 Feb 2020, 10:23 AM
- 20 Feb 2020, 10:22 AM
- 20 Feb 2020, 10:22 AM
is causing
relates to
to be documented by
Activity

Šimon Demočko November 18, 2020 at 9:03 AM
The doc update was supposed to be addressed in , but as per comments on that ticket we won't do it. TL;DR: UploadViewDefinition is MgnlDeprecated, shouldn't be used by externals, we only use it internally.

Rishab Dhar February 24, 2020 at 12:49 PMEdited
Documentation update required
The newly introduced UploadViewDefinition
class allows:
The DAM upload field to be used by configuring a custom
factoryClass
for the field (in this case,info.magnolia.dam.app.field.factory.DamUploadFieldFactory
). If no factory class is configured, the default upload field will be created.The upload field to be marked as required to display validation errors in the UI for an empty field.
upload:
factoryClass: info.magnolia.dam.app.field.factory.DamUploadFieldFactory
class: info.magnolia.ui.editor.UploadViewDefinition
required: true
itemProvider:
$type: jcrChildNodeProvider
nodeName: jcr:content

Rishab Dhar February 20, 2020 at 10:38 AM
The improvement does the following:
Extract ValueBoundProperty for form fields that can have a value - FieldDefinitions and Hybrid ComplexFields. FieldDefinitions automatically are ValueBoundProperty.
Introduce datasource generic UploadView as ValueBoundProperty and ComplexProperty with invisible hidden fields to update state information of the uploaded asset.
Introduce validator for the UploadView to configure UploadView as required ComplexProperty. (solves the issue MGNLDAM-822).
Update the UploadField to maintain File state in FileInfo wrapper and expose it to DamUploadField, which is updated to use the new API.
Update JUnit tests for DamUploadField.
Add Media label for DamUploadField in dam app.
Details
Assignee
Rishab DharRishab DharReporter
Rishab DharRishab DharPriority
NeutralFix versions
Story Points
5Sprint
None
Details
Details
Assignee

Reporter

Current solution involves composite field based solution and requires the presence of redundant static fields for dimensions (width and height) and file name. Those are quirky implementation-wise and also are buggy.
The following improvements should be made to the Upload Field implementation:
Attach all metadata information that is part of a File to the UploadField (removing the need for redundant static fields).
Add required property and validation to UploadField
Enable adding custom factoryClass for the UploadField to maintain flexibility in adding new features to the UploadField (DamUploadField in Assets app).
Remove redundant static fields from Assets app (and update the app descriptor for the improved UploadField)
Extract ValueBoundProperty interface from info.magnolia.ui.field.FieldDefinition, which enables adding a Value based property trait to both simple FieldDefinition (which always have a value) or a info.magnolia.ui.editor.ComplexPropertyDefinition (which may or may not have a Value trait).