mirror of
https://github.com/garethgeorge/backrest.git
synced 2026-08-28 03:46:29 +00:00
fix: bugs in env var validation and form field handling
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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}
|
||||
@@ -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 />}
|
||||
>
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user