mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
fix: bug ongoing backup deletion
This commit is contained in:
@@ -12,7 +12,7 @@ import {useMutation, useQueryClient} from "@tanstack/react-query";
|
||||
import {toast} from "sonner";
|
||||
import {MemberWithUser} from "@/db/schema/03_organization";
|
||||
import {deleteBackupAction} from "@/components/wrappers/dashboard/database/backup/actions/backup-actions.action";
|
||||
import { ButtonWithConfirm } from "@/components/wrappers/common/button/button-with-confirm";
|
||||
import {ButtonWithConfirm} from "@/components/wrappers/common/button/button-with-confirm";
|
||||
|
||||
|
||||
type DatabaseBackupListProps = {
|
||||
@@ -69,19 +69,12 @@ export const DatabaseBackupList = (props: DatabaseBackupListProps) => {
|
||||
mutationFn: async (backups: Backup[]) => {
|
||||
const results = await Promise.all(
|
||||
backups.map(async (backup) => {
|
||||
if (backup.deletedAt == null) {
|
||||
if (backup.deletedAt == null || backup.status == "ongoing") {
|
||||
|
||||
const backupDeleted = await deleteBackupAction({
|
||||
databaseId: backup.databaseId,
|
||||
backupId: backup.id,
|
||||
})
|
||||
// const backupDeleted = await deleteBackupAction({
|
||||
// backupId: backup.id,
|
||||
// databaseId: backup.databaseId,
|
||||
// status: backup.status,
|
||||
// file: backup.file ?? "",
|
||||
// projectSlug: props.database?.project?.slug!
|
||||
// });
|
||||
return {
|
||||
success: backupDeleted?.data?.success,
|
||||
message: backupDeleted?.data?.success
|
||||
@@ -136,15 +129,9 @@ export const DatabaseBackupList = (props: DatabaseBackupListProps) => {
|
||||
>Actions</ButtonWithLoading>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="start">
|
||||
<ButtonWithConfirm
|
||||
<ButtonWithConfirm
|
||||
onConfirm={() => {
|
||||
const backupsToDelete = rows.map(row => row
|
||||
).filter(backup => backup.deletedAt == null)
|
||||
if (backupsToDelete.length === 0) {
|
||||
toast.error("No available backup selected for deletion.");
|
||||
return;
|
||||
}
|
||||
mutationDeleteBackups.mutate(backupsToDelete);
|
||||
mutationDeleteBackups.mutate(rows);
|
||||
setIsActionsOpen(false);
|
||||
}}
|
||||
onCancel={() => setIsActionsOpen(false)}
|
||||
|
||||
Reference in New Issue
Block a user