From d6c2edce7e86f7d42fbf362b3c777810ba50a505 Mon Sep 17 00:00:00 2001 From: lingniu Date: Sat, 4 Jul 2026 14:14:06 +0800 Subject: [PATCH] feat(platform): expose vehicle operations shortcuts --- .../apps/web/src/layout/AppShell.tsx | 15 +++++-- .../apps/web/src/test/App.test.tsx | 40 ++++++++++++++++++- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/vehicle-data-platform/apps/web/src/layout/AppShell.tsx b/vehicle-data-platform/apps/web/src/layout/AppShell.tsx index 24bbce3d..d5a9e0e6 100644 --- a/vehicle-data-platform/apps/web/src/layout/AppShell.tsx +++ b/vehicle-data-platform/apps/web/src/layout/AppShell.tsx @@ -109,10 +109,17 @@ export function AppShell({ 生产环境 多源接入 / 一个车辆服务 {amapConfigured ? '地图就绪' : '地图待配置'} - - - + + + + diff --git a/vehicle-data-platform/apps/web/src/test/App.test.tsx b/vehicle-data-platform/apps/web/src/test/App.test.tsx index f70aecd2..57c5fe33 100644 --- a/vehicle-data-platform/apps/web/src/test/App.test.tsx +++ b/vehicle-data-platform/apps/web/src/test/App.test.tsx @@ -29,6 +29,36 @@ test('exposes AMap operations shortcuts when map key is configured', async () => }) } as Response; } + if (path.includes('/api/mileage/summary')) { + return { + ok: true, + json: async () => ({ + data: { vehicleCount: 0, recordCount: 0, sourceCount: 0, totalMileageKm: 0, averageMileagePerVin: 0 }, + traceId: 'trace-test', + timestamp: 1783094400000 + }) + } as Response; + } + if (path.includes('/api/quality/summary')) { + return { + ok: true, + json: async () => ({ + data: { issueVehicleCount: 0, issueRecordCount: 0, errorCount: 0, warningCount: 0, protocols: [], issueTypes: [] }, + traceId: 'trace-test', + timestamp: 1783094400000 + }) + } as Response; + } + if (path.includes('/api/quality/notification-plan')) { + return { + ok: true, + json: async () => ({ + data: { rules: [], policies: [], priorityIssues: [], activeRuleCount: 0, p0RuleCount: 0 }, + traceId: 'trace-test', + timestamp: 1783094400000 + }) + } as Response; + } return { ok: true, json: async () => ({ @@ -42,10 +72,16 @@ test('exposes AMap operations shortcuts when map key is configured', async () => render(); expect(await screen.findByText('地图就绪')).toBeInTheDocument(); - fireEvent.click(screen.getByRole('button', { name: '实时地图' })); + fireEvent.click(screen.getByRole('button', { name: '顶部实时监控' })); expect(window.location.hash).toBe('#/realtime'); - fireEvent.click(screen.getByRole('button', { name: '地图回放' })); + fireEvent.click(screen.getByRole('button', { name: '顶部轨迹回放' })); expect(window.location.hash.startsWith('#/history')).toBe(true); + fireEvent.click(screen.getByRole('button', { name: '顶部历史查询' })); + expect(window.location.hash.startsWith('#/history')).toBe(true); + fireEvent.click(screen.getByRole('button', { name: '顶部统计查询' })); + expect(window.location.hash.startsWith('#/mileage')).toBe(true); + fireEvent.click(await screen.findByRole('button', { name: '顶部告警通知正常' })); + expect(window.location.hash).toBe('#/quality'); }); test('shows vehicle service status distribution on dashboard', async () => {