Skip to content

Commit ac78fe3

Browse files
FEATURE (backups): Add warning when backups is disabled that backups will be removed
1 parent f1620de commit ac78fe3

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

frontend/src/features/backups/ui/EditBackupConfigComponent.tsx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export const EditBackupConfigComponent = ({
7474
const [isShowCreateStorage, setShowCreateStorage] = useState(false);
7575

7676
const [isShowWarn, setIsShowWarn] = useState(false);
77+
const [isShowBackupDisableConfirm, setIsShowBackupDisableConfirm] = useState(false);
7778

7879
const timeFormat = useMemo(() => {
7980
const is12 = getUserTimeFormat();
@@ -206,7 +207,14 @@ export const EditBackupConfigComponent = ({
206207
<div className="min-w-[150px]">Backups enabled</div>
207208
<Switch
208209
checked={backupConfig.isBackupsEnabled}
209-
onChange={(checked) => updateBackupConfig({ isBackupsEnabled: checked })}
210+
onChange={(checked) => {
211+
// If disabling backups on existing database, show confirmation
212+
if (!checked && database.id && backupConfig.isBackupsEnabled) {
213+
setIsShowBackupDisableConfirm(true);
214+
} else {
215+
updateBackupConfig({ isBackupsEnabled: checked });
216+
}
217+
}}
210218
size="small"
211219
/>
212220
</div>
@@ -517,6 +525,22 @@ export const EditBackupConfigComponent = ({
517525
hideCancelButton
518526
/>
519527
)}
528+
529+
{isShowBackupDisableConfirm && (
530+
<ConfirmationComponent
531+
onConfirm={() => {
532+
updateBackupConfig({ isBackupsEnabled: false });
533+
setIsShowBackupDisableConfirm(false);
534+
}}
535+
onDecline={() => {
536+
setIsShowBackupDisableConfirm(false);
537+
}}
538+
description="All current backups will be removed? Are you sure?"
539+
actionButtonColor="red"
540+
actionText="Yes, disable backing up and remove all existing backup files"
541+
cancelText="Cancel"
542+
/>
543+
)}
520544
</div>
521545
);
522546
};

0 commit comments

Comments
 (0)