203 lines
7.7 KiB
TypeScript
203 lines
7.7 KiB
TypeScript
import { createElement, lazy } from "react";
|
|
import type { AdminSectionsUiCapability, PlatformWebModule } from "@govoplan/core-webui";
|
|
import { adminReadScopes, hasScope } from "@govoplan/core-webui";
|
|
import { generatedTranslations } from "./i18n/generatedTranslations";
|
|
import { configurationReferenceSelectors } from "./features/admin/configurationReferenceProviders";
|
|
|
|
const AdminOverviewPanel = lazy(() => import("./features/admin/AdminOverviewPanel"));
|
|
const ConfigurationChangesPanel = lazy(() => import("./features/admin/ConfigurationChangesPanel"));
|
|
const ConfigurationPackagesPanel = lazy(() => import("./features/admin/ConfigurationPackagesPanel"));
|
|
const GovernanceTemplatesPanel = lazy(() => import("./features/admin/GovernanceTemplatesPanel"));
|
|
const ModuleManagementPanel = lazy(() => import("./features/admin/ModuleManagementPanel"));
|
|
const TenantModuleManagementPanel = lazy(() => import("./features/admin/TenantModuleManagementPanel"));
|
|
const SystemSettingsPanel = lazy(() => import("./features/admin/SystemSettingsPanel"));
|
|
const DataSubjectRequestsPanel = lazy(() => import("./features/admin/DataSubjectRequestsPanel"));
|
|
|
|
const translations = {
|
|
en: generatedTranslations.en,
|
|
de: generatedTranslations.de
|
|
};
|
|
|
|
const adminSections: AdminSectionsUiCapability = {
|
|
sections: [
|
|
{
|
|
id: "overview",
|
|
moduleId: "admin",
|
|
kind: "management",
|
|
surfaceId: "admin.section.overview",
|
|
label: "i18n:govoplan-admin.overview.0efc2e6b",
|
|
group: "ROOT",
|
|
order: 0,
|
|
anyOf: adminReadScopes,
|
|
render: ({ settings, availableSections, selectSection }) => createElement(AdminOverviewPanel, {
|
|
settings,
|
|
availableSections,
|
|
onSelect: selectSection
|
|
})
|
|
},
|
|
{
|
|
id: "system-settings",
|
|
moduleId: "admin",
|
|
kind: "settings",
|
|
surfaceId: "admin.section.system-settings",
|
|
label: "i18n:govoplan-admin.general.9239ee2c",
|
|
group: "SYSTEM",
|
|
order: 10,
|
|
allOf: ["system:settings:read"],
|
|
render: ({ settings, auth }) => createElement(SystemSettingsPanel, {
|
|
settings,
|
|
canWrite: hasScope(auth, "system:settings:write"),
|
|
canAccessMaintenance: hasScope(auth, "system:maintenance:access")
|
|
})
|
|
},
|
|
{
|
|
id: "system-configuration-changes",
|
|
moduleId: "admin",
|
|
kind: "management",
|
|
surfaceId: "admin.section.system-configuration-changes",
|
|
label: "i18n:govoplan-admin.changes.8aa57de6",
|
|
group: "SYSTEM",
|
|
order: 20,
|
|
allOf: ["system:settings:read"],
|
|
render: ({ settings, auth }) => createElement(ConfigurationChangesPanel, {
|
|
settings,
|
|
canApprove: hasScope(auth, "system:settings:write") || hasScope(auth, "system:governance:write")
|
|
})
|
|
},
|
|
{
|
|
id: "system-configuration-packages",
|
|
moduleId: "admin",
|
|
kind: "management",
|
|
surfaceId: "admin.section.system-configuration-packages",
|
|
label: "i18n:govoplan-admin.configuration_packages.eb2f05f1",
|
|
group: "SYSTEM",
|
|
order: 30,
|
|
allOf: ["system:settings:read"],
|
|
render: ({ settings, auth }) => createElement(ConfigurationPackagesPanel, {
|
|
settings,
|
|
auth,
|
|
canWrite: hasScope(auth, "system:settings:write")
|
|
})
|
|
},
|
|
{
|
|
id: "system-role-templates",
|
|
moduleId: "admin",
|
|
kind: "management",
|
|
surfaceId: "admin.section.system-role-templates",
|
|
label: "i18n:govoplan-admin.tenant_roles.51aca82d",
|
|
group: "SYSTEM",
|
|
order: 40,
|
|
allOf: ["system:governance:read"],
|
|
render: ({ settings, auth, refreshAuth }) => createElement(GovernanceTemplatesPanel, {
|
|
settings,
|
|
kind: "role",
|
|
canWrite: hasScope(auth, "system:governance:write"),
|
|
onAuthRefresh: refreshAuth
|
|
})
|
|
},
|
|
{
|
|
id: "system-modules",
|
|
moduleId: "admin",
|
|
kind: "management",
|
|
surfaceId: "admin.section.system-modules",
|
|
label: "i18n:govoplan-admin.modules.04e9462c",
|
|
group: "SYSTEM",
|
|
order: 85,
|
|
allOf: ["system:settings:read"],
|
|
render: ({ settings, auth }) => createElement(ModuleManagementPanel, {
|
|
settings,
|
|
canWrite: hasScope(auth, "system:settings:write"),
|
|
canAccessMaintenance: hasScope(auth, "system:maintenance:access")
|
|
})
|
|
},
|
|
{
|
|
id: "system-tenant-modules",
|
|
moduleId: "admin",
|
|
kind: "management",
|
|
surfaceId: "admin.section.system-tenant-modules",
|
|
label: "Tenant modules",
|
|
group: "SYSTEM",
|
|
order: 86,
|
|
allOf: ["system:settings:read"],
|
|
render: ({ settings, auth }) => createElement(TenantModuleManagementPanel, {
|
|
settings,
|
|
scope: "system",
|
|
canWrite: hasScope(auth, "system:settings:write")
|
|
})
|
|
},
|
|
{
|
|
id: "tenant-data-subject-requests",
|
|
moduleId: "admin",
|
|
kind: "management",
|
|
surfaceId: "admin.section.tenant-data-subject-requests",
|
|
label: "i18n:govoplan-admin.data_subject_requests.ds001",
|
|
group: "TENANT",
|
|
order: 55,
|
|
allOf: ["access:privacy:read"],
|
|
render: ({ settings, auth }) => createElement(DataSubjectRequestsPanel, {
|
|
settings,
|
|
canManage: hasScope(auth, "access:privacy:manage"),
|
|
canExport: hasScope(auth, "access:privacy:export"),
|
|
canErase: hasScope(auth, "access:privacy:erase")
|
|
})
|
|
},
|
|
{
|
|
id: "tenant-modules",
|
|
moduleId: "admin",
|
|
kind: "management",
|
|
surfaceId: "admin.section.tenant-modules",
|
|
label: "Modules",
|
|
group: "TENANT",
|
|
order: 60,
|
|
anyOf: ["admin:module:read", "admin:module:write", "system:settings:read"],
|
|
render: ({ settings, auth }) => createElement(TenantModuleManagementPanel, {
|
|
settings,
|
|
scope: "tenant",
|
|
canWrite: hasScope(auth, "admin:module:write") || hasScope(auth, "system:settings:write")
|
|
})
|
|
},
|
|
{
|
|
id: "system-groups",
|
|
moduleId: "admin",
|
|
kind: "management",
|
|
surfaceId: "admin.section.system-groups",
|
|
label: "i18n:govoplan-admin.groups.ae9629f4",
|
|
group: "SYSTEM",
|
|
order: 50,
|
|
allOf: ["system:governance:read"],
|
|
render: ({ settings, auth, refreshAuth }) => createElement(GovernanceTemplatesPanel, {
|
|
settings,
|
|
kind: "group",
|
|
canWrite: hasScope(auth, "system:governance:write"),
|
|
onAuthRefresh: refreshAuth
|
|
})
|
|
}]
|
|
|
|
};
|
|
|
|
export const adminModule: PlatformWebModule = {
|
|
id: "admin",
|
|
label: "i18n:govoplan-admin.admin.4e7afebc",
|
|
version: "0.1.8",
|
|
dependencies: ["access"],
|
|
translations,
|
|
viewSurfaces: [
|
|
{ id: "admin.section.overview", moduleId: "admin", kind: "section", label: "i18n:govoplan-admin.overview.0efc2e6b", order: 0 },
|
|
{ id: "admin.section.system-settings", moduleId: "admin", kind: "section", label: "i18n:govoplan-admin.system_general_settings.7cd662ed", order: 10 },
|
|
{ id: "admin.section.system-configuration-changes", moduleId: "admin", kind: "section", label: "i18n:govoplan-admin.configuration_changes.82933bbb", order: 20 },
|
|
{ id: "admin.section.system-configuration-packages", moduleId: "admin", kind: "section", label: "i18n:govoplan-admin.configuration_packages.eb2f05f1", order: 30 },
|
|
{ id: "admin.section.system-role-templates", moduleId: "admin", kind: "section", label: "i18n:govoplan-admin.tenant_roles.51aca82d", order: 40 },
|
|
{ id: "admin.section.system-groups", moduleId: "admin", kind: "section", label: "i18n:govoplan-admin.central_groups.5c9b5b66", order: 50 },
|
|
{ id: "admin.section.system-modules", moduleId: "admin", kind: "section", label: "i18n:govoplan-admin.modules.04e9462c", order: 85 },
|
|
{ id: "admin.section.system-tenant-modules", moduleId: "admin", kind: "section", label: "Tenant modules", order: 86 },
|
|
{ id: "admin.section.tenant-data-subject-requests", moduleId: "admin", kind: "section", label: "i18n:govoplan-admin.data_subject_requests.ds001", order: 55 },
|
|
{ id: "admin.section.tenant-modules", moduleId: "admin", kind: "section", label: "Modules", order: 60 }
|
|
],
|
|
uiCapabilities: {
|
|
"admin.sections": adminSections,
|
|
"admin.configurationReferences": configurationReferenceSelectors
|
|
}
|
|
};
|
|
|
|
export default adminModule;
|