feat: backup improvements
All checks were successful
Deploy to Staging / Build Images (push) Successful in 4m31s
Deploy to Staging / Deploy to Staging (push) Successful in 37s
Deploy to Staging / Verify Staging (push) Successful in 6s
Deploy to Staging / Notify Staging Ready (push) Successful in 6s
Deploy to Staging / Notify Staging Failure (push) Has been skipped
All checks were successful
Deploy to Staging / Build Images (push) Successful in 4m31s
Deploy to Staging / Deploy to Staging (push) Successful in 37s
Deploy to Staging / Verify Staging (push) Successful in 6s
Deploy to Staging / Notify Staging Ready (push) Successful in 6s
Deploy to Staging / Notify Staging Failure (push) Has been skipped
This commit is contained in:
@@ -127,6 +127,7 @@ export const AdminBackupPage: React.FC = () => {
|
||||
const [scheduleFrequency, setScheduleFrequency] = useState<BackupFrequency>('daily');
|
||||
const [scheduleRetention, setScheduleRetention] = useState(7);
|
||||
const [scheduleEnabled, setScheduleEnabled] = useState(true);
|
||||
const [createSafetyBackup, setCreateSafetyBackup] = useState(true);
|
||||
|
||||
// Queries
|
||||
const { data: backupsData, isLoading: backupsLoading } = useBackups();
|
||||
@@ -210,14 +211,18 @@ export const AdminBackupPage: React.FC = () => {
|
||||
|
||||
const handleExecuteRestore = useCallback(() => {
|
||||
if (!selectedBackup) return;
|
||||
executeRestoreMutation.mutate(selectedBackup.id, {
|
||||
onSuccess: () => {
|
||||
setRestoreDialogOpen(false);
|
||||
setRestorePreviewDialogOpen(false);
|
||||
setSelectedBackup(null);
|
||||
},
|
||||
});
|
||||
}, [selectedBackup, executeRestoreMutation]);
|
||||
executeRestoreMutation.mutate(
|
||||
{ id: selectedBackup.id, options: { createSafetyBackup } },
|
||||
{
|
||||
onSuccess: () => {
|
||||
setRestoreDialogOpen(false);
|
||||
setRestorePreviewDialogOpen(false);
|
||||
setSelectedBackup(null);
|
||||
setCreateSafetyBackup(true);
|
||||
},
|
||||
}
|
||||
);
|
||||
}, [selectedBackup, createSafetyBackup, executeRestoreMutation]);
|
||||
|
||||
// Handlers for schedules
|
||||
const handleCreateSchedule = useCallback(() => {
|
||||
@@ -820,9 +825,22 @@ export const AdminBackupPage: React.FC = () => {
|
||||
</Box>
|
||||
) : restorePreviewMutation.data ? (
|
||||
<Box sx={{ mt: 2 }}>
|
||||
<Alert severity="warning" sx={{ mb: 3 }}>
|
||||
A safety backup will be created automatically before restoring.
|
||||
</Alert>
|
||||
<Box sx={{ mb: 3 }}>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Switch
|
||||
checked={createSafetyBackup}
|
||||
onChange={(e) => setCreateSafetyBackup(e.target.checked)}
|
||||
/>
|
||||
}
|
||||
label="Create safety backup before restoring"
|
||||
/>
|
||||
{!createSafetyBackup && (
|
||||
<Alert severity="warning" sx={{ mt: 1 }}>
|
||||
Warning: Without a safety backup, you cannot undo this restore operation.
|
||||
</Alert>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
<Typography variant="h6" gutterBottom>
|
||||
Backup Information
|
||||
@@ -897,8 +915,10 @@ export const AdminBackupPage: React.FC = () => {
|
||||
<DialogTitle>Confirm Restore</DialogTitle>
|
||||
<DialogContent>
|
||||
<Alert severity="error" sx={{ mb: 2 }}>
|
||||
This action will replace all current data with the backup data. A safety backup will be
|
||||
created first.
|
||||
This action will replace all current data with the backup data.
|
||||
{createSafetyBackup
|
||||
? ' A safety backup will be created first.'
|
||||
: ' No safety backup will be created - this cannot be undone!'}
|
||||
</Alert>
|
||||
<Typography>
|
||||
Are you sure you want to restore from "{selectedBackup?.filename}"?
|
||||
|
||||
Reference in New Issue
Block a user