Skip to content

Commit

Permalink
fix: bugs in env var validation and form field handling
Browse files Browse the repository at this point in the history
  • Loading branch information
garethgeorge committed Mar 2, 2024
1 parent 1f42b6a commit 7e909c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions webui/src/views/AddPlanModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -392,16 +392,6 @@ export const AddPlanModal = ({
</Form.Item>
</Tooltip>

{/* Plan.retention */}
<RetentionPolicyView />

{/* Plan.hooks */}
<Form.Item
label={<Tooltip title={hooksListTooltipText}>Hooks</Tooltip>}
>
<HooksFormList />
</Form.Item>

{/* Plan.backup_flags */}
<Form.Item label={<Tooltip title="Extra flags to add to the 'restic backup' command">Backup Flags</Tooltip>}>
<Form.List
Expand Down Expand Up @@ -450,6 +440,16 @@ export const AddPlanModal = ({
</Form.List>
</Form.Item>

{/* Plan.retention */}
<RetentionPolicyView />

{/* Plan.hooks */}
<Form.Item
label={<Tooltip title={hooksListTooltipText}>Hooks</Tooltip>}
>
<HooksFormList />
</Form.Item>

<Form.Item shouldUpdate label="Preview">
{() => (
<Collapse
Expand Down
6 changes: 3 additions & 3 deletions webui/src/views/AddRepoModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ export const AddRepoModal = ({
{(fields, { add, remove }, { errors }) => (
<>
{fields.map((field, index) => (
console.log("FIELD: ", field),
<Form.Item key={field.key}>
<Form.Item
{...field}
Expand Down Expand Up @@ -315,7 +314,7 @@ export const AddRepoModal = ({
<Form.Item>
<Button
type="dashed"
onClick={() => add("THIS IS A NEW VALUE")}
onClick={() => add("")}
style={{ width: "90%" }}
icon={<PlusOutlined />}
>
Expand Down Expand Up @@ -488,8 +487,9 @@ const envVarSetValidator = (form: FormInstance<FormData>, envVars: string[]) =>
});

// check that password is provided in some form
const password = form.getFieldValue("password");
if (
form.getFieldValue("password").length === 0 &&
(!password || password.length === 0) &&
!envVarNames.includes("RESTIC_PASSWORD") &&
!envVarNames.includes("RESTIC_PASSWORD_COMMAND") &&
!envVarNames.includes("RESTIC_PASSWORD_FILE")
Expand Down

0 comments on commit 7e909c4

Please sign in to comment.