Skip to content

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

FIX (databases): Fix second opening of storage & notifier creation dialogs

Rostislav Dugin2bafec3c19c6
diff --git a/frontend/src/features/backups/ui/EditBackupConfigComponent.tsx b/frontend/src/features/backups/ui/EditBackupConfigComponent.tsx
index e6139a64..737f45ac 100644
--- a/frontend/src/features/backups/ui/EditBackupConfigComponent.tsx
+++ b/frontend/src/features/backups/ui/EditBackupConfigComponent.tsx
@@ -72,6 +72,7 @@ export const EditBackupConfigComponent = ({
const [storages, setStorages] = useState<Storage[]>([]);
const [isStoragesLoading, setIsStoragesLoading] = useState(false);
const [isShowCreateStorage, setShowCreateStorage] = useState(false);
+ const [storageSelectKey, setStorageSelectKey] = useState(0);
const [isShowWarn, setIsShowWarn] = useState(false);
@@ -397,6 +398,7 @@ export const EditBackupConfigComponent = ({
<div className="mb-1 min-w-[150px] sm:mb-0">Storage</div>
<div className="flex w-full items-center">
<Select
+ key={storageSelectKey}
value={backupConfig.storage?.id}
onChange={(storageId) => {
if (storageId.includes('create-new-storage')) {
@@ -527,7 +529,10 @@ export const EditBackupConfigComponent = ({
title="Add storage"
footer={<div />}
open={isShowCreateStorage}
- onCancel={() => setShowCreateStorage(false)}
+ onCancel={() => {
+ setShowCreateStorage(false);
+ setStorageSelectKey((prev) => prev + 1);
+ }}
>
<div className="my-3 max-w-[275px] text-gray-500 dark:text-gray-400">
Storage - is a place where backups will be stored (local disk, S3, Google Drive, etc.)
diff --git a/frontend/src/features/databases/ui/edit/EditDatabaseNotifiersComponent.tsx b/frontend/src/features/databases/ui/edit/EditDatabaseNotifiersComponent.tsx
index 38be8de8..01bd1032 100644
--- a/frontend/src/features/databases/ui/edit/EditDatabaseNotifiersComponent.tsx
+++ b/frontend/src/features/databases/ui/edit/EditDatabaseNotifiersComponent.tsx
@@ -43,6 +43,7 @@ export const EditDatabaseNotifiersComponent = ({
const [notifiers, setNotifiers] = useState<Notifier[]>([]);
const [isNotifiersLoading, setIsNotifiersLoading] = useState(false);
const [isShowCreateNotifier, setShowCreateNotifier] = useState(false);
+ const [notifierSelectKey, setNotifierSelectKey] = useState(0);
const saveDatabase = async () => {
if (!editingDatabase) return;
@@ -104,6 +105,7 @@ export const EditDatabaseNotifiersComponent = ({
<div className="min-w-[150px]">Notifiers</div>
<Select
+ key={notifierSelectKey}
mode="multiple"
value={editingDatabase.notifiers.map((n) => n.id)}
onChange={(notifiersIds) => {
@@ -160,7 +162,10 @@ export const EditDatabaseNotifiersComponent = ({
title="Add notifier"
footer={<div />}
open={isShowCreateNotifier}
- onCancel={() => setShowCreateNotifier(false)}
+ onCancel={() => {
+ setShowCreateNotifier(false);
+ setNotifierSelectKey((prev) => prev + 1);
+ }}
>
<div className="my-3 max-w-[275px] text-gray-500 dark:text-gray-400">
Notifier - is a place where notifications will be sent (email, Slack, Telegram, etc.)