feat(platform): align quality issues with vehicle service
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { describe, expect, test } from 'vitest';
|
||||
import { qualityIssueLabel, qualityProtocolLabel, qualityProtocolOptions } from './qualityIssue';
|
||||
|
||||
describe('qualityIssueLabel', () => {
|
||||
test('maps no-source issues to a vehicle-service label', () => {
|
||||
expect(qualityIssueLabel('NO_SOURCE')).toBe('暂无数据来源');
|
||||
});
|
||||
|
||||
test('keeps unknown issue types visible', () => {
|
||||
expect(qualityIssueLabel('CUSTOM_GAP')).toBe('CUSTOM_GAP');
|
||||
});
|
||||
});
|
||||
|
||||
describe('qualityProtocolLabel', () => {
|
||||
test('labels vehicle-level quality issues as vehicle service', () => {
|
||||
expect(qualityProtocolLabel('VEHICLE_SERVICE')).toBe('车辆服务');
|
||||
});
|
||||
});
|
||||
|
||||
describe('qualityProtocolOptions', () => {
|
||||
test('includes vehicle service and all ingestion sources', () => {
|
||||
expect(qualityProtocolOptions.map((item) => item.value)).toEqual([
|
||||
'VEHICLE_SERVICE',
|
||||
'GB32960',
|
||||
'JT808',
|
||||
'YUTONG_MQTT'
|
||||
]);
|
||||
});
|
||||
});
|
||||
28
vehicle-data-platform/apps/web/src/domain/qualityIssue.ts
Normal file
28
vehicle-data-platform/apps/web/src/domain/qualityIssue.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
const issueLabels: Record<string, string> = {
|
||||
NO_SOURCE: '暂无数据来源',
|
||||
VIN_MISSING: 'VIN 缺失',
|
||||
LINK_GAP: '链路间断',
|
||||
FIELD_MISSING: '字段缺失'
|
||||
};
|
||||
|
||||
const protocolLabels: Record<string, string> = {
|
||||
VEHICLE_SERVICE: '车辆服务',
|
||||
GB32960: 'GB32960',
|
||||
JT808: 'JT808',
|
||||
YUTONG_MQTT: '宇通 MQTT'
|
||||
};
|
||||
|
||||
export const qualityProtocolOptions = [
|
||||
{ value: 'VEHICLE_SERVICE', label: protocolLabels.VEHICLE_SERVICE },
|
||||
{ value: 'GB32960', label: protocolLabels.GB32960 },
|
||||
{ value: 'JT808', label: protocolLabels.JT808 },
|
||||
{ value: 'YUTONG_MQTT', label: protocolLabels.YUTONG_MQTT }
|
||||
];
|
||||
|
||||
export function qualityIssueLabel(issueType: string) {
|
||||
return issueLabels[issueType] ?? issueType;
|
||||
}
|
||||
|
||||
export function qualityProtocolLabel(protocol: string) {
|
||||
return protocolLabels[protocol] ?? protocol;
|
||||
}
|
||||
Reference in New Issue
Block a user