feat(platform): open unified vehicle service by default
This commit is contained in:
@@ -127,7 +127,7 @@ export function History({ initialVin, initialProtocol, onOpenVehicle }: { initia
|
||||
title="历史数据"
|
||||
description="按车辆查询位置历史和 RAW 帧历史,数据来源只作为过滤和诊断维度"
|
||||
actions={(
|
||||
<Button disabled={!currentVehicleKeyword} onClick={() => onOpenVehicle(currentVehicleKeyword, currentProtocol)}>
|
||||
<Button disabled={!currentVehicleKeyword} onClick={() => onOpenVehicle(currentVehicleKeyword)}>
|
||||
当前车辆服务
|
||||
</Button>
|
||||
)}
|
||||
@@ -191,7 +191,7 @@ export function History({ initialVin, initialProtocol, onOpenVehicle }: { initia
|
||||
title: '操作',
|
||||
width: 110,
|
||||
render: (_: unknown, row: HistoryLocationRow) => (
|
||||
<Button disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin, row.protocol)}>车辆服务</Button>
|
||||
<Button disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin)}>车辆服务</Button>
|
||||
)
|
||||
}
|
||||
]}
|
||||
@@ -225,7 +225,7 @@ export function History({ initialVin, initialProtocol, onOpenVehicle }: { initia
|
||||
render: (_: unknown, row: RawFrameRow) => (
|
||||
<Space>
|
||||
<Button onClick={() => setSelectedRaw(row)}>字段</Button>
|
||||
<Button disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin, row.protocol)}>车辆服务</Button>
|
||||
<Button disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin)}>车辆服务</Button>
|
||||
</Space>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ export function Mileage({ initialVin, initialProtocol, onOpenVehicle }: { initia
|
||||
title="里程统计"
|
||||
description="按车辆汇总每日里程、区间里程和异常差值分析"
|
||||
actions={(
|
||||
<Button disabled={!currentVehicleKeyword} onClick={() => onOpenVehicle(currentVehicleKeyword, currentProtocol)}>
|
||||
<Button disabled={!currentVehicleKeyword} onClick={() => onOpenVehicle(currentVehicleKeyword)}>
|
||||
当前车辆服务
|
||||
</Button>
|
||||
)}
|
||||
@@ -149,7 +149,7 @@ export function Mileage({ initialVin, initialProtocol, onOpenVehicle }: { initia
|
||||
title: '操作',
|
||||
width: 110,
|
||||
render: (_: unknown, row: DailyMileageRow) => (
|
||||
<Button disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin, row.source)}>车辆服务</Button>
|
||||
<Button disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin)}>车辆服务</Button>
|
||||
)
|
||||
}
|
||||
]}
|
||||
|
||||
@@ -147,7 +147,7 @@ export function Realtime({ onOpenVehicle }: { onOpenVehicle: (vin: string, proto
|
||||
title: '操作',
|
||||
width: 110,
|
||||
render: (_: unknown, row: VehicleRealtimeRow) => (
|
||||
<Button disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin, row.primaryProtocol)}>车辆服务</Button>
|
||||
<Button disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin)}>车辆服务</Button>
|
||||
)
|
||||
}
|
||||
]}
|
||||
|
||||
@@ -1268,7 +1268,7 @@ test('shows vehicle and source scope on mileage hash', async () => {
|
||||
expect(screen.getByText('当前来源:GB32960')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('keeps row protocol when opening vehicle service from history results', async () => {
|
||||
test('opens unified vehicle service from history results without row protocol', async () => {
|
||||
window.history.replaceState(null, '', '/#/history?keyword=%E7%B2%A4AG18312&protocol=JT808');
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input, init) => {
|
||||
const path = String(input);
|
||||
@@ -1345,11 +1345,11 @@ test('keeps row protocol when opening vehicle service from history results', asy
|
||||
fireEvent.click(screen.getAllByRole('button', { name: '车辆服务' })[0]);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(window.location.hash).toBe('#/detail?keyword=VIN-JT808-001&protocol=JT808');
|
||||
expect(window.location.hash).toBe('#/detail?keyword=VIN-JT808-001');
|
||||
});
|
||||
});
|
||||
|
||||
test('keeps primary protocol when opening vehicle service from realtime vehicles', async () => {
|
||||
test('opens unified vehicle service from realtime vehicles without primary protocol', async () => {
|
||||
window.history.replaceState(null, '', '/#/realtime');
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||
const path = String(input);
|
||||
@@ -1420,7 +1420,7 @@ test('keeps primary protocol when opening vehicle service from realtime vehicles
|
||||
fireEvent.click(screen.getByRole('button', { name: '车辆服务' }));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(window.location.hash).toBe('#/detail?keyword=VIN-MQTT-001&protocol=YUTONG_MQTT');
|
||||
expect(window.location.hash).toBe('#/detail?keyword=VIN-MQTT-001');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1939,7 +1939,7 @@ test('opens source-specific history directly from vehicle detail source card', a
|
||||
});
|
||||
});
|
||||
|
||||
test('opens vehicle service from an empty history query with the current filters', async () => {
|
||||
test('opens unified vehicle service from an empty history query', async () => {
|
||||
window.history.replaceState(null, '', '/#/history?keyword=VIN404&protocol=JT808');
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||
const path = String(input);
|
||||
@@ -1980,7 +1980,7 @@ test('opens vehicle service from an empty history query with the current filters
|
||||
fireEvent.click(await screen.findByRole('button', { name: '当前车辆服务' }));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(window.location.hash).toBe('#/detail?keyword=VIN404&protocol=JT808');
|
||||
expect(window.location.hash).toBe('#/detail?keyword=VIN404');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user