feat(platform): link missing source diagnosis to vehicles
This commit is contained in:
@@ -210,7 +210,7 @@ export default function App() {
|
||||
dashboard: <Dashboard onOpenVehicle={openVehicle} onOpenQuality={() => navigatePage('quality')} onOpenVehicles={openVehicles} />,
|
||||
vehicles: <Vehicles onOpenVehicle={openVehicle} onFiltersChange={updateVehicleFilters} initialFilters={vehicleFilters} />,
|
||||
realtime: <Realtime onOpenVehicle={openVehicle} />,
|
||||
detail: <VehicleDetail vin={activeVin} protocol={activeProtocol} onOpenHistory={openHistoryForVehicle} onOpenMileage={openMileageForVehicle} onQueryChange={updateVehicleDetailQuery} />,
|
||||
detail: <VehicleDetail vin={activeVin} protocol={activeProtocol} onOpenHistory={openHistoryForVehicle} onOpenMileage={openMileageForVehicle} onOpenVehicles={openVehicles} onQueryChange={updateVehicleDetailQuery} />,
|
||||
history: <History initialVin={analysisVin} initialProtocol={activeProtocol} onOpenVehicle={openVehicle} />,
|
||||
mileage: <Mileage initialVin={analysisVin} initialProtocol={activeProtocol} onOpenVehicle={openVehicle} />,
|
||||
quality: <Quality onOpenVehicle={openVehicle} onHealthLoaded={(health) => setLinkIssueCount(health.linkHealth.filter((item) => item.status !== 'ok').length)} onFiltersChange={updateQualityFilters} initialFilters={qualityFilters} />
|
||||
|
||||
@@ -69,12 +69,14 @@ export function VehicleDetail({
|
||||
protocol,
|
||||
onOpenHistory,
|
||||
onOpenMileage,
|
||||
onOpenVehicles,
|
||||
onQueryChange
|
||||
}: {
|
||||
vin: string;
|
||||
protocol?: string;
|
||||
onOpenHistory: (vin: string, protocol?: string) => void;
|
||||
onOpenMileage: (vin: string, protocol?: string) => void;
|
||||
onOpenVehicles?: (filters?: Record<string, string>) => void;
|
||||
onQueryChange?: (keyword: string, protocol?: string) => void;
|
||||
}) {
|
||||
const [query, setQuery] = useState<VehicleQuery>({ keyword: vin, protocol });
|
||||
@@ -159,7 +161,17 @@ export function VehicleDetail({
|
||||
const missingProtocols = consistency?.missingProtocols ?? [];
|
||||
const missingProtocolText = missingProtocols.length > 0 ? (
|
||||
<Space spacing={4}>
|
||||
{missingProtocols.map((item) => <Tag key={item} color="orange">{item}</Tag>)}
|
||||
{missingProtocols.map((item) => (
|
||||
<Button
|
||||
key={item}
|
||||
size="small"
|
||||
theme="light"
|
||||
type="warning"
|
||||
onClick={() => onOpenVehicles?.({ serviceStatus: 'degraded', missingProtocol: item })}
|
||||
>
|
||||
查看缺 {item} 车辆
|
||||
</Button>
|
||||
))}
|
||||
</Space>
|
||||
) : '-';
|
||||
const evidenceSourceCount = overview?.sourceCount ?? consistencySourceCount;
|
||||
|
||||
@@ -2660,4 +2660,6 @@ test('shows cross-source consistency for one vehicle service', async () => {
|
||||
expect(screen.getAllByText('3 个来源有位置').length).toBeGreaterThan(0);
|
||||
expect(screen.getAllByText('0.4 km').length).toBeGreaterThan(0);
|
||||
expect(screen.getAllByText('35 秒').length).toBeGreaterThan(0);
|
||||
fireEvent.click(screen.getByRole('button', { name: '查看缺 YUTONG_MQTT 车辆' }));
|
||||
expect(window.location.hash).toBe('#/vehicles?serviceStatus=degraded&missingProtocol=YUTONG_MQTT');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user