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

Adding links to namespaces has undesireable UX #1622

Merged
merged 2 commits into from
Mar 15, 2022

Conversation

MilanPospisil
Copy link
Contributor

Issue: AAH-149

https://issues.redhat.com/browse/AAH-149

This issue is to track some follow-on work from AAH-18. Now at least adding links works mostly as expected, but there is still some undesirable behavior:

Links without http:// are valid and users will enter them. "Enter a valid URL" does not make it clear what is missing, either. Schema can be added if missing.
Every time the namespace is saved, the order of the links is reversed.

@MilanPospisil MilanPospisil changed the title Adding links to namespaces has undesireable UX [WIP] Adding links to namespaces has undesireable UX Feb 8, 2022
@MilanPospisil
Copy link
Contributor Author

Before:
URLbefore
After:
URLAfter

@MilanPospisil
Copy link
Contributor Author

Note that Save button is still active (the previous functionality stays and button does not save invalid data and displays its own error message). Should it be disabled?

@MilanPospisil MilanPospisil changed the title [WIP] Adding links to namespaces has undesireable UX Adding links to namespaces has undesireable UX Feb 8, 2022
@himdel
Copy link
Collaborator

himdel commented Feb 8, 2022

Note that Save button is still active (the previous functionality stays and button does not save invalid data and displays its own error message). Should it be disabled?

Ah, ideally yes, when a link fails UI validation, the Save button should be disabled.

Once UI validation is successful, the user can submit and then possibly get hit with the errors from the API from any other model validations.

But I think this is still missing the part where we take the errors from the server response, and show them by the right field as well. Let me know if you need any help with that, I think the error splitting logic is implemented in mapErrorMessages, hopefully it's also compatible with how this form is written :)

@MilanPospisil
Copy link
Contributor Author

Note that Save button is still active (the previous functionality stays and button does not save invalid data and displays its own error message). Should it be disabled?

Ah, ideally yes, when a link fails UI validation, the Save button should be disabled.

Once UI validation is successful, the user can submit and then possibly get hit with the errors from the API from any other model validations.

But I think this is still missing the part where we take the errors from the server response, and show them by the right field as well. Let me know if you need any help with that, I think the error splitting logic is implemented in mapErrorMessages, hopefully it's also compatible with how this form is written :)

The server does not return errors that could be easily assigned to particular items. For example for 3 invalid items (2 blank names and 3 invalid urls) it says:

0: {status: "400", code: "invalid", title: "Invalid input.", detail: "'asdsadads' is not a valid url.",…}
code: "invalid"
detail: "'asdsadads' is not a valid url."
source: {parameter: "links__url"}
status: "400"
title: "Invalid input."
1: {status: "400", code: "blank", title: "Invalid input.", detail: "This field may not be blank.",…}
code: "blank"
detail: "This field may not be blank."
source: {parameter: "links__name"}
status: "400"
title: "Invalid input."
2: {status: "400", code: "invalid", title: "Invalid input.",…}
code: "invalid"
detail: "'asddasdasb**-ui/pull/1490/files' is not a valid url."
source: {parameter: "links__url"}
status: "400"
title: "Invalid input."
3: {status: "400", code: "blank", title: "Invalid input.", detail: "This field may not be blank.",…}
code: "blank"
detail: "This field may not be blank."
source: {parameter: "links__name"}
status: "400"
title: "Invalid input."
4: {status: "400", code: "invalid", title: "Invalid input.", detail: "'gfhfhf' is not a valid url.",…}
code: "invalid"
detail: "'gfhfhf' is not a valid url."
source: {parameter: "links__url"}
status: "400"
title: "Invalid input."

I suggest that better way is to do good client side validation instead. What do you think?

@MilanPospisil
Copy link
Contributor Author

Another thing. Company name field has IsRequired in the textinput, but no error message is shown when it is empty, nor the server returns any errors. The IsRequired should not be here i guess?

@MilanPospisil MilanPospisil changed the title Adding links to namespaces has undesireable UX [WIP] Adding links to namespaces has undesireable UX Feb 9, 2022
@MilanPospisil MilanPospisil changed the title [WIP] Adding links to namespaces has undesireable UX Adding links to namespaces has undesireable UX Feb 14, 2022
@himdel
Copy link
Collaborator

himdel commented Feb 22, 2022

The server does not return errors that could be easily assigned to particular items...
I suggest that better way is to do good client side validation instead.

Well we still need to show server errors when they do happen, but agreed we can't really show server errors together with the right item, and clients side validation is enough to make it nice :)

@himdel
Copy link
Collaborator

himdel commented Feb 22, 2022

Another thing. Company name field has IsRequired in the textinput, but no error message is shown when it is empty, nor the server returns any errors. The IsRequired should not be here i guess?

Yeah agreed, I'm pretty sure the company name is not required now. There used to be an isRequired on the corresponding FormGroup before #50 but I'm not sure this was ever required. (And it seems the TextInput isRequired prop only really sets the <input required> prop, which is ignored in <form novalidate> (html forms vs react forms).)

So, harmless, but feel free to remove it, I agree it doesn't belong there :)

@himdel
Copy link
Collaborator

himdel commented Feb 28, 2022

Thanks, the previous issue is fixed, just one more detail :) ...

20220228015743

the width of the right input apparently depends on the presence/length of the message under it, and maybe the validation state of the left input... we should keep a consistent 50:50 layout

(if it helps, 20220228015743, 4 lines are off, 2 to the left, 2 to the right)

Issue: AAH-149

Signed-off-by: Milan Pospisil <arkanus@seznam.cz>
@MilanPospisil MilanPospisil merged commit 93e1510 into ansible:master Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants