Skip to content

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

FIX (storages): Auto-select newly created storage in backup config wizard

Pierre Clavequinabcf76977e29
diff --git a/frontend/src/features/backups/logical/ui/EditLogicalBackupConfigComponent.tsx b/frontend/src/features/backups/logical/ui/EditLogicalBackupConfigComponent.tsx
index e3918e67..b02c7f40 100644
--- a/frontend/src/features/backups/logical/ui/EditLogicalBackupConfigComponent.tsx
+++ b/frontend/src/features/backups/logical/ui/EditLogicalBackupConfigComponent.tsx
@@ -809,9 +809,14 @@ export const EditLogicalBackupConfigComponent = ({
isShowName
isShowClose={false}
onClose={() => setShowCreateStorage(false)}
- onChanged={() => {
- loadStorages();
+ onChanged={async (createdStorage) => {
+ const hadExistingStorage = !!backupConfig?.storage?.id;
+ await loadStorages();
+ updateBackupConfig({ storage: createdStorage });
setShowCreateStorage(false);
+ if (hadExistingStorage) {
+ setIsShowWarn(true);
+ }
}}
/>
</Modal>
diff --git a/frontend/src/features/backups/physical/ui/EditPhysicalBackupConfigComponent.tsx b/frontend/src/features/backups/physical/ui/EditPhysicalBackupConfigComponent.tsx
index 3328ae2c..715245fe 100644
--- a/frontend/src/features/backups/physical/ui/EditPhysicalBackupConfigComponent.tsx
+++ b/frontend/src/features/backups/physical/ui/EditPhysicalBackupConfigComponent.tsx
@@ -659,9 +659,14 @@ export const EditPhysicalBackupConfigComponent = ({
isShowName
isShowClose={false}
onClose={() => setShowCreateStorage(false)}
- onChanged={() => {
- loadStorages();
+ onChanged={async (createdStorage) => {
+ const hadExistingStorage = !!backupConfig?.storage?.id;
+ await loadStorages();
+ updateBackupConfig({ storage: createdStorage });
setShowCreateStorage(false);
+ if (hadExistingStorage) {
+ setIsShowWarn(true);
+ }
}}
/>
</Modal>
diff --git a/frontend/src/features/storages/ui/edit/EditStorageComponent.tsx b/frontend/src/features/storages/ui/edit/EditStorageComponent.tsx
index 8998414e..1b2346b1 100644
--- a/frontend/src/features/storages/ui/edit/EditStorageComponent.tsx
+++ b/frontend/src/features/storages/ui/edit/EditStorageComponent.tsx
@@ -51,8 +51,8 @@ export function EditStorageComponent({
setIsSaving(true);
try {
- await storageApi.saveStorage(storage);
- onChanged(storage);
+ const savedStorage = await storageApi.saveStorage(storage);
+ onChanged(savedStorage);
setIsUnsaved(false);
} catch (e) {
alert((e as Error).message);