migtools / crane-ui-plugin

OpenShift Dynamic Plugin for Crane UI
1 stars 11 forks source link

MTRHO-129: Fix regression with cluster API URL validation, validate format of URL string #129

Closed mturley closed 2 years ago

mturley commented 2 years ago

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 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.

openshift-ci[bot] commented 2 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ibolton336, mturley

The full list of commands accepted by this bot can be found here.

The pull request process is described here

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