Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

fix(storages): SFTP auth method radio button now correctly switches to Private Key

Yassine Fathi7d8d0846cb09
diff --git a/frontend/src/features/storages/ui/edit/storages/EditSFTPStorageComponent.tsx b/frontend/src/features/storages/ui/edit/storages/EditSFTPStorageComponent.tsx
index 63f8cd68..f20df064 100644
--- a/frontend/src/features/storages/ui/edit/storages/EditSFTPStorageComponent.tsx
+++ b/frontend/src/features/storages/ui/edit/storages/EditSFTPStorageComponent.tsx
@@ -14,7 +14,8 @@ export function EditSFTPStorageComponent({ storage, setStorage, setUnsaved }: Pr
const hasAdvancedValues = !!storage?.sftpStorage?.skipHostKeyVerify;
const [showAdvanced, setShowAdvanced] = useState(hasAdvancedValues);
- const authMethod = storage?.sftpStorage?.privateKey ? 'privateKey' : 'password';
+ const initialAuthMethod = storage?.sftpStorage?.privateKey !== undefined ? 'privateKey' : 'password';
+ const [authMethod, setAuthMethod] = useState<'password' | 'privateKey'>(initialAuthMethod);
return (
<>
@@ -93,7 +94,10 @@ export function EditSFTPStorageComponent({ storage, setStorage, setUnsaved }: Pr
onChange={(e) => {
if (!storage?.sftpStorage) return;
- if (e.target.value === 'password') {
+ const newMethod = e.target.value as 'password' | 'privateKey';
+ setAuthMethod(newMethod);
+
+ if (newMethod === 'password') {
setStorage({
...storage,
sftpStorage: {