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