From 3a2ad36e5d6fe4b4e6caaed73e9c5cbfd77312a1 Mon Sep 17 00:00:00 2001 From: chenchen Date: Thu, 4 Jun 2026 17:59:12 +0800 Subject: [PATCH] fix(web): show unsupported resources (vm) disabled; Overview uses new-model framing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1) Deploy Sub Agent: stop hiding resource types AM doesn't support yet (vm) — show them but disabled with a "暂不支持" badge + tooltip, so users see their bindings instead of wondering where the vm went. 2) Overview (概述/cockpit): replaced the old task-model status cards (Running/Completed/Failed/裁决 + "code delivery runs") with template-agent semantics — Agent 总数 / 运行中 / 启动中 / 异常, "最近部署 · 我的 Agent", all Chinese. Dropped unused t()/useTranslation/PlayCircle. Co-Authored-By: Claude Opus 4.8 --- heicode/web/default/dist/index.html | 2 +- .../dashboard/components/cockpit/index.tsx | 83 ++++++++----------- .../deploy-agent/deploy-agent-page.tsx | 32 ++++--- 3 files changed, 57 insertions(+), 60 deletions(-) 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」部署一个。
) : (
    @@ -317,7 +304,7 @@ export function CockpitView() { > - {t('Inspect')} + 详情 diff --git a/heicode/web/default/src/features/deploy-agent/deploy-agent-page.tsx b/heicode/web/default/src/features/deploy-agent/deploy-agent-page.tsx index ed1d88c..156092c 100644 --- a/heicode/web/default/src/features/deploy-agent/deploy-agent-page.tsx +++ b/heicode/web/default/src/features/deploy-agent/deploy-agent-page.tsx @@ -138,12 +138,11 @@ export function DeploySubAgentPage() { s.includes(id) ? s.filter((x) => x !== id) : [...s, id] ) - // Only resource types the agent runtime currently supports (git / mysql / - // postgres / azure-blob). vm & others are hidden until AM adds them. + // Resource types the agent runtime currently supports (git / mysql / postgres + // / azure-blob). Others (e.g. vm) are SHOWN but disabled, with an "暂不支持" + // hint, until AM adds support — don't hide the user's bindings. const SUPPORTED_TYPES = new Set(['git', 'database', 'blob']) - const resources = (resourcesQ.data ?? []).filter((r) => - SUPPORTED_TYPES.has(r.resource_type) - ) + const resources = resourcesQ.data ?? [] const templates = templatesQ.data ?? [] const canDeploy = Boolean(selectedTemplate) && !deploy.isPending @@ -182,17 +181,22 @@ export function DeploySubAgentPage() {
    {resources.map((r) => { const Icon = RESOURCE_ICON[r.resource_type] ?? Database - const on = selectedBindings.includes(r.id) + const supported = SUPPORTED_TYPES.has(r.resource_type) + const on = supported && selectedBindings.includes(r.id) return ( ) })}