Compare commits
1 commit
main
...
v0.23.0-be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c0e2f520f |
1 changed files with 33 additions and 1 deletions
|
|
@ -35,6 +35,7 @@ export const ScheduleSummary = (props: Props) => {
|
||||||
props;
|
props;
|
||||||
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
||||||
const [showForgetConfirm, setShowForgetConfirm] = useState(false);
|
const [showForgetConfirm, setShowForgetConfirm] = useState(false);
|
||||||
|
const [showStopConfirm, setShowStopConfirm] = useState(false);
|
||||||
|
|
||||||
const runForget = useMutation({
|
const runForget = useMutation({
|
||||||
...runForgetMutation(),
|
...runForgetMutation(),
|
||||||
|
|
@ -78,6 +79,12 @@ export const ScheduleSummary = (props: Props) => {
|
||||||
runForget.mutate({ path: { scheduleId: schedule.id.toString() } });
|
runForget.mutate({ path: { scheduleId: schedule.id.toString() } });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleConfirmStop = () => {
|
||||||
|
setShowStopConfirm(false);
|
||||||
|
if (schedule.lastBackupStatus !== "in_progress") return;
|
||||||
|
handleStopBackup();
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<Card>
|
<Card>
|
||||||
|
|
@ -108,7 +115,12 @@ export const ScheduleSummary = (props: Props) => {
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col @lg:flex-row gap-2">
|
<div className="flex flex-col @lg:flex-row gap-2">
|
||||||
{schedule.lastBackupStatus === "in_progress" ? (
|
{schedule.lastBackupStatus === "in_progress" ? (
|
||||||
<Button variant="destructive" size="sm" onClick={handleStopBackup} className="w-full @md:w-auto">
|
<Button
|
||||||
|
variant="destructive"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => setShowStopConfirm(true)}
|
||||||
|
className="w-full @md:w-auto"
|
||||||
|
>
|
||||||
<Square className="h-4 w-4 mr-2" />
|
<Square className="h-4 w-4 mr-2" />
|
||||||
<span>Stop backup</span>
|
<span>Stop backup</span>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
@ -239,6 +251,26 @@ export const ScheduleSummary = (props: Props) => {
|
||||||
</div>
|
</div>
|
||||||
</AlertDialogContent>
|
</AlertDialogContent>
|
||||||
</AlertDialog>
|
</AlertDialog>
|
||||||
|
|
||||||
|
<AlertDialog open={showStopConfirm} onOpenChange={setShowStopConfirm}>
|
||||||
|
<AlertDialogContent>
|
||||||
|
<AlertDialogHeader>
|
||||||
|
<AlertDialogTitle>Stop running backup?</AlertDialogTitle>
|
||||||
|
<AlertDialogDescription>
|
||||||
|
Are you sure you want to stop the current backup for <strong>{schedule.name}</strong>?
|
||||||
|
</AlertDialogDescription>
|
||||||
|
</AlertDialogHeader>
|
||||||
|
<div className="flex gap-3 justify-end">
|
||||||
|
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||||
|
<AlertDialogAction
|
||||||
|
onClick={handleConfirmStop}
|
||||||
|
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
|
||||||
|
>
|
||||||
|
Stop backup
|
||||||
|
</AlertDialogAction>
|
||||||
|
</div>
|
||||||
|
</AlertDialogContent>
|
||||||
|
</AlertDialog>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue