fix(platform): keep realtime source when opening vehicle
This commit is contained in:
@@ -147,7 +147,7 @@ export function Realtime({ onOpenVehicle }: { onOpenVehicle: (vin: string, proto
|
|||||||
title: '操作',
|
title: '操作',
|
||||||
width: 110,
|
width: 110,
|
||||||
render: (_: unknown, row: VehicleRealtimeRow) => (
|
render: (_: unknown, row: VehicleRealtimeRow) => (
|
||||||
<Button disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin)}>车辆服务</Button>
|
<Button disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin, row.primaryProtocol)}>车辆服务</Button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
|
|||||||
@@ -1913,7 +1913,7 @@ test('opens current vehicle service from history header with current source evid
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('opens unified vehicle service from realtime vehicles without primary protocol', async () => {
|
test('opens vehicle service from realtime vehicles with primary source evidence', async () => {
|
||||||
window.history.replaceState(null, '', '/#/realtime');
|
window.history.replaceState(null, '', '/#/realtime');
|
||||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||||
const path = String(input);
|
const path = String(input);
|
||||||
@@ -1984,7 +1984,7 @@ test('opens unified vehicle service from realtime vehicles without primary proto
|
|||||||
fireEvent.click(screen.getByRole('button', { name: '车辆服务' }));
|
fireEvent.click(screen.getByRole('button', { name: '车辆服务' }));
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(window.location.hash).toBe('#/detail?keyword=VIN-MQTT-001');
|
expect(window.location.hash).toBe('#/detail?keyword=VIN-MQTT-001&protocol=YUTONG_MQTT');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user