2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-05-30 21:25:36 +00:00

[UI] Part lock notification (#12040)

* [UI] Part lock notification

- Add a notification when part lock status is updated

* update playwright

Ref: https://github.com/microsoft/playwright/issues/40998
This commit is contained in:
Oliver
2026-05-30 21:25:30 +10:00
committed by GitHub
parent e500b61029
commit 7a83da7f39
+17 -2
View File
@@ -11,6 +11,7 @@ import {
Stack,
Text
} from '@mantine/core';
import { notifications } from '@mantine/notifications';
import {
IconBookmarks,
IconBuilding,
@@ -1165,11 +1166,25 @@ export default function PartDetail() {
variant='transparent'
disabled={!user.hasChangeRole(UserRoles.part)}
onClick={() => {
const locking = !part.locked;
api
.patch(apiUrl(ApiEndpoints.part_list, part.pk), {
locked: !part.locked
locked: locking
})
.then(refreshInstance);
.then(() => {
notifications.hide('part-lock');
notifications.show({
id: 'part-lock',
message: locking ? t`Part locked` : t`Part unlocked`,
color: 'green',
icon: locking ? (
<IconLock size='1rem' />
) : (
<IconLockOpen size='1rem' />
)
});
refreshInstance();
});
}}
>
{part?.locked ? <IconLock /> : <IconLockOpen />}