Sync GovOPlaN module state
This commit is contained in:
72
webui/src/module.ts
Normal file
72
webui/src/module.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import { createElement, lazy } from "react";
|
||||
import { Button, type OrganizationFunctionActionsUiCapability, type 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",
|
||||
"organizations:function:assign"
|
||||
];
|
||||
|
||||
const translations = {
|
||||
en: generatedTranslations.en,
|
||||
de: generatedTranslations.de
|
||||
};
|
||||
|
||||
const organizationFunctionActions: OrganizationFunctionActionsUiCapability = {
|
||||
actions: [
|
||||
{
|
||||
id: "idm.view-function-assignments",
|
||||
label: "i18n:govoplan-idm.assignments.a0d19ec5",
|
||||
anyOf: idmReadScopes,
|
||||
order: 40,
|
||||
render: ({ function: item }) => createElement(
|
||||
Button,
|
||||
{
|
||||
type: "button",
|
||||
variant: "ghost",
|
||||
title: "i18n:govoplan-idm.view_assignments.2d40d6a5",
|
||||
onClick: () => {
|
||||
if (typeof window !== "undefined") {
|
||||
window.location.href = `/idm?function_id=${encodeURIComponent(item.id)}`;
|
||||
}
|
||||
}
|
||||
},
|
||||
"i18n:govoplan-idm.assignments.a0d19ec5"
|
||||
)
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export const idmModule: PlatformWebModule = {
|
||||
id: "idm",
|
||||
label: "i18n:govoplan-idm.idm.61f4a7a2",
|
||||
version: "0.1.6",
|
||||
dependencies: ["identity", "organizations"],
|
||||
translations,
|
||||
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;
|
||||
Reference in New Issue
Block a user