GetDKAN / dkan2

Deprecated: please use the 2.x branch of the dkan repo
https://github.com/GetDKAN/dkan
GNU General Public License v2.0
18 stars 16 forks source link

Discovery: Upload files #409

Closed kimwdavidson closed 4 years ago

kimwdavidson commented 4 years ago

User story

As a data publisher, I want to be able to upload files through a user interface, so that I can share my data without having to use a remote file.

Details/Tasks

dharizza commented 4 years ago

Notes:

Creating custom widget —> https://react-jsonschema-form.readthedocs.io/en/latest/advanced-customization/custom-widgets-fields/ This custom widget should have two options: one for adding a URL and other for uploading a file

If user chooses url —> we should validate if it is a valid url. If user chooses a file upload —> we should validate if the resulting uri corresponds to an existing file.

This would be out of the box, nothing else needs to be done, the widget should return a valid URI and that's what is going to be used.

The library react-jsonschema-form provides working widgets:

We're thinking about these tickets:

  1. Create custom widget that allows users to choose what they want to add (text or file):
    • [ ] field chooser, two tabs: one for url other for file upload
    • [ ] add validations:
    • If user chooses url —> we should validate if it is a valid url.
    • If user chooses a file upload —> we should validate if the resulting uri corresponds to an existing file.
    • [ ] both will return an URI, which is what will be saved in the JSON Metadata field
  2. Integrate with backend
    • [ ] check if FileMapper is going to be used and how to integrate it
    • [ ] how are the files going to be handled? is FileMapper in charge of it? otherwise, check the drupal API, we should probably create something custom, we can check media entity about how to do this
dharizza commented 4 years ago

Implementation tickets:

drasgardian commented 4 years ago

DKAN1 had three options, so to provide an upgrade path we need some equivalent/mapping for all three.

Screenshot from 2020-06-12 15-14-12

Feedback from our users was that they found those default labels confusing so we ended up customising the terminology to this:

Screenshot from 2020-06-12 15-16-56