Merge pull request #9869 from jakemcdermott/fix-cred-validation-prop

Use validated prop in cred plugin field

SUMMARY
Fxes an initialization bug for cred plugin fields, introduced by this commit
This pr applies the patch described below:
cc @marshmalien @unlikelyzero

before


after

Reviewed-by: John Hill <johill@redhat.com>
This commit is contained in:
softwarefactory-project-zuul[bot] 2021-04-09 16:20:20 +00:00 committed by GitHub
commit c7a2a1b9f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,7 +22,7 @@ function CredentialPluginInput(props) {
i18n,
isDisabled,
isRequired,
isValid,
validated,
fieldOptions,
} = props;
@ -52,7 +52,7 @@ function CredentialPluginInput(props) {
{React.cloneElement(children, {
...inputField,
isRequired,
validated: isValid ? 'default' : 'error',
validated: validated ? 'default' : 'error',
isDisabled: disableFieldAndButtons,
onChange: (_, event) => {
inputField.onChange(event);
@ -96,7 +96,7 @@ function CredentialPluginInput(props) {
}
function CredentialPluginField(props) {
const { fieldOptions, isRequired, isValid } = props;
const { fieldOptions, isRequired, validated } = props;
const [, meta, helpers] = useField(`inputs.${fieldOptions.id}`);
const [passwordPromptField] = useField(`passwordPrompts.${fieldOptions.id}`);
@ -136,7 +136,7 @@ function CredentialPluginField(props) {
fieldId={`credential-${fieldOptions.id}`}
helperTextInvalid={meta.error}
isRequired={isRequired}
validated={isValid ? 'default' : 'error'}
validated={validated ? 'default' : 'error'}
label={fieldOptions.label}
labelIcon={
fieldOptions.help_text && (