Просмотр исходного кода

fix(dashboard): Add delete bulk action to facet value table

Michael Bromley 3 месяцев назад
Родитель
Сommit
6ac2edd3b1

+ 0 - 1
packages/dashboard/src/app/routes/_authenticated/_collections/components/collection-bulk-actions.tsx

@@ -68,7 +68,6 @@ export const DuplicateCollectionsBulkAction: BulkActionComponent<any> = ({ selec
         <DuplicateBulkAction
             entityType="Collection"
             duplicatorCode="collection-duplicator"
-            duplicatorArguments={[]}
             requiredPermissions={['UpdateCatalog', 'UpdateCollection']}
             entityName="Collection"
             selection={selection}

+ 0 - 6
packages/dashboard/src/app/routes/_authenticated/_facets/components/facet-bulk-actions.tsx

@@ -90,12 +90,6 @@ export const DuplicateFacetsBulkAction: BulkActionComponent<any> = ({ selection,
         <DuplicateBulkAction
             entityType="Facet"
             duplicatorCode="facet-duplicator"
-            duplicatorArguments={[
-                {
-                    name: 'includeValues',
-                    value: 'true',
-                },
-            ]}
             requiredPermissions={['UpdateCatalog', 'UpdateFacet']}
             entityName="Facet"
             selection={selection}

+ 16 - 0
packages/dashboard/src/app/routes/_authenticated/_facets/components/facet-value-bulk-actions.tsx

@@ -0,0 +1,16 @@
+import { BulkActionComponent } from '@/vdb/framework/extension-api/types/data-table.js';
+import { DeleteBulkAction } from '../../../../common/delete-bulk-action.js';
+
+import { deleteFacetValuesDocument } from '../facets.graphql.js';
+
+export const DeleteFacetValuesBulkAction: BulkActionComponent<any> = ({ selection, table }) => {
+    return (
+        <DeleteBulkAction
+            mutationDocument={deleteFacetValuesDocument}
+            entityName="facets"
+            requiredPermissions={['DeleteCatalog', 'DeleteFacet']}
+            selection={selection}
+            table={table}
+        />
+    );
+};

+ 8 - 3
packages/dashboard/src/app/routes/_authenticated/_facets/components/facet-values-table.tsx

@@ -1,14 +1,14 @@
 import { DetailPageButton } from '@/vdb/components/shared/detail-page-button.js';
 import { PaginatedListDataTable } from '@/vdb/components/shared/paginated-list-data-table.js';
+import { Button } from '@/vdb/components/ui/button.js';
 import { addCustomFields } from '@/vdb/framework/document-introspection/add-custom-fields.js';
 import { graphql } from '@/vdb/graphql/graphql.js';
 import { Trans } from '@lingui/react/macro';
 import { Link } from '@tanstack/react-router';
-import { Button } from '@/vdb/components/ui/button.js';
 import { ColumnFiltersState, SortingState } from '@tanstack/react-table';
 import { PlusIcon } from 'lucide-react';
 import { useRef, useState } from 'react';
-import { deleteFacetValuesDocument } from '../facets.graphql.js';
+import { DeleteFacetValuesBulkAction } from './facet-value-bulk-actions.js';
 
 export const facetValueListDocument = graphql(`
     query FacetValueList($options: FacetValueListOptions) {
@@ -42,7 +42,6 @@ export function FacetValuesTable({ facetId, registerRefresher }: Readonly<FacetV
         <>
             <PaginatedListDataTable
                 listQuery={addCustomFields(facetValueListDocument)}
-                deleteMutation={deleteFacetValuesDocument}
                 page={page}
                 itemsPerPage={pageSize}
                 sorting={sorting}
@@ -94,6 +93,12 @@ export function FacetValuesTable({ facetId, registerRefresher }: Readonly<FacetV
                         ),
                     },
                 }}
+                bulkActions={[
+                    {
+                        order: 400,
+                        component: DeleteFacetValuesBulkAction,
+                    },
+                ]}
             />
             <div className="mt-4">
                 <Button asChild variant="outline">

+ 0 - 6
packages/dashboard/src/app/routes/_authenticated/_products/components/product-bulk-actions.tsx

@@ -108,12 +108,6 @@ export const DuplicateProductsBulkAction: BulkActionComponent<any> = ({ selectio
         <DuplicateBulkAction
             entityType="Product"
             duplicatorCode="product-duplicator"
-            duplicatorArguments={[
-                {
-                    name: 'includeVariants',
-                    value: 'true',
-                },
-            ]}
             requiredPermissions={['UpdateCatalog', 'UpdateProduct']}
             entityName="Product"
             selection={selection}

+ 0 - 10
packages/dashboard/src/app/routes/_authenticated/_promotions/components/promotion-bulk-actions.tsx

@@ -63,16 +63,6 @@ export const DuplicatePromotionsBulkAction: BulkActionComponent<any> = ({ select
         <DuplicateBulkAction
             entityType="Promotion"
             duplicatorCode="promotion-duplicator"
-            duplicatorArguments={[
-                {
-                    name: 'includeConditions',
-                    value: 'true',
-                },
-                {
-                    name: 'includeActions',
-                    value: 'true',
-                },
-            ]}
             requiredPermissions={['CreatePromotion']}
             entityName="Promotion"
             selection={selection}