|
|
|
@ -3,9 +3,8 @@ import { Action, PageTable } from "@/components";
|
|
|
|
|
import { useModals } from "@/modules/modals";
|
|
|
|
|
import { useTableStyles } from "@/styles";
|
|
|
|
|
import { Environment } from "@/utilities";
|
|
|
|
|
import { faClock, faHistory, faTrash } from "@fortawesome/free-solid-svg-icons";
|
|
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
|
|
import { Anchor, Group, Text } from "@mantine/core";
|
|
|
|
|
import { faHistory, faTrash } from "@fortawesome/free-solid-svg-icons";
|
|
|
|
|
import { Anchor, Text } from "@mantine/core";
|
|
|
|
|
import { FunctionComponent, useMemo } from "react";
|
|
|
|
|
import { Column } from "react-table";
|
|
|
|
|
|
|
|
|
@ -16,10 +15,6 @@ interface Props {
|
|
|
|
|
const Table: FunctionComponent<Props> = ({ backups }) => {
|
|
|
|
|
const columns: Column<System.Backups>[] = useMemo<Column<System.Backups>[]>(
|
|
|
|
|
() => [
|
|
|
|
|
{
|
|
|
|
|
accessor: "type",
|
|
|
|
|
Cell: <FontAwesomeIcon icon={faClock}></FontAwesomeIcon>,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Header: "Name",
|
|
|
|
|
accessor: "filename",
|
|
|
|
@ -50,52 +45,61 @@ const Table: FunctionComponent<Props> = ({ backups }) => {
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: "actions",
|
|
|
|
|
id: "restore",
|
|
|
|
|
Header: "Restore",
|
|
|
|
|
accessor: "filename",
|
|
|
|
|
Cell: ({ value }) => {
|
|
|
|
|
const modals = useModals();
|
|
|
|
|
const restore = useRestoreBackups();
|
|
|
|
|
return (
|
|
|
|
|
<Action
|
|
|
|
|
label="Restore"
|
|
|
|
|
onClick={() =>
|
|
|
|
|
modals.openConfirmModal({
|
|
|
|
|
title: "Restore Backup",
|
|
|
|
|
children: (
|
|
|
|
|
<Text size="sm">
|
|
|
|
|
Are you sure you want to restore the backup ({value})?
|
|
|
|
|
Bazarr will automatically restart and reload the UI during
|
|
|
|
|
the restore process.
|
|
|
|
|
</Text>
|
|
|
|
|
),
|
|
|
|
|
labels: { confirm: "Restore", cancel: "Cancel" },
|
|
|
|
|
confirmProps: { color: "red" },
|
|
|
|
|
onConfirm: () => restore.mutate(value),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
icon={faHistory}
|
|
|
|
|
></Action>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: "delet4",
|
|
|
|
|
Header: "Delete",
|
|
|
|
|
accessor: "filename",
|
|
|
|
|
Cell: ({ value }) => {
|
|
|
|
|
const modals = useModals();
|
|
|
|
|
const remove = useDeleteBackups();
|
|
|
|
|
return (
|
|
|
|
|
<Group spacing="xs" noWrap>
|
|
|
|
|
<Action
|
|
|
|
|
label="Restore"
|
|
|
|
|
onClick={() =>
|
|
|
|
|
modals.openConfirmModal({
|
|
|
|
|
title: "Restore Backup",
|
|
|
|
|
children: (
|
|
|
|
|
<Text size="sm">
|
|
|
|
|
Are you sure you want to restore the backup ({value})?
|
|
|
|
|
Bazarr will automatically restart and reload the UI
|
|
|
|
|
during the restore process.
|
|
|
|
|
</Text>
|
|
|
|
|
),
|
|
|
|
|
labels: { confirm: "Restore", cancel: "Cancel" },
|
|
|
|
|
confirmProps: { color: "red" },
|
|
|
|
|
onConfirm: () => restore.mutate(value),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
icon={faHistory}
|
|
|
|
|
></Action>
|
|
|
|
|
<Action
|
|
|
|
|
label="Delete"
|
|
|
|
|
color="red"
|
|
|
|
|
onClick={() =>
|
|
|
|
|
modals.openConfirmModal({
|
|
|
|
|
title: "Delete Backup",
|
|
|
|
|
children: (
|
|
|
|
|
<Text size="sm">
|
|
|
|
|
Are you sure you want to delete the backup ({value})?
|
|
|
|
|
</Text>
|
|
|
|
|
),
|
|
|
|
|
labels: { confirm: "Delete", cancel: "Cancel" },
|
|
|
|
|
confirmProps: { color: "red" },
|
|
|
|
|
onConfirm: () => remove.mutate(value),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
icon={faTrash}
|
|
|
|
|
></Action>
|
|
|
|
|
</Group>
|
|
|
|
|
<Action
|
|
|
|
|
label="Delete"
|
|
|
|
|
color="red"
|
|
|
|
|
onClick={() =>
|
|
|
|
|
modals.openConfirmModal({
|
|
|
|
|
title: "Delete Backup",
|
|
|
|
|
children: (
|
|
|
|
|
<Text size="sm">
|
|
|
|
|
Are you sure you want to delete the backup ({value})?
|
|
|
|
|
</Text>
|
|
|
|
|
),
|
|
|
|
|
labels: { confirm: "Delete", cancel: "Cancel" },
|
|
|
|
|
confirmProps: { color: "red" },
|
|
|
|
|
onConfirm: () => remove.mutate(value),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
icon={faTrash}
|
|
|
|
|
></Action>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|