In an earlier effort to simplify this validation as part of https://github.com/konveyor/crane-ui-plugin/pull/116, I forgot that the form schema's isValid property would end up true if the source cluster API request hadn't kicked off yet because the user hadn't entered both URL and token yet (because we don't want the fields turning red just because the user is still entering data). I thought I was being redundant by relying on the result of the API request to style the fields as green, so I changed it to use the schema's isValid. That was a mistake and resulted in the fields turning green if one had a value and the other did not.
This PR restores the original behavior of the validation styles on these fields, and also adds string format validation on the API URL field. We'll no longer attempt to configure the proxy if the URL is invalid, instead we'll immediately show an error. This PR also updates the revalidateOnChange criteria of the form so that it will always revalidate when the state of the source cluster API request changes, so we never end up with stale validation errors.
Needs approval from an approver in each of these files:
- ~~[OWNERS](https://github.com/konveyor/crane-ui-plugin/blob/main/OWNERS)~~ [ibolton336,mturley]
Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
Fixes https://issues.redhat.com/browse/MTRHO-129
In an earlier effort to simplify this validation as part of https://github.com/konveyor/crane-ui-plugin/pull/116, I forgot that the form schema's
isValid
property would end uptrue
if the source cluster API request hadn't kicked off yet because the user hadn't entered both URL and token yet (because we don't want the fields turning red just because the user is still entering data). I thought I was being redundant by relying on the result of the API request to style the fields as green, so I changed it to use the schema'sisValid
. That was a mistake and resulted in the fields turning green if one had a value and the other did not.This PR restores the original behavior of the validation styles on these fields, and also adds string format validation on the API URL field. We'll no longer attempt to configure the proxy if the URL is invalid, instead we'll immediately show an error. This PR also updates the
revalidateOnChange
criteria of the form so that it will always revalidate when the state of the source cluster API request changes, so we never end up with stale validation errors.