Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up the boilerplate for the Create Dataset Form #231

Closed
MellyGray opened this issue Nov 15, 2023 · 14 comments · Fixed by #251
Closed

Set up the boilerplate for the Create Dataset Form #231

MellyGray opened this issue Nov 15, 2023 · 14 comments · Fixed by #251
Assignees
Labels
pm.GREI-d-2.7.1 NIH, yr2, aim7, task1: R&D UI modules for creating datasets and supporting publishing workflows pm.GREI-d-2.7.2 NIH, yr2, aim7, task2: Implement UI modules for creating datasets and publishing workflows Size: 30 A percentage of a sprint. 21 hours. (formerly size:33) UI Tasks related to the user interface (UI) or frontend development

Comments

@MellyGray
Copy link
Contributor

MellyGray commented Nov 15, 2023

Overview of the Feature Request

Set up the boilerplate for the Create Dataset Form. This is only the UI, so no API connected

Features:

  1. It will only contain the Dataset title field
  2. The Save Button should validate the inputs and show the validation error if necessary.
  3. It should have the logic for calling the create use case if the title is valid and redirecting to the dataset page afterwards.

Mock

image
image

What kind of user is the feature intended for?

Logged in users

What inspired the request?

Frontend meeting discussion about the next user workflows that could extend the SPA to cover more features horizontally without too much detail.

What existing behavior do you want changed?

None

Any brand new behavior do you want to add to Dataverse?

No

Any open or closed issues related to this feature request?

@MellyGray MellyGray added pm.GREI-d-2.7.1 NIH, yr2, aim7, task1: R&D UI modules for creating datasets and supporting publishing workflows pm.GREI-d-2.7.2 NIH, yr2, aim7, task2: Implement UI modules for creating datasets and publishing workflows Size: 30 A percentage of a sprint. 21 hours. (formerly size:33) labels Nov 15, 2023
@MellyGray MellyGray moved this to Re-arch: SPA MVP (Guillermo) in IQSS Dataverse Project Nov 15, 2023
@M27Mangan
Copy link

@MellyGray, can you assign this to me?

@MellyGray
Copy link
Contributor Author

MellyGray commented Nov 21, 2023

@M27Mangan you should have permissions to do it by yourself. Please contact Ceilyn so she can add you to the dataverse-dev team on Github

Then, please follow this workflow to assign yourself to the issue:

  1. Notify Ceilyin about the extra points for the sprint
  2. In the projects section of this issue, go to Dataverse_Global_Backlog and move the issue to the Clear of the Backlog column
  3. In the projects section of this issue, add a new project IQSS/dataverse and move the issue to the This Sprint column
  4. Assign yourself
  5. Move the issue to the In Progress column of the iqss/dataverse project once you start working on it

I could do all the steps myself but I think is better if we ensure that you have the permissions to do it by yourself.

Let me know if you have any questions!

@M27Mangan M27Mangan self-assigned this Nov 21, 2023
@GPortas GPortas moved this from Re-arch: SPA MVP (Guillermo) to Clear of the Backlog in IQSS Dataverse Project Nov 27, 2023
@MellyGray
Copy link
Contributor Author

This is the complete form, so more issues about this form are coming
image

@pdurbin
Copy link
Member

pdurbin commented Nov 28, 2023

I have no idea if this will be helpful or not but 7 (!) years ago @raprasad came up with a proof of concept at https://github.com/IQSS/json-schema-test ... "JSON Editor takes a JSON Schema and uses it to generate an HTML form" according to the tool he used.

We now have an (unmerged) PR where we are adding a JSON Schema for a dataset:

Please ignore me if this is all just crazy talk! 😜

@M27Mangan
Copy link

@MellyGray - Is there any business logic for what a "Valid" title should be? Or simply that the Title field contains a value? Do you know what file fragment on the original dataverse repo I should look at?

@M27Mangan
Copy link

I have no idea if this will be helpful or not but 7 (!) years ago @raprasad came up with a proof of concept at https://github.com/IQSS/json-schema-test ... "JSON Editor takes a JSON Schema and uses it to generate an HTML form" according to the tool he used.

We now have an (unmerged) PR where we are adding a JSON Schema for a dataset:

Please ignore me if this is all just crazy talk! 😜

Unfortunately HTML isn't really applicable for the SPA, but I appreciate you thinking of me :)

@MellyGray
Copy link
Contributor Author

MellyGray commented Nov 29, 2023

@MellyGray - Is there any business logic for what a "Valid" title should be? Or simply that the Title field contains a value? Do you know what file fragment on the original dataverse repo I should look at?

Hi @M27Mangan, this is the first issue in the SPA for migrating a form. As part of the scope, we need to figure out the best way to migrate validations from the original dataverse repo. To understand how the title is validated, please check the dataverse repo's original JSF code and its interaction with the backend.

If you discover that the validation in the JSF code is tied to the backend without a corresponding API endpoint for the logic, please make a note of it. Feel free to comment in Slack if you believe extending the API might be necessary to implement this feature.

That's why we typically mock API calls. Occasionally, the API might not yet have the endpoint for a feature, but it will be integrated with the frontend in the future.

@pdurbin
Copy link
Member

pdurbin commented Nov 29, 2023

If you pass an empty string for a title, you get this error:

{
"status": "ERROR",
"message": "Validation Failed: Title is required. (Invalid value:edu.harvard.iq.dataverse.DatasetField[ id=null ]).java.util.stream.ReferencePipeline$3@55407b76"
}

(Yes, what a weird error.)

It seems like a single character is allowed. I tried "z".

I ran this:

mvn test -Dtest=DatasetsIT#testCreateDataset

after editing this file:

scripts/search/tests/data/dataset-finch1.json

Generally speaking we use Bean Validation: https://www.youtube.com/watch?v=xg9A3q-fRyo

Update: D'oh! This was one of the first videos on DataverseTV! It's Gustavo and Stephen talking at JavaOne. Did Oracle take it down?!? 😢

Update 2: here are the slides, at least: https://dataverse.org/presentations/bean-validation-practical-examples-real-world-java-ee-7-application

@M27Mangan
Copy link

Must be they took it down. I will figure something out!

@pdurbin
Copy link
Member

pdurbin commented Nov 30, 2023

We now have an (unmerged) PR where we are adding a JSON Schema for a dataset

Some more details from the frontend meeting this morning:

@pdurbin
Copy link
Member

pdurbin commented Dec 1, 2023

@johannes-darms just pointed us at an interesting React tool over at https://dataverse.zulipchat.com/#narrow/stream/379673-dev/topic/JSON.20Schema.20for.20datasets/near/405354814

"One use case would be the SPA that uses something like this (https://rjsf-team.github.io/react-jsonschema-form/) to auto generate a form based on the schema," he says.

Screenshot 2023-12-01 at 08-34-33 react-jsonschema-form playground

@M27Mangan
Copy link

@pdurbin I think this is a pretty interesting use case and could work quite nicely. To me, setting up this interface would be outside the scope of this issue and would fall within one of the spikes created from the last frontend meeting. What do you think?

@johannes-darms
Copy link

@M27Mangan we are using https://react-hook-form.com/ for our dataverse SPA forms. It has a rather nice approach to form validation and error msg handling. Maybe that is also a suitable tooling for your development.

@MellyGray MellyGray added the UI Tasks related to the user interface (UI) or frontend development label Dec 4, 2023
@MellyGray MellyGray changed the title Frontend - Set up the boilerplate for the Create Dataset Form Set up the boilerplate for the Create Dataset Form Dec 4, 2023
@M27Mangan M27Mangan linked a pull request Dec 5, 2023 that will close this issue
@pdurbin
Copy link
Member

pdurbin commented Dec 8, 2023

@M27Mangan yes, as we discussed in person yesterday, out of scope for now but I still think it's a neat idea we should consider in the future.

A little for from the conversation with Johannes:

"Phil: are you actually using react-jsonschema-form or is it just a dream?

Johannes: "We wanted to use it but our designers and users requested a complex stepper for the input forms. The effort to adapt the lib for the use case was more complex than writing a form by hand, so we are not using it in this project. In a different project I used the library and was happy with the lib:)"

This is my fear, that the library would work great for simple stuff but not go far enough. Of course, we can't know unless we try (some day).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pm.GREI-d-2.7.1 NIH, yr2, aim7, task1: R&D UI modules for creating datasets and supporting publishing workflows pm.GREI-d-2.7.2 NIH, yr2, aim7, task2: Implement UI modules for creating datasets and publishing workflows Size: 30 A percentage of a sprint. 21 hours. (formerly size:33) UI Tasks related to the user interface (UI) or frontend development
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

4 participants