// CIL[BEGIN chunk_id="WorkbenchDashboard_module_header_1784572423" type="module_header" identity="module_header" parent="none"] import { useEffect, useState } from 'react' import { Card, CardContent, CardHeader, CardTitle } from '@core/components/ui/card' import { useAppPath } from '@core/hooks/useAppPath' import { useNavigate } from 'react-router-dom' import { useActiveSev1 } from '../hooks/useActiveSev1' import { Siren, Wrench, Gauge, ShieldCheck, Truck, Library, ScrollText, LayoutDashboard, } from 'lucide-react' import { apiFetch } from '@core/lib/api' // CIL[END chunk_id="WorkbenchDashboard_module_header_1784572423"] // CIL[BEGIN chunk_id="WorkbenchDashboard_statcard_1784572423" type="function" identity="StatCard" parent="none"] function StatCard({ title, value, icon: Icon, href, alert, }: { title: string value: string icon: React.ElementType href: string alert?: boolean }) { const navigate = useNavigate() const appPath = useAppPath() return ( navigate(appPath(href))} > {title}
{value}
) } // CIL[END chunk_id="WorkbenchDashboard_statcard_1784572423"] // CIL[BEGIN chunk_id="WorkbenchDashboard_dashboard_1784572423" type="function" identity="WorkbenchDashboard" parent="none"] export default function WorkbenchDashboard() { const activeSev1 = useActiveSev1() const [counts, setCounts] = useState>({}) useEffect(() => { let cancelled = false async function load() { const endpoints = [ { key: 'engineering', url: '/api/admin-data?entity=items&type_slug=workbench_work_item&status=active&limit=500' }, { key: 'pipeline_runs', url: '/api/admin-data?entity=items&type_slug=workbench_pipeline_run&status=running&limit=200' }, { key: 'deployments', url: '/api/admin-data?entity=items&type_slug=workbench_deployment&status=active&limit=200' }, { key: 'services_unhealthy', url: '/api/admin-data?entity=items&type_slug=workbench_service&limit=200' }, { key: 'test_cases', url: '/api/admin-data?entity=items&type_slug=workbench_test_case&limit=200' }, { key: 'kb', url: '/api/admin-data?entity=items&type_slug=kb-spine-internal&limit=200' }, { key: 'logs', url: '/api/admin-data?entity=logs&limit=1' }, ] const next: Record = {} await Promise.all( endpoints.map(async ({ key, url }) => { try { const r = await apiFetch(url) const json = await r.json() const items = Array.isArray(json?.data) ? json.data : [] if (key === 'services_unhealthy') { next[key] = items.filter((i: any) => i.data?.health_status !== 'healthy' && i.data?.health_status !== 'unknown').length } else { next[key] = items.length } } catch { next[key] = 0 } }) ) if (!cancelled) setCounts(next) } load() return () => { cancelled = true } }, []) const totalWorkItems = counts.engineering ?? '—' const devopsCount = (counts.pipeline_runs ?? 0) + (counts.deployments ?? 0) + (counts.services_unhealthy ?? 0) const qaCount = counts.test_cases ?? '—' const deliveryCount = counts.deployments ?? '—' const kbCount = counts.kb ?? '—' const logCount = counts.logs ?? '—' return (

Command Center

Engineering workbench overview

) } // CIL[END chunk_id="WorkbenchDashboard_dashboard_1784572423"]