Skip to content

A modern, self-hosted backup solution for secure, encrypted backups across local and cloud storage.

fix: minor ui issues

towfiqi8b6645bd5d40
diff --git a/frontend/src/components/Plan/PlanForm/PlanForm.tsx b/frontend/src/components/Plan/PlanForm/PlanForm.tsx
index d08431d..d82db35 100644
--- a/frontend/src/components/Plan/PlanForm/PlanForm.tsx
+++ b/frontend/src/components/Plan/PlanForm/PlanForm.tsx
@@ -5,7 +5,6 @@ import StoragePicker from '../../common/form/StoragePicker/StoragePicker';
import PlanStrategySettings from '../PlanSettings/PlanStrategySettings';
import PlanSourceSettings from '../PlanSettings/PlanSourceSettings';
import { NewPlanSettings } from '../../../@types/plans';
-import NumberInput from '../../common/form/NumberInput/NumberInput';
import classes from '../AddPlan/AddPlan.module.scss';
import PFClasses from './PlanForm.module.scss';
import { useGetSettings } from '../../../services/settings';
diff --git a/frontend/src/components/Plan/PlanSettings/PlanSourceSettings.tsx b/frontend/src/components/Plan/PlanSettings/PlanSourceSettings.tsx
index ad579e6..06d36eb 100644
--- a/frontend/src/components/Plan/PlanSettings/PlanSourceSettings.tsx
+++ b/frontend/src/components/Plan/PlanSettings/PlanSourceSettings.tsx
@@ -1,3 +1,4 @@
+import { useEffect } from 'react';
import classes from './PlanSettings.module.scss';
import PathPicker from '../../common/PathPicker/PathPicker';
import { NewPlanSettings } from '../../../@types/plans';
@@ -27,6 +28,19 @@ const PlanSourceSettings = ({ plan, onUpdate, error, isEditing }: PlanSourceSett
);
}
+ // When the device changes, reset the sourceConfig paths to prevent invalid paths from being submitted
+ useEffect(() => {
+ if (!isEditing) {
+ onUpdate({
+ ...plan,
+ sourceConfig: {
+ includes: [],
+ excludes: [],
+ },
+ });
+ }
+ }, [isEditing, deviceId]);
+
return (
<>
<div className={classes.field}>
diff --git a/frontend/src/components/common/form/StoragePicker/StoragePicker.tsx b/frontend/src/components/common/form/StoragePicker/StoragePicker.tsx
index e220c26..089b966 100644
--- a/frontend/src/components/common/form/StoragePicker/StoragePicker.tsx
+++ b/frontend/src/components/common/form/StoragePicker/StoragePicker.tsx
@@ -70,6 +70,13 @@ const StoragePicker = ({ onUpdate, storagePath = '', storageId, disabled = false
}
}, [selectedStorage, path]);
+ useEffect(() => {
+ if (!disabled) {
+ setSelectedStorage(null);
+ setPath('');
+ }
+ }, [deviceId, disabled]);
+
// console.log('Storage path :', path, !disabled && isLocalStorage && !path);
return (
@@ -98,7 +105,7 @@ const StoragePicker = ({ onUpdate, storagePath = '', storageId, disabled = false
<Input
disabled={disabled}
fieldValue={path}
- onUpdate={(val) => setPath(val.startsWith('/') ? val.slice(1) : val)} //if the val starts with a slash remove it
+ onUpdate={(val) => setPath(!isLocalStorage && val.startsWith('/') ? val.slice(1) : val)} //if the val starts with a slash remove it (only for remote storages, local paths need the leading slash)
placeholder={isLocalStorage ? 'Select a folder' : hasBucketName ? 'subfolder' : `folder-or-bucket/subfolder`}
full={true}
required={!disabled && isLocalStorage}