feat: extend supply workbench demo and map navigation

This commit is contained in:
2026-09-23 13:19:30 +08:00
parent bebcf2a06c
commit 1752b9ef84
45 changed files with 2137 additions and 449 deletions
@@ -18,14 +18,16 @@ import {
type PeripheralContext,
type PeripheralObservations,
type PeripheralPointPage,
type PeripheralScenario
type PeripheralScenario,
type PeripheralWorkOrder
} from "./client";
const DISCLAIMER = "外围系统模拟接入,不是正式工单/现场结果";
export function PeripheralSamplePanel({ open, onClose, getAccessToken }: {
export function PeripheralSamplePanel({ open, onClose, getAccessToken, onAgentTrigger }: {
open: boolean;
onClose: () => void;
getAccessToken?: AccessTokenProvider;
onAgentTrigger?: (workOrder: PeripheralWorkOrder) => Promise<void>;
}) {
const clientRef = useRef(new PeripheralSampleClient(getAccessToken));
const client = clientRef.current;
@@ -145,6 +147,7 @@ export function PeripheralSamplePanel({ open, onClose, getAccessToken }: {
canWrite={context.can_write}
capabilities={context.managed_resources}
onInventoryChange={setInventory}
onAgentTrigger={onAgentTrigger}
/>
<SyntheticDemoSection client={client} />
<Disclosure label={<span className="inline-flex items-center gap-2"><ReceiptText size={14} />按 request_id 找回提交结果</span>} className="rounded-[14px] border border-slate-200/90 bg-[var(--surface-reading)] px-3.5 shadow-[0_1px_2px_rgba(15,23,42,0.06)]"><p className="pb-2 text-xs leading-5 text-slate-500">结果未知时请保存请求号。此处只查询已经提交的请求,不会重复写入。</p><div className="flex gap-2 pb-3"><input aria-label="提交请求号" value={receiptRequestId} onChange={(event) => setReceiptRequestId(event.target.value.trim())} placeholder="request_id" className="h-10 min-w-0 flex-1 rounded-lg border border-slate-200 bg-white px-3 font-mono text-xs focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-[var(--action-focus-ring)]" /><Button variant="outline" disabled={!receiptRequestId || Boolean(busy)} onClick={async () => { setBusy("receipt"); setError(null); try { const result = await client.getReceipt(receiptRequestId); if ("scenario" in result) setScenario(result.scenario); else setError("回执已确认,请刷新测试工单与数据列表。"); } catch (nextError) { setError(errorMessage(nextError)); } finally { setBusy(null); } }}>查询</Button></div></Disclosure>