From 19f260d94af3b4fefb82f562588f91a5d97a5f01 Mon Sep 17 00:00:00 2001 From: lingniu Date: Sat, 4 Jul 2026 16:06:03 +0800 Subject: [PATCH] feat(platform): include release in vehicle summary --- vehicle-data-platform/apps/web/src/App.tsx | 2 +- .../apps/web/src/pages/VehicleDetail.tsx | 3 +++ .../apps/web/src/test/App.test.tsx | 13 ++++++++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/vehicle-data-platform/apps/web/src/App.tsx b/vehicle-data-platform/apps/web/src/App.tsx index 4e60e286..b6fc2d5a 100644 --- a/vehicle-data-platform/apps/web/src/App.tsx +++ b/vehicle-data-platform/apps/web/src/App.tsx @@ -403,7 +403,7 @@ export default function App() { dashboard: , vehicles: , realtime: , - detail: , + detail: , history: , mileage: , quality: { diff --git a/vehicle-data-platform/apps/web/src/pages/VehicleDetail.tsx b/vehicle-data-platform/apps/web/src/pages/VehicleDetail.tsx index d5d92961..3862fccf 100644 --- a/vehicle-data-platform/apps/web/src/pages/VehicleDetail.tsx +++ b/vehicle-data-platform/apps/web/src/pages/VehicleDetail.tsx @@ -130,6 +130,7 @@ async function copyText(value: string, label: string) { export function VehicleDetail({ vin, protocol, + platformRelease, onOpenRealtime, onOpenHistory, onOpenRaw, @@ -142,6 +143,7 @@ export function VehicleDetail({ }: { vin: string; protocol?: string; + platformRelease?: string; onOpenRealtime: (vin: string, protocol?: string) => void; onOpenHistory: (vin: string, protocol?: string) => void; onOpenRaw: (vin: string, protocol?: string) => void; @@ -359,6 +361,7 @@ export function VehicleDetail({ const vehicleName = [archivePlate, displayVIN].filter((item) => item && item !== '-').join(' / ') || displayLookupKey; const lines = [ '【车辆服务诊断摘要】', + ...(platformRelease?.trim() ? [`运行版本:${platformRelease.trim()}`] : []), `车辆:${vehicleName}`, `查询关键词:${reportText(displayLookupKey)}`, `当前范围:${scopeText}`, 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 67e56ad1..fddb841f 100644 --- a/vehicle-data-platform/apps/web/src/test/App.test.tsx +++ b/vehicle-data-platform/apps/web/src/test/App.test.tsx @@ -2349,7 +2349,7 @@ test('filters dashboard coverage from source consistency diagnosis', async () => ok: true, json: async () => ({ data: path.includes('/api/ops/health') - ? { linkHealth: [], kafkaLag: 0, redisOnlineKeys: 0, tdengineWritable: true, mysqlWritable: true, runtime: { requestTimeoutMs: 5000 } } + ? { linkHealth: [], kafkaLag: 0, redisOnlineKeys: 0, tdengineWritable: true, mysqlWritable: true, runtime: { requestTimeoutMs: 5000, platformRelease: 'platform-20260704155844' } } : { items: [], total: 0, limit: 8, offset: 0 }, traceId: 'trace-test', timestamp: 1783094400000 @@ -2458,7 +2458,7 @@ test('opens full vehicle service list from dashboard coverage filters', async () ok: true, json: async () => ({ data: path.includes('/api/ops/health') - ? { linkHealth: [], kafkaLag: 0, redisOnlineKeys: 0, tdengineWritable: true, mysqlWritable: true, runtime: { requestTimeoutMs: 5000 } } + ? { linkHealth: [], kafkaLag: 0, redisOnlineKeys: 0, tdengineWritable: true, mysqlWritable: true, runtime: { requestTimeoutMs: 5000, platformRelease: 'platform-20260704155844' } } : { items: [], total: 0, limit: 8, offset: 0 }, traceId: 'trace-test', timestamp: 1783094400000 @@ -4890,7 +4890,7 @@ test('shows vehicle context when opening detail from shareable hash', async () = ok: true, json: async () => ({ data: path.includes('/api/ops/health') - ? { linkHealth: [], kafkaLag: 0, redisOnlineKeys: 0, tdengineWritable: true, mysqlWritable: true, runtime: { requestTimeoutMs: 5000 } } + ? { linkHealth: [], kafkaLag: 0, redisOnlineKeys: 0, tdengineWritable: true, mysqlWritable: true, runtime: { requestTimeoutMs: 5000, platformRelease: 'platform-20260704155844' } } : { items: [], total: 0, limit: 10, offset: 0 }, traceId: 'trace-test', timestamp: 1783094400000 @@ -9405,7 +9405,7 @@ test('copies vehicle service diagnostic summary', async () => { ok: true, json: async () => ({ data: path.includes('/api/ops/health') - ? { linkHealth: [], kafkaLag: 0, redisOnlineKeys: 0, tdengineWritable: true, mysqlWritable: true, runtime: { requestTimeoutMs: 5000 } } + ? { linkHealth: [], kafkaLag: 0, redisOnlineKeys: 0, tdengineWritable: true, mysqlWritable: true, runtime: { requestTimeoutMs: 5000, platformRelease: 'platform-20260704155844' } } : { items: [], total: 0, limit: 10, offset: 0 }, traceId: 'trace-test', timestamp: 1783094400000 @@ -9418,9 +9418,12 @@ test('copies vehicle service diagnostic summary', async () => { expect(await screen.findByText('车辆服务结论')).toBeInTheDocument(); fireEvent.click(screen.getByRole('button', { name: /复制诊断摘要/ })); - expect(writeText).toHaveBeenCalledWith(expect.any(String)); + await waitFor(() => { + expect(writeText).toHaveBeenCalledWith(expect.any(String)); + }); const copied = String(writeText.mock.lastCall?.[0] ?? ''); expect(copied).toContain('【车辆服务诊断摘要】'); + expect(copied).toContain('运行版本:platform-20260704155844'); expect(copied).toContain('车辆:粤A诊断1 / VIN-SUMMARY-001'); expect(copied).toContain('当前范围:单一来源:JT808'); expect(copied).toContain('服务状态:来源不完整');