1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-30 22:21:13 +03:00

Show grant and client type validation errors

This commit is contained in:
Jake McDermott 2020-07-15 12:05:39 -04:00
parent cd6df9299f
commit d1a4f010b9
No known key found for this signature in database
GPG Key ID: 0E56ED990CDFCB4F

View File

@ -39,6 +39,7 @@ function ApplicationFormFields({
name: 'client_type', name: 'client_type',
validate: required(null, i18n), validate: required(null, i18n),
}); });
return ( return (
<> <>
<FormField <FormField
@ -68,8 +69,12 @@ function ApplicationFormFields({
<FormGroup <FormGroup
fieldId="authType" fieldId="authType"
helperTextInvalid={authorizationTypeMeta.error} helperTextInvalid={authorizationTypeMeta.error}
validated={
!authorizationTypeMeta.touched || !authorizationTypeMeta.error
? 'default'
: 'error'
}
isRequired isRequired
isValid={!authorizationTypeMeta.touched || !authorizationTypeMeta.error}
label={i18n._(t`Authorization grant type`)} label={i18n._(t`Authorization grant type`)}
> >
<FieldTooltip <FieldTooltip
@ -79,6 +84,9 @@ function ApplicationFormFields({
/> />
<AnsibleSelect <AnsibleSelect
{...authorizationTypeField} {...authorizationTypeField}
isValid={
!authorizationTypeMeta.touched || !authorizationTypeMeta.error
}
isDisabled={match.url.endsWith('edit')} isDisabled={match.url.endsWith('edit')}
id="authType" id="authType"
data={[{ label: '', key: 1, value: '' }, ...authorizationOptions]} data={[{ label: '', key: 1, value: '' }, ...authorizationOptions]}
@ -105,8 +113,10 @@ function ApplicationFormFields({
<FormGroup <FormGroup
fieldId="clientType" fieldId="clientType"
helperTextInvalid={clientTypeMeta.error} helperTextInvalid={clientTypeMeta.error}
validated={
!clientTypeMeta.touched || !clientTypeMeta.error ? 'default' : 'error'
}
isRequired isRequired
isValid={!clientTypeMeta.touched || !clientTypeMeta.error}
label={i18n._(t`Client type`)} label={i18n._(t`Client type`)}
> >
<FieldTooltip <FieldTooltip
@ -116,6 +126,7 @@ function ApplicationFormFields({
/> />
<AnsibleSelect <AnsibleSelect
{...clientTypeField} {...clientTypeField}
isValid={!clientTypeMeta.touched || !clientTypeMeta.error}
id="clientType" id="clientType"
data={[{ label: '', key: 1, value: '' }, ...clientTypeOptions]} data={[{ label: '', key: 1, value: '' }, ...clientTypeOptions]}
onChange={(event, value) => { onChange={(event, value) => {