feat(platform): summarize missing vehicle sources
This commit is contained in:
@@ -68,6 +68,7 @@ export interface VehicleCoverageSummary {
|
||||
multiSourceVehicles: number;
|
||||
noDataVehicles: number;
|
||||
unboundVehicles: number;
|
||||
missingSources: MissingSourceStat[];
|
||||
}
|
||||
|
||||
export interface VehicleIdentityResolution {
|
||||
|
||||
@@ -65,6 +65,14 @@ export function Vehicles({
|
||||
{ label: '暂无来源车辆', value: (summary?.noDataVehicles ?? 0).toLocaleString(), filters: { serviceStatus: 'no_data' } },
|
||||
{ label: '待绑定', value: (summary?.unboundVehicles ?? 0).toLocaleString(), filters: { bindingStatus: 'unbound' } }
|
||||
];
|
||||
for (const source of summary?.missingSources ?? []) {
|
||||
if (source.count <= 0) continue;
|
||||
items.push({
|
||||
label: `缺 ${source.protocol}`,
|
||||
value: source.count.toLocaleString(),
|
||||
filters: { missingProtocol: source.protocol }
|
||||
});
|
||||
}
|
||||
return items;
|
||||
}, [pagination.total, summary]);
|
||||
|
||||
|
||||
@@ -427,7 +427,8 @@ test('filters vehicle list by missing source evidence', async () => {
|
||||
singleSourceVehicles: 0,
|
||||
multiSourceVehicles: 1,
|
||||
noDataVehicles: 0,
|
||||
unboundVehicles: 0
|
||||
unboundVehicles: 0,
|
||||
missingSources: [{ protocol: 'YUTONG_MQTT', count: 1 }]
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
@@ -477,6 +478,8 @@ 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 1' }));
|
||||
expect(window.location.hash).toBe('#/vehicles?missingProtocol=YUTONG_MQTT');
|
||||
fireEvent.click(screen.getByRole('button', { name: '缺 YUTONG_MQTT' }));
|
||||
expect(window.location.hash).toBe('#/vehicles?missingProtocol=YUTONG_MQTT');
|
||||
await waitFor(() => {
|
||||
|
||||
Reference in New Issue
Block a user