fix(platform): unify degraded service wording
This commit is contained in:
@@ -462,7 +462,7 @@ function serviceStatusFromOverview(overview: VehicleServiceOverview): VehicleSer
|
||||
return {
|
||||
status: 'degraded',
|
||||
severity: 'warning',
|
||||
title: '来源异常',
|
||||
title: '来源不完整',
|
||||
detail: `${onlineSourceCount}/${sourceCount} 个来源在线,车辆服务可用但需要关注离线来源。`,
|
||||
sourceCount,
|
||||
onlineSourceCount
|
||||
|
||||
@@ -87,7 +87,7 @@ test('vehicleServiceOverview sends keyword to the lightweight overview endpoint'
|
||||
serviceStatus: {
|
||||
status: 'degraded',
|
||||
severity: 'warning',
|
||||
title: '部分来源离线',
|
||||
title: '来源不完整',
|
||||
detail: '1/2 个来源在线',
|
||||
sourceCount: 2,
|
||||
onlineSourceCount: 1
|
||||
|
||||
@@ -24,7 +24,7 @@ const serviceStatusColor: Record<string, 'green' | 'orange' | 'red' | 'grey'> =
|
||||
|
||||
const serviceStatusTitle: Record<string, string> = {
|
||||
healthy: '服务正常',
|
||||
degraded: '来源异常',
|
||||
degraded: '来源不完整',
|
||||
offline: '车辆离线',
|
||||
no_data: '暂无数据来源',
|
||||
identity_required: '身份未绑定'
|
||||
@@ -62,7 +62,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 };
|
||||
}
|
||||
@@ -312,7 +312,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>
|
||||
|
||||
@@ -23,7 +23,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 };
|
||||
}
|
||||
@@ -93,7 +93,7 @@ export function Realtime({
|
||||
</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>
|
||||
|
||||
@@ -25,7 +25,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 };
|
||||
}
|
||||
@@ -227,7 +227,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>
|
||||
|
||||
@@ -31,7 +31,7 @@ test('shows vehicle service status distribution on dashboard', async () => {
|
||||
protocols: [],
|
||||
serviceStatuses: [
|
||||
{ status: 'healthy', title: '服务正常', count: 12 },
|
||||
{ status: 'degraded', title: '部分来源离线', count: 39 }
|
||||
{ status: 'degraded', title: '来源不完整', count: 39 }
|
||||
],
|
||||
linkHealth: []
|
||||
},
|
||||
@@ -53,7 +53,7 @@ test('shows vehicle service status distribution on dashboard', async () => {
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByText('车辆服务状态')).toBeInTheDocument();
|
||||
expect(screen.getByText('部分来源离线')).toBeInTheDocument();
|
||||
expect(screen.getByText('来源不完整')).toBeInTheDocument();
|
||||
expect(screen.getByText('39')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -94,7 +94,7 @@ test('dashboard renders vehicle service summary metrics', async () => {
|
||||
identityRequiredVehicles: 9,
|
||||
serviceStatuses: [
|
||||
{ status: 'healthy', title: '服务正常', count: 161 },
|
||||
{ status: 'degraded', title: '部分来源离线', count: 41 }
|
||||
{ status: 'degraded', title: '来源不完整', count: 41 }
|
||||
],
|
||||
protocols: [
|
||||
{ protocol: 'JT808', online: 157, total: 388 },
|
||||
@@ -310,7 +310,7 @@ test('shows vehicle service result summary on vehicle list filters', async () =>
|
||||
serviceStatus: {
|
||||
status: 'degraded',
|
||||
severity: 'warning',
|
||||
title: '部分来源离线',
|
||||
title: '来源不完整',
|
||||
detail: '1/2 个来源在线',
|
||||
sourceCount: 2,
|
||||
onlineSourceCount: 1
|
||||
@@ -913,7 +913,7 @@ test('filters dashboard coverage from source consistency diagnosis', async () =>
|
||||
expect(fetchMock).toHaveBeenCalledWith(expect.stringContaining('serviceStatus=degraded'), undefined);
|
||||
});
|
||||
expect(fetchMock).toHaveBeenCalledWith(expect.stringContaining('missingProtocol=JT808'), undefined);
|
||||
expect(screen.getByText('当前筛选:来源异常 / 缺 JT808')).toBeInTheDocument();
|
||||
expect(screen.getByText('当前筛选:来源不完整 / 缺 JT808')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('opens full vehicle service list from dashboard coverage filters', async () => {
|
||||
@@ -1251,13 +1251,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 () => {
|
||||
@@ -1322,7 +1322,7 @@ test('opens dashboard coverage from service status distribution', async () => {
|
||||
kafkaLag: 0,
|
||||
protocols: [],
|
||||
serviceStatuses: [
|
||||
{ status: 'degraded', title: '部分来源离线', count: 39 }
|
||||
{ status: 'degraded', title: '来源不完整', count: 39 }
|
||||
],
|
||||
linkHealth: []
|
||||
},
|
||||
@@ -1343,7 +1343,7 @@ test('opens dashboard coverage from service status distribution', async () => {
|
||||
|
||||
render(<App />);
|
||||
|
||||
fireEvent.click(await screen.findByRole('button', { name: '查看部分来源离线' }));
|
||||
fireEvent.click(await screen.findByRole('button', { name: '查看来源不完整' }));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(fetchMock).toHaveBeenCalledWith(expect.stringContaining('serviceStatus=degraded'), undefined);
|
||||
@@ -1816,7 +1816,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 () => {
|
||||
@@ -2769,7 +2769,7 @@ test('shows canonical service status in realtime vehicles', async () => {
|
||||
serviceStatus: {
|
||||
status: 'degraded',
|
||||
severity: 'warning',
|
||||
title: '部分来源离线',
|
||||
title: '来源不完整',
|
||||
detail: '由实时车辆 API 统一判定',
|
||||
sourceCount: 2,
|
||||
onlineSourceCount: 1
|
||||
@@ -2797,7 +2797,7 @@ test('shows canonical service status in realtime vehicles', async () => {
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByText('VIN-RT-DEGRADED')).toBeInTheDocument();
|
||||
expect(screen.getByText('部分来源离线')).toBeInTheDocument();
|
||||
expect(screen.getByText('来源不完整')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('frames realtime page as one vehicle service with source evidence', async () => {
|
||||
@@ -2983,7 +2983,7 @@ test('shows vehicle service status in vehicle list', async () => {
|
||||
serviceStatus: {
|
||||
status: 'degraded',
|
||||
severity: 'warning',
|
||||
title: '部分来源离线',
|
||||
title: '来源不完整',
|
||||
detail: '由车辆服务 API 统一判定',
|
||||
sourceCount: 2,
|
||||
onlineSourceCount: 1
|
||||
@@ -3014,7 +3014,7 @@ test('shows vehicle service status in vehicle list', async () => {
|
||||
|
||||
expect(await screen.findByText('VIN-DEGRADED-001')).toBeInTheDocument();
|
||||
expect(screen.getByText('车辆服务状态')).toBeInTheDocument();
|
||||
expect(screen.getByText('部分来源离线')).toBeInTheDocument();
|
||||
expect(screen.getByText('来源不完整')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('shows source consistency diagnosis in vehicle service list', async () => {
|
||||
@@ -3373,7 +3373,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(() => {
|
||||
@@ -3500,7 +3500,7 @@ test('shows unified service overview on vehicle detail', async () => {
|
||||
serviceStatus: {
|
||||
status: 'degraded',
|
||||
severity: 'warning',
|
||||
title: '部分来源离线',
|
||||
title: '来源不完整',
|
||||
detail: '2/3 个来源在线',
|
||||
sourceCount: 3,
|
||||
onlineSourceCount: 2
|
||||
@@ -3569,7 +3569,7 @@ test('shows vehicle service evidence chain before source details', async () => {
|
||||
serviceStatus: {
|
||||
status: 'degraded',
|
||||
severity: 'warning',
|
||||
title: '部分来源离线',
|
||||
title: '来源不完整',
|
||||
detail: '2/3 个来源在线',
|
||||
sourceCount: 3,
|
||||
onlineSourceCount: 2
|
||||
@@ -3583,7 +3583,7 @@ test('shows vehicle service evidence chain before source details', async () => {
|
||||
scope: 'vehicle',
|
||||
status: 'degraded',
|
||||
severity: 'warning',
|
||||
title: '部分来源离线',
|
||||
title: '来源不完整',
|
||||
detail: 'MQTT 离线,32960 与 808 仍可支撑车辆服务'
|
||||
},
|
||||
sources: ['GB32960', 'JT808', 'YUTONG_MQTT'],
|
||||
@@ -4145,7 +4145,7 @@ test('shows selected source scope on vehicle detail', async () => {
|
||||
serviceStatus: {
|
||||
status: 'degraded',
|
||||
severity: 'warning',
|
||||
title: '部分来源离线',
|
||||
title: '来源不完整',
|
||||
detail: '1/2 个来源在线,车辆服务可用但需要关注离线来源。',
|
||||
sourceCount: 2,
|
||||
onlineSourceCount: 1
|
||||
@@ -4178,7 +4178,7 @@ test('shows selected source scope on vehicle detail', async () => {
|
||||
expect(await screen.findByText('当前查看范围')).toBeInTheDocument();
|
||||
expect(screen.getByText('单一来源:JT808')).toBeInTheDocument();
|
||||
expect(screen.getByText('车辆服务状态')).toBeInTheDocument();
|
||||
expect(screen.getByText('部分来源离线')).toBeInTheDocument();
|
||||
expect(screen.getByText('来源不完整')).toBeInTheDocument();
|
||||
expect(fetchMock).toHaveBeenCalledWith(expect.stringContaining('/api/vehicle-service?keyword=VIN001&protocol=JT808'), undefined);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user