Skip to content

Commit

Permalink
Merge pull request #371 from ConductionNL/fix/missing-form-fields
Browse files Browse the repository at this point in the history
Added missing form fields
  • Loading branch information
bbrands02 authored Apr 25, 2024
2 parents b48b21d + 7d180c2 commit 71a572a
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ export const ApplicationsFormTemplate: React.FC<ApplicationFormTemplateProps> =
"reference",
"name",
"description",
"version",
"public",
"secret",
"publicKey",
"privateKey",
"resource",
"organization",
"ednpoints",
Expand Down Expand Up @@ -91,7 +93,7 @@ export const ApplicationsFormTemplate: React.FC<ApplicationFormTemplateProps> =
<InputText
{...{ register, errors }}
name="reference"
validation={enrichValidation({ required: true})}
validation={enrichValidation({ required: true })}
disabled={isLoading.applicationForm}
ariaLabel={t("Enter reference")}
/>
Expand Down Expand Up @@ -122,6 +124,18 @@ export const ApplicationsFormTemplate: React.FC<ApplicationFormTemplateProps> =
/>
</FormFieldInput>
</FormField>
<FormField>
<FormFieldInput>
<FormFieldLabel>{t("Version")}</FormFieldLabel>
<InputText
{...{ register, errors }}
name="version"
disabled={isLoading.applicationForm}
defaultValue={application?.version ?? "0.0.0"}
ariaLabel={t("Enter version")}
/>
</FormFieldInput>
</FormField>
<FormField>
<FormFieldInput>
<FormFieldLabel>{t("Domains")}</FormFieldLabel>
Expand Down Expand Up @@ -166,7 +180,7 @@ export const ApplicationsFormTemplate: React.FC<ApplicationFormTemplateProps> =

<FormField>
<FormFieldInput>
<FormFieldLabel>{t("publicKey")}</FormFieldLabel>
<FormFieldLabel>{t("publicKey (write only)")}</FormFieldLabel>
<Textarea
{...{ register, errors }}
name="publicKey"
Expand All @@ -176,6 +190,18 @@ export const ApplicationsFormTemplate: React.FC<ApplicationFormTemplateProps> =
</FormFieldInput>
</FormField>

<FormField>
<FormFieldInput>
<FormFieldLabel>{t("privateKey (write only)")}</FormFieldLabel>
<Textarea
{...{ register, errors }}
name="privateKey"
disabled={isLoading.applicationForm}
ariaLabel={t("Enter privateKey")}
/>
</FormFieldInput>
</FormField>

<FormField>
<FormFieldInput>
<FormFieldLabel>{t("Resource")}</FormFieldLabel>
Expand Down
27 changes: 26 additions & 1 deletion pwa/src/templates/templateParts/userForm/UserFormTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const UserFormTemplate: React.FC<UserFormTemplateProps> = ({ user }) => {
}, [password, validationPassword]);

const handleSetFormValues = (user: any): void => {
const basicFields: string[] = ["name", "description", "email", "password", "locale", "person"];
const basicFields: string[] = ["reference", "name", "description", "version", "email", "password", "locale", "person"];
basicFields.forEach((field) => setValue(field, user[field]));

setValue(
Expand Down Expand Up @@ -117,6 +117,31 @@ export const UserFormTemplate: React.FC<UserFormTemplateProps> = ({ user }) => {
<form onSubmit={handleSubmit(onSubmit)} id={formId} className={styles.formContainer}>
<div className={styles.gridContainer}>
<div className={styles.grid}>
<FormField>
<FormFieldInput>
<FormFieldLabel>{t("Reference")}</FormFieldLabel>
<InputText
{...{ register, errors }}
name="reference"
disabled={isLoading.userForm}
ariaLabel={t("Enter reference")}
/>
</FormFieldInput>
</FormField>

<FormField>
<FormFieldInput>
<FormFieldLabel>{t("Version")}</FormFieldLabel>
<InputText
{...{ register, errors }}
name="version"
disabled={isLoading.userForm}
defaultValue={user?.version ?? "0.0.0"}
ariaLabel={t("Enter version")}
/>
</FormFieldInput>
</FormField>

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

0 comments on commit 71a572a

Please sign in to comment.