feat(platform): expose source slots in realtime vehicles
This commit is contained in:
@@ -194,6 +194,7 @@ export interface VehicleRealtimeRow {
|
||||
phone: string;
|
||||
oem: string;
|
||||
protocols: string[];
|
||||
sourceStatus: VehicleSourceStatus[];
|
||||
sourceCount: number;
|
||||
onlineSourceCount: number;
|
||||
online: boolean;
|
||||
|
||||
@@ -4,6 +4,7 @@ import { api } from '../api/client';
|
||||
import type { VehicleRealtimeRow } from '../api/types';
|
||||
import { DataEmpty } from '../components/DataEmpty';
|
||||
import { PageHeader } from '../components/PageHeader';
|
||||
import { SourceStatusTags } from '../components/SourceStatusTags';
|
||||
import { StatusTag } from '../components/StatusTag';
|
||||
|
||||
function canOpenVehicle(vin?: string) {
|
||||
@@ -146,11 +147,7 @@ export function Realtime({
|
||||
title: '来源证据',
|
||||
width: 260,
|
||||
render: (_: unknown, row: VehicleRealtimeRow) => (
|
||||
<Space spacing={4} wrap>
|
||||
{row.protocols.map((protocol) => (
|
||||
<Tag key={protocol} color={protocol === row.primaryProtocol ? 'blue' : 'grey'}>{protocol}</Tag>
|
||||
))}
|
||||
</Space>
|
||||
<SourceStatusTags sourceStatus={row.sourceStatus} protocols={row.protocols} lastSeen={row.lastSeen} />
|
||||
)
|
||||
},
|
||||
{ title: '证据覆盖', width: 120, render: (_: unknown, row: VehicleRealtimeRow) => sourceEvidenceText(row) },
|
||||
|
||||
@@ -2671,6 +2671,11 @@ test('opens vehicle service from realtime vehicles with current source filter',
|
||||
phone: '',
|
||||
oem: 'G7s',
|
||||
protocols: ['GB32960', 'JT808'],
|
||||
sourceStatus: [
|
||||
{ protocol: 'GB32960', online: true, lastSeen: '2026-07-03 20:12:10', hasRealtime: true, hasHistory: false, hasRaw: false, hasMileage: false },
|
||||
{ protocol: 'JT808', online: true, lastSeen: '2026-07-03 20:11:10', hasRealtime: true, hasHistory: false, hasRaw: false, hasMileage: false },
|
||||
{ protocol: 'YUTONG_MQTT', online: false, lastSeen: '', hasRealtime: false, hasHistory: false, hasRaw: false, hasMileage: false }
|
||||
],
|
||||
sourceCount: 2,
|
||||
onlineSourceCount: 2,
|
||||
online: true,
|
||||
@@ -2809,6 +2814,11 @@ test('frames realtime page as one vehicle service with source evidence', async (
|
||||
phone: '',
|
||||
oem: 'G7s',
|
||||
protocols: ['GB32960', 'JT808'],
|
||||
sourceStatus: [
|
||||
{ protocol: 'GB32960', online: true, lastSeen: '2026-07-03 20:12:10', hasRealtime: true, hasHistory: false, hasRaw: false, hasMileage: false },
|
||||
{ protocol: 'JT808', online: true, lastSeen: '2026-07-03 20:11:10', hasRealtime: true, hasHistory: false, hasRaw: false, hasMileage: false },
|
||||
{ protocol: 'YUTONG_MQTT', online: false, lastSeen: '', hasRealtime: false, hasHistory: false, hasRaw: false, hasMileage: false }
|
||||
],
|
||||
sourceCount: 2,
|
||||
onlineSourceCount: 2,
|
||||
online: true,
|
||||
@@ -2853,6 +2863,9 @@ test('frames realtime page as one vehicle service with source evidence', async (
|
||||
expect(await screen.findByRole('heading', { name: '车辆服务实时态' })).toBeInTheDocument();
|
||||
expect(screen.getByText('车辆核心数据')).toBeInTheDocument();
|
||||
expect(screen.getByText('来源证据')).toBeInTheDocument();
|
||||
expect(screen.getByText('GB32960 在线')).toBeInTheDocument();
|
||||
expect(screen.getByText('JT808 在线')).toBeInTheDocument();
|
||||
expect(screen.getByText('YUTONG_MQTT 未接入')).toBeInTheDocument();
|
||||
expect(screen.getByText('2/2 来源在线')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user