feat(platform): filter vehicles from missing source tags
This commit is contained in:
@@ -131,7 +131,17 @@ export function Vehicles({
|
|||||||
render: (_: unknown, row: VehicleCoverageRow) => (
|
render: (_: unknown, row: VehicleCoverageRow) => (
|
||||||
<Space spacing={4} wrap>
|
<Space spacing={4} wrap>
|
||||||
{(row.missingProtocols ?? []).length > 0
|
{(row.missingProtocols ?? []).length > 0
|
||||||
? row.missingProtocols.map((protocol) => <Tag key={protocol} color="orange">缺 {protocol}</Tag>)
|
? row.missingProtocols.map((protocol) => (
|
||||||
|
<Button
|
||||||
|
key={protocol}
|
||||||
|
size="small"
|
||||||
|
theme="light"
|
||||||
|
type="warning"
|
||||||
|
onClick={() => applyFilters({ ...filters, missingProtocol: protocol })}
|
||||||
|
>
|
||||||
|
缺 {protocol}
|
||||||
|
</Button>
|
||||||
|
))
|
||||||
: <Tag color="green">完整</Tag>}
|
: <Tag color="green">完整</Tag>}
|
||||||
</Space>
|
</Space>
|
||||||
)
|
)
|
||||||
@@ -142,7 +152,7 @@ export function Vehicles({
|
|||||||
{ title: '绑定', width: 90, render: (_: unknown, row: VehicleCoverageRow) => <Tag color={row.bindingStatus === 'bound' ? 'green' : 'orange'}>{row.bindingStatus === 'bound' ? '已绑定' : '未绑定'}</Tag> },
|
{ title: '绑定', width: 90, render: (_: unknown, row: VehicleCoverageRow) => <Tag color={row.bindingStatus === 'bound' ? 'green' : 'orange'}>{row.bindingStatus === 'bound' ? '已绑定' : '未绑定'}</Tag> },
|
||||||
{ title: '操作', width: 110, render: (_: unknown, row: VehicleCoverageRow) => <Button onClick={() => onOpenVehicle(row.vin)}>车辆服务</Button> }
|
{ title: '操作', width: 110, render: (_: unknown, row: VehicleCoverageRow) => <Button onClick={() => onOpenVehicle(row.vin)}>车辆服务</Button> }
|
||||||
],
|
],
|
||||||
[onOpenVehicle]
|
[filters, onOpenVehicle]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -477,6 +477,11 @@ test('filters vehicle list by missing source evidence', async () => {
|
|||||||
expect(screen.getAllByText('缺失来源').length).toBeGreaterThanOrEqual(2);
|
expect(screen.getAllByText('缺失来源').length).toBeGreaterThanOrEqual(2);
|
||||||
});
|
});
|
||||||
expect(screen.getAllByText('缺 YUTONG_MQTT').length).toBeGreaterThanOrEqual(1);
|
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'));
|
fireEvent.click(screen.getByTestId('missing-protocol-filter'));
|
||||||
const mqttOptions = await screen.findAllByText('缺 YUTONG_MQTT');
|
const mqttOptions = await screen.findAllByText('缺 YUTONG_MQTT');
|
||||||
fireEvent.click(mqttOptions[mqttOptions.length - 1]);
|
fireEvent.click(mqttOptions[mqttOptions.length - 1]);
|
||||||
|
|||||||
Reference in New Issue
Block a user