feat(platform): add source readiness operations view
This commit is contained in:
@@ -121,6 +121,59 @@ test('exposes AMap operations shortcuts when map key is configured', async () =>
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
if (path.includes('/api/ops/source-readiness')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: {
|
||||
totalVehicles: 1033,
|
||||
onlineVehicles: 208,
|
||||
kafkaLag: 42,
|
||||
activeConnections: 1234,
|
||||
redisOnlineKeys: 368,
|
||||
platformRelease: 'platform-ops-test',
|
||||
sources: [
|
||||
{
|
||||
protocol: 'GB32960',
|
||||
role: '整车与氢能实时数据主来源',
|
||||
online: 73,
|
||||
total: 340,
|
||||
onlineRate: 21.47,
|
||||
missingVehicles: 693,
|
||||
severity: 'warning',
|
||||
status: '覆盖不足',
|
||||
evidence: '在线 73/340,缺失车辆 693,Kafka Lag 42',
|
||||
action: '核对现代和交投平台转发清单。',
|
||||
acceptance: '缺失来源车辆下降,单源车辆可解释。',
|
||||
vehiclesHash: '#/vehicles?protocol=GB32960&missingProtocol=GB32960',
|
||||
realtimeHash: '#/realtime?protocol=GB32960&online=online',
|
||||
historyHash: '#/history-query?protocol=GB32960&tab=raw&includeFields=true',
|
||||
alertHash: '#/alert-events?protocol=GB32960'
|
||||
},
|
||||
{
|
||||
protocol: 'JT808',
|
||||
role: '位置、总里程和设备在线主来源',
|
||||
online: 174,
|
||||
total: 424,
|
||||
onlineRate: 41.04,
|
||||
missingVehicles: 609,
|
||||
severity: 'ok',
|
||||
status: '生产可用',
|
||||
evidence: '在线 174/424,缺失车辆 609,Kafka Lag 42',
|
||||
action: '保持实时、轨迹、RAW 和统计链路巡检。',
|
||||
acceptance: '车辆服务可回查实时、轨迹和 RAW 证据。',
|
||||
vehiclesHash: '#/vehicles?protocol=JT808&missingProtocol=JT808',
|
||||
realtimeHash: '#/realtime?protocol=JT808&online=online',
|
||||
historyHash: '#/history-query?protocol=JT808&tab=raw&includeFields=true',
|
||||
alertHash: '#/alert-events?protocol=JT808'
|
||||
}
|
||||
]
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
@@ -191,6 +244,59 @@ test('shows global alert pressure from notification plan in topbar', async () =>
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
if (path.includes('/api/ops/source-readiness')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: {
|
||||
totalVehicles: 1033,
|
||||
onlineVehicles: 208,
|
||||
kafkaLag: 42,
|
||||
activeConnections: 1234,
|
||||
redisOnlineKeys: 368,
|
||||
platformRelease: 'platform-ops-test',
|
||||
sources: [
|
||||
{
|
||||
protocol: 'GB32960',
|
||||
role: '整车与氢能实时数据主来源',
|
||||
online: 73,
|
||||
total: 340,
|
||||
onlineRate: 21.47,
|
||||
missingVehicles: 693,
|
||||
severity: 'warning',
|
||||
status: '覆盖不足',
|
||||
evidence: '在线 73/340,缺失车辆 693,Kafka Lag 42',
|
||||
action: '核对现代和交投平台转发清单。',
|
||||
acceptance: '缺失来源车辆下降,单源车辆可解释。',
|
||||
vehiclesHash: '#/vehicles?protocol=GB32960&missingProtocol=GB32960',
|
||||
realtimeHash: '#/realtime?protocol=GB32960&online=online',
|
||||
historyHash: '#/history-query?protocol=GB32960&tab=raw&includeFields=true',
|
||||
alertHash: '#/alert-events?protocol=GB32960'
|
||||
},
|
||||
{
|
||||
protocol: 'JT808',
|
||||
role: '位置、总里程和设备在线主来源',
|
||||
online: 73,
|
||||
total: 340,
|
||||
onlineRate: 21.47,
|
||||
missingVehicles: 693,
|
||||
severity: 'warning',
|
||||
status: '覆盖不足',
|
||||
evidence: '在线 73/340,缺失车辆 693,Kafka Lag 42',
|
||||
action: '补齐手机号绑定和注册缺失车辆。',
|
||||
acceptance: '未知 VIN 注册下降,位置与里程持续可查。',
|
||||
vehiclesHash: '#/vehicles?protocol=JT808&missingProtocol=JT808',
|
||||
realtimeHash: '#/realtime?protocol=JT808&online=online',
|
||||
historyHash: '#/history-query?protocol=JT808&tab=raw&includeFields=true',
|
||||
alertHash: '#/alert-events?protocol=JT808'
|
||||
}
|
||||
]
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
@@ -3732,6 +3838,59 @@ test('renders ops quality as a standalone runtime health page', async () => {
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
if (path.includes('/api/ops/source-readiness')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: {
|
||||
totalVehicles: 1033,
|
||||
onlineVehicles: 208,
|
||||
kafkaLag: 42,
|
||||
activeConnections: 1234,
|
||||
redisOnlineKeys: 368,
|
||||
platformRelease: 'platform-ops-test',
|
||||
sources: [
|
||||
{
|
||||
protocol: 'GB32960',
|
||||
role: '整车与氢能实时数据主来源',
|
||||
online: 73,
|
||||
total: 340,
|
||||
onlineRate: 21.47,
|
||||
missingVehicles: 693,
|
||||
severity: 'warning',
|
||||
status: '覆盖不足',
|
||||
evidence: '在线 73/340,缺失车辆 693,Kafka Lag 42',
|
||||
action: '核对现代和交投平台转发清单。',
|
||||
acceptance: '缺失来源车辆下降,单源车辆可解释。',
|
||||
vehiclesHash: '#/vehicles?protocol=GB32960&missingProtocol=GB32960',
|
||||
realtimeHash: '#/realtime?protocol=GB32960&online=online',
|
||||
historyHash: '#/history-query?protocol=GB32960&tab=raw&includeFields=true',
|
||||
alertHash: '#/alert-events?protocol=GB32960'
|
||||
},
|
||||
{
|
||||
protocol: 'JT808',
|
||||
role: '位置、总里程和设备在线主来源',
|
||||
online: 73,
|
||||
total: 340,
|
||||
onlineRate: 21.47,
|
||||
missingVehicles: 693,
|
||||
severity: 'warning',
|
||||
status: '覆盖不足',
|
||||
evidence: '在线 73/340,缺失车辆 693,Kafka Lag 42',
|
||||
action: '补齐手机号绑定和注册缺失车辆。',
|
||||
acceptance: '未知 VIN 注册下降,位置与里程持续可查。',
|
||||
vehiclesHash: '#/vehicles?protocol=JT808&missingProtocol=JT808',
|
||||
realtimeHash: '#/realtime?protocol=JT808&online=online',
|
||||
historyHash: '#/history-query?protocol=JT808&tab=raw&includeFields=true',
|
||||
alertHash: '#/alert-events?protocol=JT808'
|
||||
}
|
||||
]
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
@@ -3768,7 +3927,14 @@ test('renders ops quality as a standalone runtime health page', async () => {
|
||||
expect(screen.getByText('NATS 桥接 ACK 未确认')).toBeInTheDocument();
|
||||
expect(screen.getAllByText('NATS 桥接待消费').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getByText('桥接处置顺序')).toBeInTheDocument();
|
||||
expect(screen.getByText('数据源生产就绪度')).toBeInTheDocument();
|
||||
expect(await screen.findByText('GB32960')).toBeInTheDocument();
|
||||
expect(screen.getByText('JT808')).toBeInTheDocument();
|
||||
expect(screen.getByText('整车与氢能实时数据主来源')).toBeInTheDocument();
|
||||
expect(screen.getAllByText('覆盖不足').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getAllByText('在线 73/340,缺失车辆 693,Kafka Lag 42').length).toBeGreaterThanOrEqual(1);
|
||||
expect(fetchMock).toHaveBeenCalledWith(expect.stringContaining('/api/ops/health'), undefined);
|
||||
expect(fetchMock).toHaveBeenCalledWith(expect.stringContaining('/api/ops/source-readiness'), undefined);
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: '复制容量交接' }));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【车辆数据中台运维容量交接】'));
|
||||
@@ -3782,6 +3948,13 @@ test('renders ops quality as a standalone runtime health page', async () => {
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【车辆数据中台容量处置计划】'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('P0 稳定 NATS 到 Kafka 桥接'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('负责人:数据库 / 应用'));
|
||||
|
||||
const sourceReadinessCopyButton = screen.getByText('复制就绪度报告').closest('button');
|
||||
expect(sourceReadinessCopyButton).not.toBeNull();
|
||||
fireEvent.click(sourceReadinessCopyButton as HTMLButtonElement);
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【数据源生产就绪度】'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('GB32960 - 覆盖不足'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('实时监控:http://localhost:3000/#/realtime?protocol=GB32960&online=online'));
|
||||
});
|
||||
|
||||
test('copies notification text from quality priority queue', async () => {
|
||||
|
||||
Reference in New Issue
Block a user