import { createElement, lazy } from "react"; import type { DashboardWidgetsUiCapability, PlatformWebModule } from "@govoplan/core-webui"; import "@xyflow/react/dist/style.css"; import "./styles/workflow.css"; const WorkflowPage = lazy(() => import("./features/workflow/WorkflowPage")); const WorkflowOpenWorkWidget = lazy( () => import("./features/workflow/WorkflowOpenWorkWidget") ); const readScopes = [ "workflow:definition:read", "workflow:instance:admin" ]; const instanceReadScopes = [ "workflow:instance:read", "workflow:instance:admin" ]; const workflowDashboardWidgets: DashboardWidgetsUiCapability = { widgets: [ { id: "workflow.open-work", surfaceId: "workflow.widget.open-work", title: "Open workflow work", description: "Running workflows and steps that require attention.", moduleId: "workflow", category: "Work", order: 42, defaultVisible: false, defaultSize: "medium", supportedSizes: ["medium", "wide"], anyOf: instanceReadScopes, refreshIntervalMs: 60_000, defaultConfiguration: { maxItems: 6, includeRunning: true }, configurationFields: [ { id: "maxItems", label: "Maximum items", kind: "number", min: 1, max: 20, step: 1, required: true }, { id: "includeRunning", label: "Include running steps", kind: "boolean" } ], render: ({ settings, refreshKey, configuration }) => createElement(WorkflowOpenWorkWidget, { settings, refreshKey, configuration }) } ] }; export const workflowModule: PlatformWebModule = { id: "workflow", label: "Workflow", version: "0.1.14", optionalDependencies: [ "access", "audit", "dataflow", "datasources", "notifications", "policy", "tasks" ], viewSurfaces: [ { id: "workflow.widget.open-work", moduleId: "workflow", kind: "section", label: "Open workflow work widget", order: 76 } ], navItems: [ { to: "/workflow", label: "Workflow", iconName: "workflow", anyOf: readScopes, order: 74 } ], routes: [ { path: "/workflow", anyOf: readScopes, order: 74, render: ({ settings, auth }) => createElement(WorkflowPage, { settings, auth }) } ], uiCapabilities: { "dashboard.widgets": workflowDashboardWidgets } }; export default workflowModule;