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

Do we need "Clear" for elements of "tuple" properties? #516

Closed
tcompa opened this issue Jun 25, 2024 · 5 comments · Fixed by #521
Closed

Do we need "Clear" for elements of "tuple" properties? #516

tcompa opened this issue Jun 25, 2024 · 5 comments · Fixed by #521
Labels
JSON Schemas Editing of WorkflowTask arguments based on JSON Schemas

Comments

@tcompa
Copy link
Collaborator

tcompa commented Jun 25, 2024

I don't have a very strong opinion here, but the issue is to collect feedback about the "clear" button when we have a fixed-length array (as raised by @lorenzocerrone).

If an array must have 3 elements, and we "clear" one of them, the current data has only two elements and validation will obviously fail (as it does, correctly). What is the use case for the "clear" button then?

[maybe it's simply a consequence of developing the "tuple" UI based on the original array UI, which required dynamic addition/removal of elements]

Feedback or examples are welcome

@tcompa tcompa added the JSON Schemas Editing of WorkflowTask arguments based on JSON Schemas label Jun 25, 2024
@lorenzocerrone
Copy link

I liked the behavior that @jluethi proposed. Swap the "clear" button for a "reset" button that restores the element's default value.

@zonia3000
Copy link
Collaborator

Some questions on this.

Is resetting a single tuple value useful? Otherwise we can just add a "Reset tuple" button, that reset the whole tuple to its default value.

image

Currently we are providing the clear button only to "value fields" (text, number, boolean). What if the tuple contains more complex objects? In that case, should we provide a reset button to all the fields having a default value (not only tuples)?

image

@lorenzocerrone
Copy link

For question 1, I think a single global reset for the whole tuple is a bit nicer (anyway, I don't expect the value tuples to become too long), but I don't have a strong opinion.

For question 2 I have discussed it briefly with @jluethi, if it does not add complexity to each element, I would find it helpful to be able to reset complex objects (the ones that are collapsible and have a default value). Maybe to avoid too many nested reset buttons, one can reset only the top-level object and not all sub-objects.

@jluethi
Copy link
Collaborator

jluethi commented Jul 3, 2024

+1 from my side on having reset-button top-level on collapsible elements (e.g. tuples), if (and only if) they come with a default.

Let's not add resets for e.g. required lists to be filled, like the allowed_channels in the Create OME Zarr task

@zonia3000
Copy link
Collaborator

I've removed the Clear buttons and I've added a Reset button on the accordion header (only for top-level properties having a default value):

image

This is valid also for objects and generic arrays.

In the following screenshot the first property has a top-level default value, while the second property has a default value inside the inner object, so the Reset button is not displayed:

image

Here the JSON used for testing:

{"title":"test","type":"object","properties":{"foo":{"default":[1,2,3],"type":"array","minItems":3,"maxItems":3,"items":[{"type":"integer"}, {"type":"integer"} ,{"type":"integer"}]}}, "required": ["foo"]}
{"title":"test","type":"object","properties":{"test": {"type":"object","default":{"key1":{"key2":"foo"}},"properties":{"key1":{"type":"object","properties": {"key2": {"type":"string"}}}},"required": ["key1"]}, "test2":{"type":"object","properties":{"key1":{"type":"object", "default": {"key2": "bar"},"properties": {"key2": {"type":"string"}}}},"required": ["key1"]}},"required": ["test", "test2"]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JSON Schemas Editing of WorkflowTask arguments based on JSON Schemas
Projects
4 participants