web: fix error handling bug in ApplicationWizard.RACProviderForm (#12640)
* web: Add InvalidationFlow to Radius Provider dialogues
## What
- Bugfix: adds the InvalidationFlow to the Radius Provider dialogues
- Repairs: `{"invalidation_flow":["This field is required."]}` message, which was *not* propagated
to the Notification.
- Nitpick: Pretties `?foo=${true}` expressions: `s/\?([^=]+)=\$\{true\}/\1/`
## Note
Yes, I know I'm going to have to do more magic when we harmonize the forms, and no, I didn't add the
Property Mappings to the wizard, and yes, I know I'm going to have pain with the *new* version of
the wizard. But this is a serious bug; you can't make Radius servers with *either* of the current
dialogues at the moment.
* This (temporary) change is needed to prevent the unit tests from failing.
\# What
\# Why
\# How
\# Designs
\# Test Steps
\# Other Notes
* Revert "This (temporary) change is needed to prevent the unit tests from failing."
This reverts commit dddde09be5.
* web: fix error handling bug in ui
# What
When I converted all of the Provider forms over to a unified structure, the RAC form
stood out as one that couldn't be directly converted, so two copies were retained.
The error handling was updated to a new format, but this one bit of older handling
was missed.
For now, we're going back to using `Record<string, string>` for errors, to stay as
close to the `./admin/providers/` style of handling.
# Testing
This error prevented the RAC Provider form from loading in the wizard. Seeing that it works in the
wizard should be sufficient.
This commit is contained in:
@ -25,7 +25,7 @@ export class ApplicationWizardProviderForm<T extends OneOfProvider> extends AKEl
|
|||||||
wizard!: ApplicationWizardState;
|
wizard!: ApplicationWizardState;
|
||||||
|
|
||||||
@property({ type: Object, attribute: false })
|
@property({ type: Object, attribute: false })
|
||||||
errors: Map<string | number | symbol, string> = new Map();
|
errors: Record<string | number | symbol, string> = {};
|
||||||
|
|
||||||
@query("form#providerform")
|
@query("form#providerform")
|
||||||
form!: HTMLFormElement;
|
form!: HTMLFormElement;
|
||||||
@ -41,13 +41,13 @@ export class ApplicationWizardProviderForm<T extends OneOfProvider> extends AKEl
|
|||||||
}
|
}
|
||||||
|
|
||||||
get valid() {
|
get valid() {
|
||||||
this.errors = new Map();
|
this.errors = {};
|
||||||
return this.form.checkValidity();
|
return this.form.checkValidity();
|
||||||
}
|
}
|
||||||
|
|
||||||
errorMessages(name: string) {
|
errorMessages(name: string) {
|
||||||
return this.errors.has(name)
|
return name in this.errors
|
||||||
? [this.errors.get(name)]
|
? [this.errors[name]]
|
||||||
: (this.wizard.errors?.provider?.[name] ??
|
: (this.wizard.errors?.provider?.[name] ??
|
||||||
this.wizard.errors?.provider?.[camelToSnake(name)] ??
|
this.wizard.errors?.provider?.[camelToSnake(name)] ??
|
||||||
[]);
|
[]);
|
||||||
@ -56,7 +56,7 @@ export class ApplicationWizardProviderForm<T extends OneOfProvider> extends AKEl
|
|||||||
isValid(name: keyof T) {
|
isValid(name: keyof T) {
|
||||||
return !(
|
return !(
|
||||||
(this.wizard.errors?.provider?.[name as string] ?? []).length > 0 ||
|
(this.wizard.errors?.provider?.[name as string] ?? []).length > 0 ||
|
||||||
this.errors.has(name)
|
this.errors?.[name] !== undefined
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user