Skip to content

Commit

Permalink
Merge pull request #370 from ConductionNL/fix/reference-fields
Browse files Browse the repository at this point in the history
Added reference fields to Application and SecurityGroup forms
  • Loading branch information
bbrands02 authored Apr 22, 2024
2 parents 254991a + c20ae75 commit b48b21d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const ApplicationsFormTemplate: React.FC<ApplicationFormTemplateProps> =

const handleSetFormValues = (application: any): void => {
const basicFields: string[] = [
"reference",
"name",
"description",
"public",
Expand Down Expand Up @@ -84,6 +85,19 @@ export const ApplicationsFormTemplate: React.FC<ApplicationFormTemplateProps> =
<form onSubmit={handleSubmit(onSubmit)} id={formId} className={styles.form}>
<div className={styles.gridContainer}>
<div className={styles.grid}>
<FormField>
<FormFieldInput>
<FormFieldLabel>{t("Reference")}</FormFieldLabel>
<InputText
{...{ register, errors }}
name="reference"
validation={enrichValidation({ required: true})}
disabled={isLoading.applicationForm}
ariaLabel={t("Enter reference")}
/>
</FormFieldInput>
</FormField>

<FormField>
<FormFieldInput>
<FormFieldLabel>{t("Name")}</FormFieldLabel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const SecurityGroupFormTemplate: React.FC<SecurityGroupFormTemplateProps>
};

const handleSetFormValues = (): void => {
const basicFields: string[] = ["name", "description", "config"];
const basicFields: string[] = ["reference", "name", "description", "config"];
basicFields.forEach((field) => setValue(field, securityGroup[field]));

setValue(
Expand All @@ -62,6 +62,19 @@ export const SecurityGroupFormTemplate: React.FC<SecurityGroupFormTemplateProps>
<form onSubmit={handleSubmit(onSubmit)} id={formId}>
<div className={styles.gridContainer}>
<div className={styles.grid}>
<FormField>
<FormFieldInput>
<FormFieldLabel>{t("Reference")}</FormFieldLabel>
<InputText
{...{ register, errors }}
name="reference"
validation={enrichValidation({ required: true})}
disabled={isLoading.securityGroupForm}
ariaLabel={t("Enter reference")}
/>
</FormFieldInput>
</FormField>

<FormField>
<FormFieldInput>
<FormFieldLabel>{t("Name")}</FormFieldLabel>
Expand Down

0 comments on commit b48b21d

Please sign in to comment.