mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix for attachment table (#8021)
- Allow bulk deletion of attachments from PUI
This commit is contained in:
parent
93e06a0db5
commit
c096f2f43a
@ -107,6 +107,11 @@ export function AttachmentTable({
|
|||||||
|
|
||||||
const validPk = useMemo(() => model_id > 0, [model_id]);
|
const validPk = useMemo(() => model_id > 0, [model_id]);
|
||||||
|
|
||||||
|
const canDelete = useMemo(
|
||||||
|
() => user.hasDeletePermission(model_type),
|
||||||
|
[user, model_type]
|
||||||
|
);
|
||||||
|
|
||||||
const [isUploading, setIsUploading] = useState<boolean>(false);
|
const [isUploading, setIsUploading] = useState<boolean>(false);
|
||||||
|
|
||||||
const allowDragAndDrop: boolean = useMemo(() => {
|
const allowDragAndDrop: boolean = useMemo(() => {
|
||||||
@ -272,7 +277,7 @@ export function AttachmentTable({
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
RowDeleteAction({
|
RowDeleteAction({
|
||||||
hidden: !user.hasDeletePermission(model_type),
|
hidden: !canDelete,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
setSelectedAttachment(record.pk);
|
setSelectedAttachment(record.pk);
|
||||||
deleteAttachment.open();
|
deleteAttachment.open();
|
||||||
@ -297,7 +302,8 @@ export function AttachmentTable({
|
|||||||
columns={tableColumns}
|
columns={tableColumns}
|
||||||
props={{
|
props={{
|
||||||
noRecordsText: t`No attachments found`,
|
noRecordsText: t`No attachments found`,
|
||||||
enableSelection: true,
|
enableSelection: canDelete,
|
||||||
|
enableBulkDelete: canDelete,
|
||||||
tableActions: tableActions,
|
tableActions: tableActions,
|
||||||
tableFilters: tableFilters,
|
tableFilters: tableFilters,
|
||||||
rowActions: rowActions,
|
rowActions: rowActions,
|
||||||
|
Loading…
Reference in New Issue
Block a user