From 1c210897bbcbd46cf659b530d2911acf36056ba2 Mon Sep 17 00:00:00 2001 From: lingniu Date: Sat, 4 Jul 2026 06:08:58 +0800 Subject: [PATCH] feat(platform): filter vehicles from missing source tags --- .../apps/web/src/pages/Vehicles.tsx | 14 ++++++++++++-- .../apps/web/src/test/App.test.tsx | 5 +++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/vehicle-data-platform/apps/web/src/pages/Vehicles.tsx b/vehicle-data-platform/apps/web/src/pages/Vehicles.tsx index f37213f0..a47b1543 100644 --- a/vehicle-data-platform/apps/web/src/pages/Vehicles.tsx +++ b/vehicle-data-platform/apps/web/src/pages/Vehicles.tsx @@ -131,7 +131,17 @@ export function Vehicles({ render: (_: unknown, row: VehicleCoverageRow) => ( {(row.missingProtocols ?? []).length > 0 - ? row.missingProtocols.map((protocol) => 缺 {protocol}) + ? row.missingProtocols.map((protocol) => ( + + )) : 完整} ) @@ -142,7 +152,7 @@ export function Vehicles({ { title: '绑定', width: 90, render: (_: unknown, row: VehicleCoverageRow) => {row.bindingStatus === 'bound' ? '已绑定' : '未绑定'} }, { title: '操作', width: 110, render: (_: unknown, row: VehicleCoverageRow) => } ], - [onOpenVehicle] + [filters, onOpenVehicle] ); return ( 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 c66025a7..619ad9b7 100644 --- a/vehicle-data-platform/apps/web/src/test/App.test.tsx +++ b/vehicle-data-platform/apps/web/src/test/App.test.tsx @@ -477,6 +477,11 @@ test('filters vehicle list by missing source evidence', async () => { expect(screen.getAllByText('缺失来源').length).toBeGreaterThanOrEqual(2); }); expect(screen.getAllByText('缺 YUTONG_MQTT').length).toBeGreaterThanOrEqual(1); + fireEvent.click(screen.getByRole('button', { name: '缺 YUTONG_MQTT' })); + expect(window.location.hash).toBe('#/vehicles?missingProtocol=YUTONG_MQTT'); + await waitFor(() => { + expect(fetchMock).toHaveBeenCalledWith(expect.stringContaining('missingProtocol=YUTONG_MQTT'), undefined); + }); fireEvent.click(screen.getByTestId('missing-protocol-filter')); const mqttOptions = await screen.findAllByText('缺 YUTONG_MQTT'); fireEvent.click(mqttOptions[mqttOptions.length - 1]);