fix(platform): clarify vehicle service status labels
This commit is contained in:
@@ -268,7 +268,7 @@ function serviceStatusFromOverview(overview: VehicleServiceOverview): VehicleSer
|
||||
return {
|
||||
status: 'degraded',
|
||||
severity: 'warning',
|
||||
title: '部分来源离线',
|
||||
title: '来源异常',
|
||||
detail: `${onlineSourceCount}/${sourceCount} 个来源在线,车辆服务可用但需要关注离线来源。`,
|
||||
sourceCount,
|
||||
onlineSourceCount
|
||||
|
||||
@@ -23,7 +23,7 @@ const serviceStatusColor: Record<string, 'green' | 'orange' | 'red' | 'grey'> =
|
||||
|
||||
const serviceStatusTitle: Record<string, string> = {
|
||||
healthy: '服务正常',
|
||||
degraded: '部分来源离线',
|
||||
degraded: '来源异常',
|
||||
offline: '车辆离线',
|
||||
no_data: '暂无数据来源',
|
||||
identity_required: '身份未绑定'
|
||||
@@ -54,7 +54,7 @@ function rowServiceStatus(row: { serviceStatus?: { title: string; severity: stri
|
||||
return { label: '车辆离线', color: 'red' as const };
|
||||
}
|
||||
if (row.onlineSourceCount < row.sourceCount) {
|
||||
return { label: '部分来源离线', color: 'orange' as const };
|
||||
return { label: '来源异常', color: 'orange' as const };
|
||||
}
|
||||
return { label: '服务正常', color: 'green' as const };
|
||||
}
|
||||
@@ -275,7 +275,7 @@ export function Dashboard({ onOpenVehicle, onOpenQuality, onOpenVehicles }: { on
|
||||
</Form.Select>
|
||||
<Form.Select field="serviceStatus" label="服务状态" placeholder="全部" style={{ width: 150 }} data-testid="dashboard-service-status-filter">
|
||||
<Select.Option value="healthy">服务正常</Select.Option>
|
||||
<Select.Option value="degraded">部分来源离线</Select.Option>
|
||||
<Select.Option value="degraded">来源异常</Select.Option>
|
||||
<Select.Option value="offline">车辆离线</Select.Option>
|
||||
<Select.Option value="no_data">暂无数据来源</Select.Option>
|
||||
<Select.Option value="identity_required">身份未绑定</Select.Option>
|
||||
|
||||
@@ -22,7 +22,7 @@ function vehicleServiceStatus(row: VehicleRealtimeRow) {
|
||||
return { label: '车辆离线', color: 'red' as const };
|
||||
}
|
||||
if (row.onlineSourceCount < row.sourceCount) {
|
||||
return { label: '部分来源离线', color: 'orange' as const };
|
||||
return { label: '来源异常', color: 'orange' as const };
|
||||
}
|
||||
return { label: '服务正常', color: 'green' as const };
|
||||
}
|
||||
@@ -78,7 +78,7 @@ export function Realtime({ onOpenVehicle }: { onOpenVehicle: (vin: string, proto
|
||||
</Form.Select>
|
||||
<Form.Select field="serviceStatus" label="服务状态" placeholder="全部" style={{ width: 150 }}>
|
||||
<Select.Option value="healthy">服务正常</Select.Option>
|
||||
<Select.Option value="degraded">部分来源离线</Select.Option>
|
||||
<Select.Option value="degraded">来源异常</Select.Option>
|
||||
<Select.Option value="offline">车辆离线</Select.Option>
|
||||
<Select.Option value="identity_required">身份未绑定</Select.Option>
|
||||
</Form.Select>
|
||||
|
||||
@@ -24,7 +24,7 @@ function vehicleServiceStatus(row: VehicleCoverageRow) {
|
||||
return { label: '车辆离线', color: 'red' as const };
|
||||
}
|
||||
if (row.onlineSourceCount < row.sourceCount) {
|
||||
return { label: '部分来源离线', color: 'orange' as const };
|
||||
return { label: '来源异常', color: 'orange' as const };
|
||||
}
|
||||
return { label: '服务正常', color: 'green' as const };
|
||||
}
|
||||
@@ -170,7 +170,7 @@ export function Vehicles({
|
||||
</Form.Select>
|
||||
<Form.Select field="serviceStatus" label="服务状态" placeholder="全部" style={{ width: 150 }} data-testid="service-status-filter">
|
||||
<Select.Option value="healthy">服务正常</Select.Option>
|
||||
<Select.Option value="degraded">部分来源离线</Select.Option>
|
||||
<Select.Option value="degraded">来源异常</Select.Option>
|
||||
<Select.Option value="offline">车辆离线</Select.Option>
|
||||
<Select.Option value="no_data">暂无数据来源</Select.Option>
|
||||
<Select.Option value="identity_required">身份未绑定</Select.Option>
|
||||
|
||||
@@ -817,13 +817,13 @@ test('filters dashboard coverage by service status', async () => {
|
||||
|
||||
expect(await screen.findByText('车辆服务覆盖')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByTestId('dashboard-service-status-filter'));
|
||||
fireEvent.click(await screen.findByText('部分来源离线'));
|
||||
fireEvent.click(await screen.findByText('来源异常'));
|
||||
fireEvent.click(screen.getByRole('button', { name: '筛选' }));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(fetchMock).toHaveBeenCalledWith(expect.stringContaining('serviceStatus=degraded'), undefined);
|
||||
});
|
||||
expect(screen.getByText('当前筛选:部分来源离线')).toBeInTheDocument();
|
||||
expect(screen.getByText('当前筛选:来源异常')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('filters dashboard coverage by missing source evidence', async () => {
|
||||
@@ -1284,7 +1284,7 @@ test('shows vehicle context when opening detail from shareable hash', async () =
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByText('粤AG18312 / VIN001')).toBeInTheDocument();
|
||||
expect(screen.getByText('当前车辆:部分来源离线')).toBeInTheDocument();
|
||||
expect(screen.getByText('当前车辆:来源异常')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('refreshes vehicle context when hash changes to another detail vehicle', async () => {
|
||||
@@ -1983,7 +1983,7 @@ test('filters vehicle list by service status', async () => {
|
||||
|
||||
await screen.findByRole('heading', { name: '车辆服务' });
|
||||
fireEvent.click(screen.getByTestId('service-status-filter'));
|
||||
fireEvent.click(await screen.findByText('部分来源离线'));
|
||||
fireEvent.click(await screen.findByText('来源异常'));
|
||||
fireEvent.click(screen.getByRole('button', { name: '查询' }));
|
||||
|
||||
await waitFor(() => {
|
||||
|
||||
Reference in New Issue
Block a user