diff --git a/heicode/web/default/dist/index.html b/heicode/web/default/dist/index.html index 39c524f..b10d51c 100644 --- a/heicode/web/default/dist/index.html +++ b/heicode/web/default/dist/index.html @@ -20,7 +20,7 @@ - +
diff --git a/heicode/web/default/src/features/dashboard/components/cockpit/index.tsx b/heicode/web/default/src/features/dashboard/components/cockpit/index.tsx index a3401e5..1c4b7b0 100644 --- a/heicode/web/default/src/features/dashboard/components/cockpit/index.tsx +++ b/heicode/web/default/src/features/dashboard/components/cockpit/index.tsx @@ -1,14 +1,12 @@ import { useMemo } from 'react' import { useQuery } from '@tanstack/react-query' import { Link } from '@tanstack/react-router' -import { useTranslation } from 'react-i18next' import { AlertTriangle, ArrowUpRight, Building2, CheckCircle2, CircleDashed, - PlayCircle, Rocket, ScrollText, } from 'lucide-react' @@ -159,8 +157,6 @@ function formatRelative(value: string | number | undefined): string { } export function CockpitView() { - const { t } = useTranslation() - const deploymentsQuery = useQuery({ queryKey: ['cockpit', 'agents'], queryFn: listMyAgents, @@ -177,24 +173,17 @@ export function CockpitView() { const stats = useMemo(() => { const list: AgentItem[] = deploymentsQuery.data ?? [] - const counters: Record = { - running: 0, - success: 0, - failed: 0, - pending: 0, - } - list.forEach((d) => { - counters[classifyStatus(d.status || '')]++ - }) - const total = list.length || 1 - const successRate = Math.round( - ((counters.success + counters.running) / total) * 100 - ) - return { - list, - counters, - successRate: Number.isFinite(successRate) ? successRate : 0, + let running = 0 + let starting = 0 + let abnormal = 0 + for (const a of list) { + const v = (a.status || '').toLowerCase() + if (['running', 'active', 'ready'].includes(v)) running++ + else if (['pending', 'starting', 'provisioning'].includes(v)) starting++ + else if (['failed', 'error', 'unhealthy', 'crashed', 'stopped'].includes(v)) + abnormal++ } + return { list, running, starting, abnormal, total: list.length } }, [deploymentsQuery.data]) const recentDeployments = useMemo( @@ -211,43 +200,43 @@ export function CockpitView() { return (
- {/* Tier 1: Status */} + {/* Tier 1: Status (template-agent model) */}
- +
{/* Usage & cost — the CURRENT user's OWN lifetime usage (from /api/user/self), not the admin-global aggregate. */}

- {t('Usage & cost')} + 费用与消耗

- {t('Recent deployments')} + 最近部署

-

- {t('Live code delivery runs')} -

+

我的 Agent

@@ -286,7 +273,7 @@ export function CockpitView() {
) : recentDeployments.length === 0 ? (
- {t('No deployments yet. Trigger a run to populate the cockpit.')} + 还没有部署 Agent。去「部署 Sub Agent」部署一个。
) : (