From c0691b0ab848e20ccd4c73c8c4731c426242f969 Mon Sep 17 00:00:00 2001 From: abdou6666 Date: Fri, 17 Jan 2025 19:46:12 +0100 Subject: [PATCH 1/3] fix: remove delete opearation --- .../src/components/media-library/index.tsx | 29 +------------------ 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/frontend/src/components/media-library/index.tsx b/frontend/src/components/media-library/index.tsx index 4409cd44..5ee442d7 100644 --- a/frontend/src/components/media-library/index.tsx +++ b/frontend/src/components/media-library/index.tsx @@ -47,7 +47,6 @@ type MediaLibraryProps = { export const MediaLibrary = ({ onSelect, accept }: MediaLibraryProps) => { const { t } = useTranslate(); const { toast } = useToast(); - const deleteDialogCtl = useDialog(false); const formatFileSize = useFormattedFileSize(); const { onSearch, searchPayload } = useSearch({ $iLike: ["name"], @@ -77,26 +76,7 @@ export const MediaLibrary = ({ onSelect, accept }: MediaLibraryProps) => { }, }, ); - const { mutateAsync: deleteCategory } = useDelete(EntityType.ATTACHMENT, { - onError: () => { - toast.error(t("message.internal_server_error")); - }, - onSuccess: () => { - deleteDialogCtl.closeDialog(); - toast.success(t("message.item_delete_success")); - }, - }); - const actionColumns = useActionColumns( - EntityType.ATTACHMENT, - [ - { - label: ActionColumnLabel.Delete, - action: (row) => deleteDialogCtl.openDialog(row.id), - requires: [PermissionAction.DELETE], - }, - ], - t("label.operations"), - ); + const columns: GridColDef[] = [ { field: "id", headerName: "ID" }, { @@ -169,17 +149,10 @@ export const MediaLibrary = ({ onSelect, accept }: MediaLibraryProps) => { valueGetter: (params) => t("datetime.updated_at", getDateTimeFormatter(params)), }, - actionColumns, ]; return ( - { - if (deleteDialogCtl?.data) deleteCategory(deleteDialogCtl.data); - }} - /> Date: Fri, 17 Jan 2025 20:56:37 +0100 Subject: [PATCH 2/3] fix: pipeline --- frontend/src/components/media-library/index.tsx | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/frontend/src/components/media-library/index.tsx b/frontend/src/components/media-library/index.tsx index 5ee442d7..31985535 100644 --- a/frontend/src/components/media-library/index.tsx +++ b/frontend/src/components/media-library/index.tsx @@ -12,24 +12,14 @@ import { Box, Grid, Paper } from "@mui/material"; import { GridColDef, GridEventListener } from "@mui/x-data-grid"; import AttachmentThumbnail from "@/app-components/attachment/AttachmentThumbnail"; -import { DeleteDialog } from "@/app-components/dialogs/DeleteDialog"; import { FilterTextfield } from "@/app-components/inputs/FilterTextfield"; -import { - ActionColumnLabel, - useActionColumns, -} from "@/app-components/tables/columns/getColumns"; import { renderHeader } from "@/app-components/tables/columns/renderHeader"; import { DataGrid } from "@/app-components/tables/DataGrid"; -import { useDelete } from "@/hooks/crud/useDelete"; -import { useFind } from "@/hooks/crud/useFind"; -import { useDialog } from "@/hooks/useDialog"; import useFormattedFileSize from "@/hooks/useFormattedFileSize"; import { useSearch } from "@/hooks/useSearch"; -import { useToast } from "@/hooks/useToast"; import { useTranslate } from "@/hooks/useTranslate"; import { PageHeader } from "@/layout/content/PageHeader"; import { EntityType } from "@/services/types"; -import { PermissionAction } from "@/types/permission.types"; import { TFilterStringFields } from "@/types/search.types"; import { getDateTimeFormatter } from "@/utils/date"; @@ -46,7 +36,6 @@ type MediaLibraryProps = { export const MediaLibrary = ({ onSelect, accept }: MediaLibraryProps) => { const { t } = useTranslate(); - const { toast } = useToast(); const formatFileSize = useFormattedFileSize(); const { onSearch, searchPayload } = useSearch({ $iLike: ["name"], @@ -76,7 +65,6 @@ export const MediaLibrary = ({ onSelect, accept }: MediaLibraryProps) => { }, }, ); - const columns: GridColDef[] = [ { field: "id", headerName: "ID" }, { From 515d0b7ea7cf22d20576f46ff419f3d09800d7c0 Mon Sep 17 00:00:00 2001 From: abdou6666 Date: Fri, 17 Jan 2025 20:58:38 +0100 Subject: [PATCH 3/3] fix: missing useFind import --- frontend/src/components/media-library/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/components/media-library/index.tsx b/frontend/src/components/media-library/index.tsx index 31985535..4602b557 100644 --- a/frontend/src/components/media-library/index.tsx +++ b/frontend/src/components/media-library/index.tsx @@ -15,6 +15,7 @@ import AttachmentThumbnail from "@/app-components/attachment/AttachmentThumbnail import { FilterTextfield } from "@/app-components/inputs/FilterTextfield"; import { renderHeader } from "@/app-components/tables/columns/renderHeader"; import { DataGrid } from "@/app-components/tables/DataGrid"; +import { useFind } from "@/hooks/crud/useFind"; import useFormattedFileSize from "@/hooks/useFormattedFileSize"; import { useSearch } from "@/hooks/useSearch"; import { useTranslate } from "@/hooks/useTranslate";