feat: add governance operations dashboard

This commit is contained in:
2026-07-31 04:21:34 +02:00
parent 1ec47647ab
commit b84cab1aa4
6 changed files with 266 additions and 1 deletions
+80 -1
View File
@@ -14,7 +14,14 @@ import {
type ApiSettings,
type DataGridColumn } from
"@govoplan/core-webui";
import { fetchOpsStatus, type OpsCheck, type OpsDeploymentProfile, type OpsSizingAssumption, type OpsStatus } from "../../api/ops";
import {
fetchOpsStatus,
type OpsCheck,
type OpsDeploymentProfile,
type OpsGovernanceModule,
type OpsSizingAssumption,
type OpsStatus
} from "../../api/ops";
export default function OpsPage({ settings }: {settings: ApiSettings;}) {
const [status, setStatus] = useState<OpsStatus | null>(null);
@@ -60,6 +67,8 @@ export default function OpsPage({ settings }: {settings: ApiSettings;}) {
<MetricCard label="i18n:govoplan-ops.profile.ff4fc027" value={status?.summary.active_profile ?? "-"} tone="info" detail={status?.summary.database_url ?? "i18n:govoplan-ops.no_database_url.51a2db0c"} />
<MetricCard label="i18n:govoplan-ops.readiness.1db9d6fb" value={ready ? "ready" : "not ready"} tone={ready ? "good" : "danger"} detail={status?.readiness.blockers.length ? `${status.readiness.blockers.length} blocker(s)` : "i18n:govoplan-ops.no_readiness_blockers.0df259bd"} />
<MetricCard label="i18n:govoplan-ops.modules.04e9462c" value={status?.summary.module_count ?? 0} tone="neutral" detail="i18n:govoplan-ops.enabled_in_the_runtime_registry.d2c6142d" />
<MetricCard label="i18n:govoplan-ops.permissions.842c35eb" value={status?.governance.summary.permission_count ?? 0} tone="neutral" detail="i18n:govoplan-ops.declared_governance_permissions.d08d3bf1" />
<MetricCard label="i18n:govoplan-ops.policies.e7800f56" value={status?.governance.summary.policy_count ?? 0} tone="neutral" detail="i18n:govoplan-ops.registered_policy_capabilities.112a2b64" />
<MetricCard label="i18n:govoplan-ops.workers.b6ef3acd" value={status?.summary.celery_enabled ? "split" : "off"} tone={status?.summary.celery_enabled ? "good" : "warning"} detail={status?.summary.celery_queues?.length ? status.summary.celery_queues.join(", ") : "i18n:govoplan-ops.celery_worker_setting.323d7737"} />
<MetricCard label="i18n:govoplan-ops.redis.5eaa1f2f" value={status?.summary.redis_url ? "configured" : "-"} tone={status?.summary.celery_enabled ? "info" : "neutral"} detail={status?.summary.redis_url ?? "-"} />
<MetricCard label="i18n:govoplan-ops.warnings.1430f976" value={warningCount + errorCount} tone={errorCount ? "danger" : warningCount ? "warning" : "good"} detail="i18n:govoplan-ops.current_health_checks.7830bccf" />
@@ -70,6 +79,10 @@ export default function OpsPage({ settings }: {settings: ApiSettings;}) {
<CheckList checks={checks} />
</Card>
<Card title="i18n:govoplan-ops.governance_inventory.835d8e57">
<GovernanceTable modules={status?.governance.modules ?? []} />
</Card>
<Card title="i18n:govoplan-ops.deployment_profiles.b0caa179">
<ProfileList profiles={status?.deployment_profiles ?? []} />
</Card>
@@ -84,6 +97,72 @@ export default function OpsPage({ settings }: {settings: ApiSettings;}) {
}
function GovernanceTable({ modules }: { modules: OpsGovernanceModule[] }) {
const columns: DataGridColumn<OpsGovernanceModule>[] = [
{
id: "module",
header: "i18n:govoplan-ops.module.b8ff0289",
width: "minmax(200px, 1fr)",
minWidth: 180,
resizable: true,
sortable: true,
filterable: true,
value: (module) => `${module.name} ${module.module_id} ${module.version}`,
render: (module) => <div><strong>{module.name}</strong><span className="muted block">{module.module_id} · {module.version}</span></div>
},
{
id: "authority",
header: "i18n:govoplan-ops.authority.8802e425",
width: "minmax(190px, .8fr)",
minWidth: 170,
resizable: true,
value: (module) => `${module.permission_count} ${module.role_template_count}`,
render: (module) => `${module.permission_count} permissions · ${module.role_template_count} roles`
},
{
id: "contracts",
header: "i18n:govoplan-ops.contracts.57d80902",
width: "minmax(190px, .8fr)",
minWidth: 170,
resizable: true,
value: (module) => `${module.capability_count} ${module.policy_count}`,
render: (module) => `${module.capability_count} capabilities · ${module.policy_count} policies`
},
{
id: "controls",
header: "i18n:govoplan-ops.controls.0cdb80fb",
width: "minmax(190px, .8fr)",
minWidth: 170,
resizable: true,
value: (module) => `${module.access_control_count} ${module.search_provider_count}`,
render: (module) => `${module.access_control_count} access · ${module.search_provider_count} search`
},
{
id: "evidence",
header: "i18n:govoplan-ops.evidence.7ea014de",
width: "minmax(190px, .8fr)",
minWidth: 170,
resizable: true,
value: (module) => `${module.documentation_count} ${module.documentation_provider_count} ${module.migration_managed}`,
render: (module) => (
<div>
{module.documentation_count + module.documentation_provider_count} docs
<span className="muted block">{module.migration_managed ? "migration managed" : "no module migrations"}</span>
</div>
)
}
];
return (
<DataGrid
id="ops-governance-inventory"
rows={modules}
columns={columns}
getRowKey={(module) => module.module_id}
emptyText="i18n:govoplan-ops.no_modules_reported.847f06d9"
/>
);
}
function CheckList({ checks }: {checks: OpsCheck[];}) {
if (!checks.length) return <p className="muted">i18n:govoplan-ops.no_health_checks_reported.03c067c4</p>;
return (