mirror of
https://github.com/ansible/awx.git
synced 2026-05-11 19:37:38 -02:30
fix multiple notification form bugs
This commit is contained in:
@@ -54,12 +54,13 @@ function NotificationTemplateFormFields({ i18n, defaultMessages }) {
|
||||
fieldId="notification-type"
|
||||
helperTextInvalid={typeMeta.error}
|
||||
isRequired
|
||||
validated={!typeMeta.touched || typeMeta.error ? 'default' : 'error'}
|
||||
validated={!typeMeta.touched || !typeMeta.error ? 'default' : 'error'}
|
||||
label={i18n._(t`Type`)}
|
||||
>
|
||||
<AnsibleSelect
|
||||
{...typeField}
|
||||
id="notification-type"
|
||||
isValid={!typeMeta.touched || !typeMeta.error}
|
||||
data={[
|
||||
{
|
||||
value: '',
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
required,
|
||||
requiredEmail,
|
||||
url,
|
||||
minMaxValue,
|
||||
} from '../../../util/validators';
|
||||
import { NotificationType } from '../../../types';
|
||||
|
||||
@@ -104,16 +105,17 @@ function EmailFields({ i18n }) {
|
||||
label={i18n._(t`Port`)}
|
||||
name="notification_configuration.port"
|
||||
type="number"
|
||||
validate={required(null, i18n)}
|
||||
validate={combine([required(null, i18n), minMaxValue(1, 65535, i18n)])}
|
||||
isRequired
|
||||
min="0"
|
||||
max="65535"
|
||||
/>
|
||||
<FormField
|
||||
id="email-timeout"
|
||||
label={i18n._(t`Timeout`)}
|
||||
name="notification_configuration.timeout"
|
||||
type="number"
|
||||
validate={required(null, i18n)}
|
||||
validate={combine([required(null, i18n), minMaxValue(1, 120, i18n)])}
|
||||
isRequired
|
||||
min="1"
|
||||
max="120"
|
||||
@@ -306,7 +308,7 @@ function PagerdutyFields({ i18n }) {
|
||||
label={i18n._(t`Pagerduty subdomain`)}
|
||||
name="notification_configuration.subdomain"
|
||||
type="text"
|
||||
validate={required(i18n)}
|
||||
validate={required(null, i18n)}
|
||||
isRequired
|
||||
/>
|
||||
<FormField
|
||||
@@ -314,7 +316,7 @@ function PagerdutyFields({ i18n }) {
|
||||
label={i18n._(t`API service/integration key`)}
|
||||
name="notification_configuration.service_key"
|
||||
type="text"
|
||||
validate={required(i18n)}
|
||||
validate={required(null, i18n)}
|
||||
isRequired
|
||||
/>
|
||||
<FormField
|
||||
@@ -322,7 +324,7 @@ function PagerdutyFields({ i18n }) {
|
||||
label={i18n._(t`Client identifier`)}
|
||||
name="notification_configuration.client_name"
|
||||
type="text"
|
||||
validate={required(i18n)}
|
||||
validate={required(null, i18n)}
|
||||
isRequired
|
||||
/>
|
||||
</>
|
||||
|
||||
@@ -48,7 +48,8 @@ export default typeFieldNames;
|
||||
const initialConfigValues = {};
|
||||
Object.keys(typeFieldNames).forEach(key => {
|
||||
typeFieldNames[key].forEach(fieldName => {
|
||||
initialConfigValues[fieldName] = '';
|
||||
const isBoolean = fieldName.includes('_ssl');
|
||||
initialConfigValues[fieldName] = isBoolean ? false : '';
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user