78 lines
2.0 KiB
TypeScript
78 lines
2.0 KiB
TypeScript
import { createElement, lazy } from "react";
|
|
import { Users } from "lucide-react";
|
|
import type { OrganizationFunctionActionsUiCapability, PlatformWebModule } from "@govoplan/core-webui";
|
|
import { generatedTranslations } from "./i18n/generatedTranslations";
|
|
import "./styles/idm.css";
|
|
|
|
const IdmPage = lazy(() => import("./features/IdmPage"));
|
|
|
|
const idmReadScopes = [
|
|
"idm:organization_assignment:read",
|
|
"idm:organization_assignment:write",
|
|
"idm:relationship:read",
|
|
"idm:relationship:write",
|
|
"organizations:function:assign"
|
|
];
|
|
|
|
const translations = {
|
|
en: generatedTranslations.en,
|
|
de: generatedTranslations.de
|
|
};
|
|
|
|
const organizationFunctionActions: OrganizationFunctionActionsUiCapability = {
|
|
actions: [
|
|
{
|
|
id: "idm.view-function-assignments",
|
|
surfaceId: "idm.action.view-function-assignments",
|
|
label: "i18n:govoplan-idm.view_assignments.2d40d6a5",
|
|
icon: createElement(Users, { size: 16 }),
|
|
anyOf: idmReadScopes,
|
|
order: 40,
|
|
onClick: ({ function: item }) => {
|
|
if (typeof window !== "undefined") {
|
|
window.location.href = `/idm?function_id=${encodeURIComponent(item.id)}`;
|
|
}
|
|
}
|
|
}
|
|
]
|
|
};
|
|
|
|
export const idmModule: PlatformWebModule = {
|
|
id: "idm",
|
|
label: "i18n:govoplan-idm.idm.61f4a7a2",
|
|
version: "0.1.8",
|
|
dependencies: ["identity", "organizations"],
|
|
translations,
|
|
viewSurfaces: [
|
|
{
|
|
id: "idm.action.view-function-assignments",
|
|
moduleId: "idm",
|
|
kind: "action",
|
|
label: "i18n:govoplan-idm.view_assignments.2d40d6a5",
|
|
order: 40
|
|
}
|
|
],
|
|
navItems: [
|
|
{
|
|
to: "/idm",
|
|
label: "i18n:govoplan-idm.idm.61f4a7a2",
|
|
iconName: "users",
|
|
anyOf: idmReadScopes,
|
|
order: 72
|
|
}
|
|
],
|
|
routes: [
|
|
{
|
|
path: "/idm",
|
|
anyOf: idmReadScopes,
|
|
order: 72,
|
|
render: ({ settings, auth }) => createElement(IdmPage, { settings, auth })
|
|
}
|
|
],
|
|
uiCapabilities: {
|
|
"organizations.functionActions": organizationFunctionActions
|
|
}
|
|
};
|
|
|
|
export default idmModule;
|