import { createElement, lazy } from "react"; import type { DashboardWidgetsUiCapability, PlatformWebModule } from "@govoplan/core-webui"; import OpsHealthWidget from "./features/ops/OpsHealthWidget"; import { generatedTranslations } from "./i18n/generatedTranslations"; const OpsPage = lazy(() => import("./features/ops/OpsPage")); const opsReadScopes = ["ops:operations:read", "system:settings:read", "admin:settings:read"]; const translations = { en: generatedTranslations.en, de: generatedTranslations.de }; const dashboardWidgets: DashboardWidgetsUiCapability = { widgets: [ { id: "ops.health", surfaceId: "ops.widget.health", title: "Operations health", description: "Readiness, worker mode, and current warning count.", moduleId: "ops", category: "Operations", order: 100, defaultSize: "wide", anyOf: opsReadScopes, refreshIntervalMs: 30_000, render: ({ settings, refreshKey }) => createElement(OpsHealthWidget, { settings, refreshKey }) } ] }; export const opsModule: PlatformWebModule = { id: "ops", label: "i18n:govoplan-ops.ops.907a54c2", version: "1.0.0", dependencies: ["access"], optionalDependencies: ["audit", "docs", "notifications"], translations, viewSurfaces: [ { id: "ops.navigation", moduleId: "ops", kind: "navigation", label: "i18n:govoplan-ops.surface.navigation", order: 10 }, { id: "ops.page", moduleId: "ops", kind: "route", label: "i18n:govoplan-ops.surface.page", order: 20 }, { id: "ops.page.summary", moduleId: "ops", kind: "section", label: "i18n:govoplan-ops.surface.summary", parentId: "ops.page", order: 10 }, { id: "ops.page.health", moduleId: "ops", kind: "section", label: "i18n:govoplan-ops.surface.health", parentId: "ops.page", order: 20 }, { id: "ops.page.runtime", moduleId: "ops", kind: "section", label: "i18n:govoplan-ops.surface.runtime", parentId: "ops.page", order: 30 }, { id: "ops.page.recovery", moduleId: "ops", kind: "section", label: "i18n:govoplan-ops.surface.recovery", parentId: "ops.page", order: 40 }, { id: "ops.page.governance", moduleId: "ops", kind: "section", label: "i18n:govoplan-ops.surface.governance", parentId: "ops.page", order: 50 }, { id: "ops.page.deployment", moduleId: "ops", kind: "section", label: "i18n:govoplan-ops.surface.deployment", parentId: "ops.page", order: 60 }, { id: "ops.page.sizing", moduleId: "ops", kind: "section", label: "i18n:govoplan-ops.surface.sizing", parentId: "ops.page", order: 70 }, { id: "ops.action.run-probes", moduleId: "ops", kind: "action", label: "i18n:govoplan-ops.surface.run_probes", parentId: "ops.page.health", order: 80 }, { id: "ops.action.drain-node", moduleId: "ops", kind: "action", label: "i18n:govoplan-ops.surface.drain_node", parentId: "ops.page.runtime", order: 90 }, { id: "ops.widget.health", moduleId: "ops", kind: "section", label: "Operations health widget", order: 100 } ], navItems: [{ to: "/ops", label: "i18n:govoplan-ops.ops.907a54c2", iconName: "activity", anyOf: opsReadScopes, order: 890, surfaceId: "ops.navigation" }], routes: [ { path: "/ops", anyOf: opsReadScopes, order: 890, surfaceId: "ops.page", render: ({ settings, auth }) => createElement(OpsPage, { settings, auth }) }], uiCapabilities: { "dashboard.widgets": dashboardWidgets } }; export default opsModule;