2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-05-28 03:49:20 +00:00

[UI] Lock action (#11981)

- Toggle part lock directly from existing icon
This commit is contained in:
Oliver
2026-05-22 10:21:23 +10:00
committed by GitHub
parent 9908870a81
commit 8b9ea43b5b
+15 -3
View File
@@ -23,6 +23,7 @@ import {
IconListDetails,
IconListTree,
IconLock,
IconLockOpen,
IconPackages,
IconSearch,
IconShoppingCart,
@@ -1132,9 +1133,20 @@ export default function PartDetail() {
<PageDetail
title={`${t`Part`}: ${part.full_name}`}
icon={
part?.locked ? (
<IconLock aria-label='part-lock-icon' />
) : undefined
<ActionIcon
aria-label='part-lock-icon'
variant='transparent'
disabled={!user.hasChangeRole(UserRoles.part)}
onClick={() => {
api
.patch(apiUrl(ApiEndpoints.part_list, part.pk), {
locked: !part.locked
})
.then(refreshInstance);
}}
>
{part?.locked ? <IconLock /> : <IconLockOpen />}
</ActionIcon>
}
subtitle={part.description}
imageUrl={part.image}