feat(platform): expose missing sources per vehicle
This commit is contained in:
@@ -52,6 +52,7 @@ export interface VehicleCoverageRow {
|
||||
phone: string;
|
||||
oem: string;
|
||||
protocols: string[];
|
||||
missingProtocols: string[];
|
||||
sourceCount: number;
|
||||
onlineSourceCount: number;
|
||||
online: boolean;
|
||||
|
||||
@@ -125,6 +125,17 @@ export function Vehicles({
|
||||
</Space>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: '缺失来源',
|
||||
width: 220,
|
||||
render: (_: unknown, row: VehicleCoverageRow) => (
|
||||
<Space spacing={4} wrap>
|
||||
{(row.missingProtocols ?? []).length > 0
|
||||
? row.missingProtocols.map((protocol) => <Tag key={protocol} color="orange">缺 {protocol}</Tag>)
|
||||
: <Tag color="green">完整</Tag>}
|
||||
</Space>
|
||||
)
|
||||
},
|
||||
{ title: '证据覆盖', width: 120, render: (_: unknown, row: VehicleCoverageRow) => sourceEvidenceText(row) },
|
||||
{ title: '在线', width: 90, render: (_: unknown, row: VehicleCoverageRow) => <StatusTag status={row.online ? 'ok' : 'offline'} /> },
|
||||
{ title: '最后在线', dataIndex: 'lastSeen', width: 170 },
|
||||
|
||||
@@ -445,6 +445,7 @@ test('filters vehicle list by missing source evidence', async () => {
|
||||
phone: '13307795425',
|
||||
oem: 'G7s',
|
||||
protocols: ['GB32960', 'JT808'],
|
||||
missingProtocols: ['YUTONG_MQTT'],
|
||||
sourceCount: 2,
|
||||
onlineSourceCount: 0,
|
||||
online: false,
|
||||
@@ -472,9 +473,13 @@ test('filters vehicle list by missing source evidence', async () => {
|
||||
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByText('缺失来源')).toBeInTheDocument();
|
||||
await waitFor(() => {
|
||||
expect(screen.getAllByText('缺失来源').length).toBeGreaterThanOrEqual(2);
|
||||
});
|
||||
expect(screen.getAllByText('缺 YUTONG_MQTT').length).toBeGreaterThanOrEqual(1);
|
||||
fireEvent.click(screen.getByTestId('missing-protocol-filter'));
|
||||
fireEvent.click(await screen.findByText('缺 YUTONG_MQTT'));
|
||||
const mqttOptions = await screen.findAllByText('缺 YUTONG_MQTT');
|
||||
fireEvent.click(mqttOptions[mqttOptions.length - 1]);
|
||||
fireEvent.click(screen.getByRole('button', { name: '查询' }));
|
||||
|
||||
await waitFor(() => {
|
||||
|
||||
Reference in New Issue
Block a user