-
Notifications
You must be signed in to change notification settings - Fork 90
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
Introduce field validation to Create container dialog #1354
Conversation
Not a review, just very quickly noticed on screenshot that you require everything but for example for ports that is not the case. From man pages: Similarly for volumes you don't have to specify source. (Not sure if we want to support that 🤷♂️ ) Also when 'required' appears it breaks the [-] button alignment. And there is |
108e1b8
to
68cb803
Compare
Fixed |
Please refer to the form design documentation: https://www.patternfly.org/components/forms/form/design-guidelines/#errors-and-validation
An aside:
|
fc6254f
to
2489fce
Compare
a9f37bd
to
9f74a06
Compare
Updated the PR to use debounce, now just waiting for cockpit-project/cockpit#19251 to land |
607719f
to
b4c4a7e
Compare
b4c4a7e
to
5fedc1c
Compare
48971d2
to
ce1ba8a
Compare
f28eebb
to
b927b71
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall! Thanks!
I did find a couple of things that could be handled in follow-ups.
- Trash can icon is misaligned when there are elements pushing it vertically.
But this can be handled in a follow-up.
- I get an error of file not found in the autocomplete widget, but not as a message. Is this intended?
This can also be a follow-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I now see where you want to go with the field validation.
n_m needs a refresh for reposchutz, but we can ignore that for now, as it will bitrot exceedingly fast. Let's resolve the code issues first, and then we can refresh it as the last thing (we can even do this via the workflow now).
f50e3f7
to
beb14b8
Compare
beb14b8
to
f200e65
Compare
001012e
to
52a46fb
Compare
52a46fb
to
6efd18e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! A few remaining small issues, and I also had a look at the coverage report.
Clears a single field in validationFailed object
6efd18e
to
6cd6364
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Cheers!
break; | ||
case "envValue": | ||
break; | ||
default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test. Details
if (!envKey || !envVar) { | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 added lines are not executed by any test. Details
> | ||
<TextInput id={id + "-value"} | ||
value={item.envValue || ''} | ||
validated={validationFailed?.envValue ? "error" : "default"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test. Details
validated={validationFailed?.envValue ? "error" : "default"} | ||
onChange={(_event, value) => { | ||
utils.validationClear(validationFailed, "envValue", onValidationChange); | ||
utils.validationDebounce(() => onValidationChange({ ...validationFailed, envValue: validateEnvVar(value, "envValue") })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test. Details
const containerNameValidation = await this.validateContainerName(containerName); | ||
|
||
if (containerNameValidation) | ||
validationFailed.containerName = containerNameValidation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test. Details
{_("Create and run")} | ||
</Button> | ||
<Button variant='secondary' id="create-image-create-btn" onClick={() => this.onCreateClicked(false)} isDisabled={!image && selectedImage === ""}> | ||
<Button variant='secondary' id="create-image-create-btn" onClick={() => this.onCreateClicked(false)} isDisabled={(!image && selectedImage === "") || this.isFormInvalid(dialogValues.validationFailed)}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test. Details
|
||
break; | ||
} | ||
default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test. Details
return _("Container path must not be empty"); | ||
|
||
break; | ||
default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test. Details
Fixes #609
This introduces both dynamic validation run with "onBlur" and static validation when form is submitted:
Dynamic validation
Screencast.from.2023-07-13.13-16-41.webm
On Form submit validation:
Screencast.from.2023-07-13.13-17-47.webm