feat(platform): add realtime operations impact board

This commit is contained in:
lingniu
2026-07-04 22:39:10 +08:00
parent 6803d51b78
commit a005dba2d4
3 changed files with 181 additions and 0 deletions

View File

@@ -8332,6 +8332,11 @@ test('shows canonical service status in realtime vehicles', async () => {
test('frames realtime page as one vehicle service with source evidence', async () => {
window.history.replaceState(null, '', '/#/realtime');
const writeText = vi.fn(() => Promise.resolve());
Object.defineProperty(navigator, 'clipboard', {
configurable: true,
value: { writeText }
});
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
const path = String(input);
if (path.includes('/api/realtime/vehicles')) {
@@ -8400,6 +8405,23 @@ test('frames realtime page as one vehicle service with source evidence', async (
expect(screen.getByText('JT808 在线')).toBeInTheDocument();
expect(screen.getByText('YUTONG_MQTT 未接入')).toBeInTheDocument();
expect(screen.getAllByText('2/2 来源在线').length).toBeGreaterThan(0);
expect(screen.getByText('实时运营影响')).toBeInTheDocument();
expect(screen.getByRole('button', { name: /复制影响报告/ })).toBeInTheDocument();
expect(screen.getByText('需要处置')).toBeInTheDocument();
expect(screen.getByText('车辆范围')).toBeInTheDocument();
expect(screen.getByText('在线影响')).toBeInTheDocument();
expect(screen.getByText('定位影响')).toBeInTheDocument();
expect(screen.getByText('服务影响')).toBeInTheDocument();
expect(screen.getByText('地图能力')).toBeInTheDocument();
expect(screen.getByText('当前页 1 辆,在线 1 辆,定位有效 1 辆,降级 0 辆,超时 1 辆。')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: /复制影响报告/ }));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【实时运营影响】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('影响等级:需要处置'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆范围:当前页 1 / 总计 1覆盖率 100%'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('在线状态1 在线 / 0 离线'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('定位影响1 辆有有效坐标'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('服务影响0 辆降级 / 1 辆超时'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('地图能力:高德地图未配置,使用坐标预览'));
});
test('refreshes realtime vehicle data from the monitoring workspace', async () => {