A modern, self-hosted backup solution for secure, encrypted backups across local and cloud storage.
fix: missing warning in Plan Creation UI for local storage with no path selection.
towfiqi95d770efa9cc
diff --git a/frontend/src/components/common/form/StoragePicker/StoragePicker.tsx b/frontend/src/components/common/form/StoragePicker/StoragePicker.tsxindex a3cb8c8..780455b 100644--- a/frontend/src/components/common/form/StoragePicker/StoragePicker.tsx+++ b/frontend/src/components/common/form/StoragePicker/StoragePicker.tsx@@ -17,9 +17,10 @@ interface StoragePickerProps {}const StoragePicker = ({ onUpdate, storagePath = '', storageId, disabled = false, deviceId }: StoragePickerProps) => {- const [slectedStorage, setSelectedStorage] = useState<null | storageItem>();+ const [selectedStorage, setSelectedStorage] = useState<null | storageItem>();const [showFolderPicker, setShowFolderPicker] = useState(false);const [path, setPath] = useState(() => storagePath);+ const isLocalStorage = selectedStorage?.type === 'local';const { data: allStorageData } = useGetStorages();const allUserStorages = (allStorageData?.result as storageItem[]) || [];@@ -50,10 +51,12 @@ const StoragePicker = ({ onUpdate, storagePath = '', storageId, disabled = false}, [allStorageData]);useEffect(() => {- if (slectedStorage) {- onUpdate({ storage: slectedStorage, path });+ if (selectedStorage) {+ onUpdate({ storage: selectedStorage, path });}- }, [slectedStorage, path]);+ }, [selectedStorage, path]);++ console.log('Storage path :', path, !disabled && isLocalStorage && !path);return (<div className={classes.storagePicker}>@@ -61,7 +64,7 @@ const StoragePicker = ({ onUpdate, storagePath = '', storageId, disabled = false<div><div className={classes.storage}><Select- fieldValue={slectedStorage?.id ? slectedStorage.id : ''}+ fieldValue={selectedStorage?.id ? selectedStorage.id : ''}options={[{ label: 'Select Storage', value: '', icon: 'storages' }, ...storageOptions]}onUpdate={selectStorage}full={true}@@ -73,10 +76,12 @@ const StoragePicker = ({ onUpdate, storagePath = '', storageId, disabled = falsedisabled={disabled}fieldValue={path}onUpdate={(val) => setPath(val)}- placeholder="folder-or-bucket/subfolder"+ placeholder={isLocalStorage ? 'Select a folder' : `folder-or-bucket/subfolder`}full={true}+ required={!disabled && isLocalStorage}+ error={(!disabled && isLocalStorage && !path ? 'Required' : '') as string}/>- {slectedStorage?.type && !disabled && slectedStorage.type === 'local' && (+ {selectedStorage?.type && !disabled && selectedStorage.type === 'local' && (<buttonclassName={classes.fileManagerBtn}data-tooltip-id="appTooltip"diff --git a/frontend/src/utils/plans.ts b/frontend/src/utils/plans.tsindex c6e3dc4..dc73f89 100644--- a/frontend/src/utils/plans.ts+++ b/frontend/src/utils/plans.ts@@ -52,9 +52,15 @@ export function isPlanSettingsValid(newPlan: NewPlanSettings, step: number | faltoast.error(`Storage is required`);return false;}- if ((step === 2 || step === false) && newPlan.sourceConfig.includes.length === 0) {- toast.error(`Sources are required`);- return false;+ if (step === 2 || step === false) {+ if (newPlan.sourceConfig.includes.length === 0) {+ toast.error(`Sources are required`);+ return false;+ }+ if (newPlan.storage.id === 'local' && newPlan.storagePath === '') {+ toast.error(`Storage Path is required`);+ return false;+ }}if ((step === 4 || step === false) && newPlan.settings.notification.email.enabled && !newPlan.settings.notification.email.emails) {toast.error(`Notification Email not provided`);