added admin area manage for checking which categories are available
parent
88e1734232
commit
93aba47966
|
@ -36,7 +36,8 @@
|
||||||
"menuCategory": "Adminbereich",
|
"menuCategory": "Adminbereich",
|
||||||
"roles": "Rollen",
|
"roles": "Rollen",
|
||||||
"logs": "Logs",
|
"logs": "Logs",
|
||||||
"noScannerSelected": "Kein Scanner ausgewählt"
|
"noScannerSelected": "Kein Scanner ausgewählt",
|
||||||
|
"manage": "Verwalten"
|
||||||
},
|
},
|
||||||
"usersCount": {
|
"usersCount": {
|
||||||
"single": "Benutzer online",
|
"single": "Benutzer online",
|
||||||
|
@ -259,7 +260,14 @@
|
||||||
"save": { "tooltip": { "title": "Speichern" } },
|
"save": { "tooltip": { "title": "Speichern" } },
|
||||||
"close": { "tooltip": { "title": "Schließen" } },
|
"close": { "tooltip": { "title": "Schließen" } },
|
||||||
"edit": { "tooltip": { "title": "Bearbeiten" } },
|
"edit": { "tooltip": { "title": "Bearbeiten" } },
|
||||||
"masterRoleRightsMessage": "Rechte können nicht bearbeitet werden, da diese Rolle der Master ist und alle Rechte besitzt."
|
"masterRoleRightsMessage": "Rechte können nicht bearbeitet werden, da diese Rolle der Master ist und alle Rechte besitzt.",
|
||||||
|
"manage": {
|
||||||
|
"groupTasksCard": {
|
||||||
|
"title": "Gruppenaufgaben Kategorien",
|
||||||
|
"description": "Die Suche nach Kategorieänderungen zwingt den Server, nach neuen Kategorien zu suchen oder alte aus dem Cache zu löschen.",
|
||||||
|
"buttonText": "Prüfen, welche Kategorien verfügbar sind"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"userProfile": {
|
"userProfile": {
|
||||||
"header": {
|
"header": {
|
||||||
|
|
|
@ -36,7 +36,8 @@
|
||||||
"menuCategory": "Admin Area",
|
"menuCategory": "Admin Area",
|
||||||
"roles": "Roles",
|
"roles": "Roles",
|
||||||
"logs": "Logs",
|
"logs": "Logs",
|
||||||
"noScannerSelected": "No scanner selected"
|
"noScannerSelected": "No scanner selected",
|
||||||
|
"manage": "Manage"
|
||||||
},
|
},
|
||||||
"usersCount": {
|
"usersCount": {
|
||||||
"single": "User online",
|
"single": "User online",
|
||||||
|
@ -259,7 +260,14 @@
|
||||||
"save": { "tooltip": { "title": "Save" } },
|
"save": { "tooltip": { "title": "Save" } },
|
||||||
"close": { "tooltip": { "title": "Close" } },
|
"close": { "tooltip": { "title": "Close" } },
|
||||||
"edit": { "tooltip": { "title": "Edit" } },
|
"edit": { "tooltip": { "title": "Edit" } },
|
||||||
"masterRoleRightsMessage": "Rights cannot be edited as this role is the master and has all rights."
|
"masterRoleRightsMessage": "Rights cannot be edited as this role is the master and has all rights.",
|
||||||
|
"manage": {
|
||||||
|
"groupTasksCard": {
|
||||||
|
"title": "Group Task Categories",
|
||||||
|
"description": "Searching for category changes forces the server to search for new categories or delete old ones from the cache.",
|
||||||
|
"buttonText": "Check which categories are available"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"userProfile": {
|
"userProfile": {
|
||||||
"header": {
|
"header": {
|
||||||
|
|
|
@ -11,6 +11,7 @@ const UserProfile = lazy(() => import("../../Pages/UserProfile"));
|
||||||
const Scanners = lazy(() => import("../../Pages/Scanners"));
|
const Scanners = lazy(() => import("../../Pages/Scanners"));
|
||||||
const AdminAreaRoles = lazy(() => import("../../Pages/AdminArea/Roles"));
|
const AdminAreaRoles = lazy(() => import("../../Pages/AdminArea/Roles"));
|
||||||
const AdminAreaLogs = lazy(() => import("../../Pages/AdminArea/Logs"));
|
const AdminAreaLogs = lazy(() => import("../../Pages/AdminArea/Logs"));
|
||||||
|
const AdminAreaManage = lazy(() => import("../../Pages/AdminArea/Manage"));
|
||||||
const AllUsers = lazy(() => import("../../Pages/AllUsers"));
|
const AllUsers = lazy(() => import("../../Pages/AllUsers"));
|
||||||
const GroupTasksHistory = lazy(() => import("../../Pages/GroupTasks/History"));
|
const GroupTasksHistory = lazy(() => import("../../Pages/GroupTasks/History"));
|
||||||
const PageNotFound = lazy(() => import("../../Pages/PageNotFound"));
|
const PageNotFound = lazy(() => import("../../Pages/PageNotFound"));
|
||||||
|
@ -216,6 +217,20 @@ export default function AppRoutes() {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{hasPermission(
|
||||||
|
appContext.userPermissions,
|
||||||
|
Constants.PERMISSIONS.ADMIN_AREA.MANAGE
|
||||||
|
) && (
|
||||||
|
<Route
|
||||||
|
path={Constants.ROUTE_PATHS.ADMIN_AREA_MANAGE}
|
||||||
|
element={
|
||||||
|
<SuspenseFallback>
|
||||||
|
<AdminAreaManage />
|
||||||
|
</SuspenseFallback>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path="*"
|
path="*"
|
||||||
element={
|
element={
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import {
|
import {
|
||||||
AppstoreOutlined,
|
AppstoreOutlined,
|
||||||
BookOutlined,
|
BookOutlined,
|
||||||
|
ControlOutlined,
|
||||||
FileTextOutlined,
|
FileTextOutlined,
|
||||||
HistoryOutlined,
|
HistoryOutlined,
|
||||||
LogoutOutlined,
|
LogoutOutlined,
|
||||||
|
@ -98,14 +99,6 @@ export default function SideMenu({
|
||||||
key: `/group-tasks/${categoryGroup}`,
|
key: `/group-tasks/${categoryGroup}`,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
/*
|
|
||||||
for (let i = 0; i < sideBarContext.availableCategoryGroups.length; i++) {
|
|
||||||
groupTasks.children.push({
|
|
||||||
label: sideBarContext.availableCategoryGroups[i],
|
|
||||||
icon: <SnippetsOutlined />,
|
|
||||||
key: `/group-tasks/${sideBarContext.availableCategoryGroups[i]}`,
|
|
||||||
});
|
|
||||||
} */
|
|
||||||
|
|
||||||
groupTasksGroup.children.push(groupTasks);
|
groupTasksGroup.children.push(groupTasks);
|
||||||
|
|
||||||
|
@ -132,7 +125,8 @@ export default function SideMenu({
|
||||||
Constants.PERMISSIONS.ADMIN_AREA.ROLES.UPDATE_ROLE,
|
Constants.PERMISSIONS.ADMIN_AREA.ROLES.UPDATE_ROLE,
|
||||||
Constants.PERMISSIONS.ADMIN_AREA.ROLES.DELETE_ROLE,
|
Constants.PERMISSIONS.ADMIN_AREA.ROLES.DELETE_ROLE,
|
||||||
Constants.PERMISSIONS.ADMIN_AREA.ROLES.MOVE_ROLE_UP_DOWN,
|
Constants.PERMISSIONS.ADMIN_AREA.ROLES.MOVE_ROLE_UP_DOWN,
|
||||||
Constants.PERMISSIONS.ADMIN_AREA.LOGS
|
Constants.PERMISSIONS.ADMIN_AREA.LOGS,
|
||||||
|
Constants.PERMISSIONS.ADMIN_AREA.MANAGE
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
items.push({
|
items.push({
|
||||||
|
@ -175,6 +169,19 @@ export default function SideMenu({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
hasPermission(
|
||||||
|
appContext.userPermissions,
|
||||||
|
Constants.PERMISSIONS.ADMIN_AREA.MANAGE
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
adminArea.children.push({
|
||||||
|
label: t("sideMenu.adminArea.manage"),
|
||||||
|
icon: <ControlOutlined />,
|
||||||
|
key: Constants.ROUTE_PATHS.ADMIN_AREA_MANAGE,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
items.push(adminArea);
|
items.push(adminArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,7 @@ export const SentMessagesCommands = {
|
||||||
SubscribeToTopic: 23,
|
SubscribeToTopic: 23,
|
||||||
DeleteAllNotifications: 24,
|
DeleteAllNotifications: 24,
|
||||||
DeleteOneNotification: 25,
|
DeleteOneNotification: 25,
|
||||||
|
AdminAreaManageCheckWhichCategoriesAreAvailable: 26,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -798,11 +799,13 @@ export function handleWebSocketMessage(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
TODO: handle this
|
||||||
if (
|
if (
|
||||||
body["AddedCategoryGroups"] !== undefined ||
|
body["AddedCategoryGroups"] !== undefined ||
|
||||||
body["RemovedCategoryGroups"] !== undefined
|
body["RemovedCategoryGroups"] !== undefined
|
||||||
) {
|
) {
|
||||||
groupTasksContext.setCategoryGroups((arr) => {
|
groupTasksContext.setCategoryGroup((arr) => {
|
||||||
let newArr = [...arr];
|
let newArr = [...arr];
|
||||||
|
|
||||||
if (body["RemovedCategoryGroups"] !== undefined) {
|
if (body["RemovedCategoryGroups"] !== undefined) {
|
||||||
|
@ -827,7 +830,7 @@ export function handleWebSocketMessage(
|
||||||
|
|
||||||
return newArr;
|
return newArr;
|
||||||
});
|
});
|
||||||
}
|
} */
|
||||||
|
|
||||||
notificationApi["success"]({
|
notificationApi["success"]({
|
||||||
message: `Category group changes reloaded`,
|
message: `Category group changes reloaded`,
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
import { Button, Card } from "antd";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { useWebSocketContext } from "../../../Contexts/WebSocketContext";
|
||||||
|
import { SentMessagesCommands } from "../../../Handlers/WebSocketMessageHandler";
|
||||||
|
import { Constants, hasPermission } from "../../../utils";
|
||||||
|
import { useAppContext } from "../../../Contexts/AppContext";
|
||||||
|
|
||||||
|
export default function AdminAreaManage() {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const appContext = useAppContext();
|
||||||
|
const webSocketContext = useWebSocketContext();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{hasPermission(
|
||||||
|
appContext.userPermissions,
|
||||||
|
Constants.PERMISSIONS.ADMIN_AREA
|
||||||
|
.MANAGE_CHECK_WHICH_CATEGORIES_ARE_AVAILABLE
|
||||||
|
) && (
|
||||||
|
<Card title={t("adminArea.manage.groupTasksCard.title")}>
|
||||||
|
<p>{t("adminArea.manage.groupTasksCard.description")}</p>
|
||||||
|
<Button
|
||||||
|
onClick={() =>
|
||||||
|
webSocketContext.SendSocketMessage(
|
||||||
|
SentMessagesCommands.AdminAreaManageCheckWhichCategoriesAreAvailable,
|
||||||
|
{}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{t("adminArea.manage.groupTasksCard.buttonText")}
|
||||||
|
</Button>
|
||||||
|
</Card>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ import { useEffect, useRef, useState } from "react";
|
||||||
import GroupTasksViewModal from "./GroupTasksViewModal";
|
import GroupTasksViewModal from "./GroupTasksViewModal";
|
||||||
import GroupTypeSelectionModal from "./GroupTypeSelectionModal";
|
import GroupTypeSelectionModal from "./GroupTypeSelectionModal";
|
||||||
import GroupTaskTableList from "./GroupTasksTableList";
|
import GroupTaskTableList from "./GroupTasksTableList";
|
||||||
import { Constants, hasPermission, myFetch } from "../../../utils";
|
import { AppStyle, Constants, hasPermission, myFetch } from "../../../utils";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { ReloadOutlined } from "@ant-design/icons";
|
import { ReloadOutlined } from "@ant-design/icons";
|
||||||
import { useGroupTasksContext } from "../../../Contexts/GroupTasksContext";
|
import { useGroupTasksContext } from "../../../Contexts/GroupTasksContext";
|
||||||
|
@ -146,7 +146,7 @@ export default function GroupTasks({ isGroupTasksViewModalOpen }) {
|
||||||
style={{
|
style={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
marginTop: 20,
|
marginTop: AppStyle.app.margin,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
|
|
|
@ -47,6 +47,7 @@ export const Constants = {
|
||||||
ROUTE_PATHS: {
|
ROUTE_PATHS: {
|
||||||
EQUIPMENT_DOCUMENTATION: "/equipment-documentation",
|
EQUIPMENT_DOCUMENTATION: "/equipment-documentation",
|
||||||
EQUIPMENT_DOCUMENTATION_VIEW: "/equipment-documentation/",
|
EQUIPMENT_DOCUMENTATION_VIEW: "/equipment-documentation/",
|
||||||
|
NO_GROUP_TASKS_AVAILABLE: "/group-tasks-no-available",
|
||||||
GROUP_TASKS: "/group-tasks/",
|
GROUP_TASKS: "/group-tasks/",
|
||||||
GROUP_TASKS_HISTORY: "/group-tasks-history",
|
GROUP_TASKS_HISTORY: "/group-tasks-history",
|
||||||
USERS: "/users",
|
USERS: "/users",
|
||||||
|
@ -54,6 +55,7 @@ export const Constants = {
|
||||||
USER_PROFILE: "/user-profile",
|
USER_PROFILE: "/user-profile",
|
||||||
ADMIN_AREA_ROLES: "/admin-area/roles",
|
ADMIN_AREA_ROLES: "/admin-area/roles",
|
||||||
ADMIN_AREA_LOGS: "/admin-area/logs",
|
ADMIN_AREA_LOGS: "/admin-area/logs",
|
||||||
|
ADMIN_AREA_MANAGE: "/admin-area/manage",
|
||||||
},
|
},
|
||||||
GROUP_TASKS_STATUS: {
|
GROUP_TASKS_STATUS: {
|
||||||
FINISHED: 1,
|
FINISHED: 1,
|
||||||
|
@ -129,6 +131,9 @@ export const Constants = {
|
||||||
MOVE_ROLE_UP_DOWN: "admin_area.roles.move_role_up_down",
|
MOVE_ROLE_UP_DOWN: "admin_area.roles.move_role_up_down",
|
||||||
},
|
},
|
||||||
LOGS: "admin_area.logs",
|
LOGS: "admin_area.logs",
|
||||||
|
MANAGE: "admin_area.manage",
|
||||||
|
MANAGE_CHECK_WHICH_CATEGORIES_ARE_AVAILABLE:
|
||||||
|
"admin_area.manage.check_which_categories_are_available",
|
||||||
},
|
},
|
||||||
USER_PROFILE: {
|
USER_PROFILE: {
|
||||||
API_KEYS: "user_profile.api_keys",
|
API_KEYS: "user_profile.api_keys",
|
||||||
|
|
Loading…
Reference in New Issue