Files
InvenTree/src/frontend/src/tables/notifications/NotificationTable.tsx
Oliver 9db5205f79 Bulk update mixin (#9313)
* Refactor BulkDeleteMixin

* Implement BulkUpdateMixin class

* Refactor NotificationsTable

- Use common bulkdelete operation

* Update successMessage

* Update metadata constructs

* Add bulk-edit support for PartList endpoint

* Implement set-category for part table

* Cleanup old endpoint

* Improve form error handling

* Simplify translated text

* Add playwright tests

* Bump API version

* Fix unit tests

* Further test updates
2025-03-17 09:21:43 +11:00

61 lines
1.3 KiB
TypeScript

import { t } from '@lingui/macro';
import { useMemo } from 'react';
import { ApiEndpoints } from '../../enums/ApiEndpoints';
import type { TableState } from '../../hooks/UseTable';
import { apiUrl } from '../../states/ApiState';
import type { TableColumn } from '../Column';
import { InvenTreeTable } from '../InvenTreeTable';
import type { RowAction } from '../RowActions';
export function NotificationTable({
params,
tableState,
tableActions,
actions
}: Readonly<{
params: any;
tableState: TableState;
tableActions: any[];
actions: (record: any) => RowAction[];
}>) {
const columns: TableColumn[] = useMemo(() => {
return [
{
accessor: 'age_human',
title: t`Age`,
sortable: true,
ordering: 'creation'
},
{
accessor: 'category',
title: t`Category`,
sortable: true
},
{
accessor: 'name',
title: t`Notification`
},
{
accessor: 'message',
title: t`Message`
}
];
}, []);
return (
<InvenTreeTable
url={apiUrl(ApiEndpoints.notifications_list)}
tableState={tableState}
columns={columns}
props={{
rowActions: actions,
tableActions: tableActions,
enableSelection: true,
enableBulkDelete: true,
params: params
}}
/>
);
}