import { createElement, lazy } from "react"; import type { DashboardWidgetsUiCapability, PlatformWebModule } from "@govoplan/core-webui"; import ReportingReportsWidget from "./features/reporting/ReportingReportsWidget"; import "./styles/reporting.css"; const ReportingPage = lazy(() => import("./features/reporting/ReportingPage")); const reportingDashboardWidgets: DashboardWidgetsUiCapability = { widgets: [ { id: "reporting.reports", surfaceId: "reporting.widget.reports", title: "Reports", description: "Active governed reports available in the current scope.", moduleId: "reporting", category: "Analysis", order: 75, defaultVisible: false, defaultSize: "medium", supportedSizes: ["medium", "wide"], anyOf: ["reporting:definition:read"], refreshIntervalMs: 60_000, defaultConfiguration: { maxItems: 5 }, configurationFields: [ { id: "maxItems", label: "Maximum reports", kind: "number", min: 1, max: 12, step: 1, required: true } ], render: ({ settings, refreshKey, configuration }) => createElement( ReportingReportsWidget, { settings, refreshKey, configuration } ) } ] }; export const reportingModule: PlatformWebModule = { id: "reporting", label: "Reporting", version: "0.1.14", optionalDependencies: [ "dataflow", "datasources", "connectors", "dashboard", "files", "mail", "templates", "workflow_engine", "policy", "search", "notifications" ], routes: [ { path: "/reports", anyOf: ["reporting:definition:read"], order: 74, surfaceId: "reporting.workspace", render: (context) => createElement(ReportingPage, context) }, { path: "/reporting", anyOf: ["reporting:definition:read"], order: 175, surfaceId: "reporting.compatibility", render: (context) => createElement(ReportingPage, context) } ], navItems: [ { to: "/reports", label: "Reporting", iconName: "clipboard-pen-line", anyOf: ["reporting:definition:read"], order: 74, surfaceId: "reporting.navigation" } ], viewSurfaces: [ { id: "reporting.navigation", moduleId: "reporting", kind: "navigation", label: "Reporting navigation", order: 10 }, { id: "reporting.workspace", moduleId: "reporting", kind: "route", label: "Reporting workspace", order: 20 }, { id: "reporting.parameters", moduleId: "reporting", kind: "section", label: "Report parameters and filters", parentId: "reporting.workspace", order: 30 }, { id: "reporting.results", moduleId: "reporting", kind: "section", label: "Authorized report results", parentId: "reporting.workspace", order: 40 }, { id: "reporting.widget.reports", moduleId: "reporting", kind: "section", label: "Reports dashboard widget", order: 75 } ], uiCapabilities: { "dashboard.widgets": reportingDashboardWidgets } }; export default reportingModule;