Add organizations module surface
This commit is contained in:
63
webui/src/module.ts
Normal file
63
webui/src/module.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import { createElement, lazy } from "react";
|
||||
import type { AdminSectionsUiCapability, PlatformWebModule } from "@govoplan/core-webui";
|
||||
import { generatedTranslations } from "./i18n/generatedTranslations";
|
||||
import "./styles/organizations.css";
|
||||
|
||||
const OrganizationsPage = lazy(() => import("./features/organizations/OrganizationsPage"));
|
||||
const OrganizationsAdminPanel = lazy(() => import("./features/organizations/OrganizationsAdminPanel"));
|
||||
|
||||
const organizationReadScopes = [
|
||||
"organizations:model:read",
|
||||
"organizations:unit:read",
|
||||
"organizations:function:read",
|
||||
"admin:settings:read"
|
||||
];
|
||||
|
||||
const translations = {
|
||||
en: generatedTranslations.en,
|
||||
de: generatedTranslations.de
|
||||
};
|
||||
|
||||
const organizationAdminSections: AdminSectionsUiCapability = {
|
||||
sections: [
|
||||
{
|
||||
id: "tenant-organization-model",
|
||||
label: "i18n:govoplan-organizations.organization_model.4f924c0e",
|
||||
group: "TENANT",
|
||||
order: 85,
|
||||
anyOf: ["organizations:model:read", "admin:settings:read"],
|
||||
render: ({ settings, auth }) => createElement(OrganizationsAdminPanel, { settings, auth })
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export const organizationsModule: PlatformWebModule = {
|
||||
id: "organizations",
|
||||
label: "i18n:govoplan-organizations.organizations.220edf64",
|
||||
version: "1.0.0",
|
||||
dependencies: ["access"],
|
||||
optionalDependencies: ["identity", "admin"],
|
||||
translations,
|
||||
navItems: [
|
||||
{
|
||||
to: "/organizations",
|
||||
label: "i18n:govoplan-organizations.organizations.220edf64",
|
||||
iconName: "users",
|
||||
anyOf: organizationReadScopes,
|
||||
order: 70
|
||||
}
|
||||
],
|
||||
routes: [
|
||||
{
|
||||
path: "/organizations",
|
||||
anyOf: organizationReadScopes,
|
||||
order: 70,
|
||||
render: ({ settings, auth }) => createElement(OrganizationsPage, { settings, auth })
|
||||
}
|
||||
],
|
||||
uiCapabilities: {
|
||||
"admin.sections": organizationAdminSections
|
||||
}
|
||||
};
|
||||
|
||||
export default organizationsModule;
|
||||
Reference in New Issue
Block a user