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:
@@ -11,6 +11,7 @@ import {
|
|||||||
Stack,
|
Stack,
|
||||||
Text
|
Text
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
|
import { notifications } from '@mantine/notifications';
|
||||||
import {
|
import {
|
||||||
IconBookmarks,
|
IconBookmarks,
|
||||||
IconBuilding,
|
IconBuilding,
|
||||||
@@ -1165,11 +1166,25 @@ export default function PartDetail() {
|
|||||||
variant='transparent'
|
variant='transparent'
|
||||||
disabled={!user.hasChangeRole(UserRoles.part)}
|
disabled={!user.hasChangeRole(UserRoles.part)}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
const locking = !part.locked;
|
||||||
api
|
api
|
||||||
.patch(apiUrl(ApiEndpoints.part_list, part.pk), {
|
.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 />}
|
{part?.locked ? <IconLock /> : <IconLockOpen />}
|
||||||
|
|||||||
Reference in New Issue
Block a user