added notify for reloading category group
parent
369abe2671
commit
a66ebe9708
|
@ -41,6 +41,7 @@ export const ReceivedMessagesCommands = {
|
|||
InstallingGlobalPythonPackagesFailed: 37,
|
||||
InstallingGlobalPythonPackagesFinished: 38,
|
||||
UpdateUsers: 39,
|
||||
CheckingForGroupTasksCategoryGroupChanges: 40,
|
||||
};
|
||||
|
||||
// commands sent to the backend server
|
||||
|
@ -157,30 +158,6 @@ export function handleWebSocketMessage(
|
|||
arr.filter((arr1) => arr1 !== body.RemovedCategory)
|
||||
);
|
||||
|
||||
/*setUser((user) => {
|
||||
const updatedUser = { ...user };
|
||||
|
||||
updatedUser.Permissions = updatedUser.Permissions.filter(
|
||||
(arr) => !body.RemovedPermissions.includes(arr)
|
||||
);
|
||||
|
||||
return updatedUser;
|
||||
}); */
|
||||
/*
|
||||
setAdminAreaRolesPermissions((arr) => {
|
||||
const newArr = [...arr];
|
||||
|
||||
newArr.forEach((role, i) => {
|
||||
if (role.Permissions !== null) {
|
||||
newArr[i].Permissions = role.Permissions.filter(
|
||||
(arr) => !body.RemovedPermissions.includes(arr)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return newArr;
|
||||
}); */
|
||||
|
||||
notificationApi["info"]({
|
||||
message: `Category ${body.RemovedCategory} was removed`,
|
||||
duration: 2,
|
||||
|
@ -188,18 +165,14 @@ export function handleWebSocketMessage(
|
|||
break;
|
||||
}
|
||||
|
||||
groupTasksContext.setCategoryGroup((arr) => {
|
||||
const newArr = [...arr];
|
||||
groupTasksContext.setCategoryGroup((categoryGroup) => ({
|
||||
...categoryGroup,
|
||||
groups: body.CategoryGroups,
|
||||
}));
|
||||
|
||||
const categoryIndex = arr.findIndex(
|
||||
(arr1) => arr1.category === body.Category
|
||||
);
|
||||
|
||||
if (categoryIndex !== -1) {
|
||||
newArr[categoryIndex].groups = body.CategoryGroups;
|
||||
}
|
||||
|
||||
return newArr;
|
||||
notificationApi["success"]({
|
||||
message: `Group ${body.Category} reloaded`,
|
||||
duration: 2,
|
||||
});
|
||||
break;
|
||||
case ReceivedMessagesCommands.UpdateUserSessions:
|
||||
|
@ -832,6 +805,11 @@ export function handleWebSocketMessage(
|
|||
return newArr;
|
||||
});
|
||||
}
|
||||
|
||||
notificationApi["success"]({
|
||||
message: `Category group changes reloaded`,
|
||||
description: `You can now continue with the work`,
|
||||
});
|
||||
break;
|
||||
case ReceivedMessagesCommands.NewUserApiKeyCreated:
|
||||
/*userProfileContext.setUserProfile((user) => ({
|
||||
|
@ -963,6 +941,12 @@ export function handleWebSocketMessage(
|
|||
return newArr;
|
||||
});
|
||||
break;
|
||||
case ReceivedMessagesCommands.CheckingForGroupTasksCategoryGroupChanges:
|
||||
notificationApi["warning"]({
|
||||
message: `Checking for category group changes`,
|
||||
description: `This may take a while`,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
console.error("unknown command", cmd);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue