feat(platform): expose vehicle operations shortcuts
This commit is contained in:
@@ -109,10 +109,17 @@ export function AppShell({
|
||||
<Tag color="blue">生产环境</Tag>
|
||||
<Tag color="grey">多源接入 / 一个车辆服务</Tag>
|
||||
<Tag color={amapConfigured ? 'green' : 'orange'}>{amapConfigured ? '地图就绪' : '地图待配置'}</Tag>
|
||||
<Button size="small" onClick={() => onChange('realtime')}>实时地图</Button>
|
||||
<Button size="small" onClick={() => onChange('history')}>地图回放</Button>
|
||||
<Button size="small" className={linkHealthClassName(linkIssueCount)} onClick={() => onChange('quality')}>
|
||||
{linkIssueCount == null ? '链路监控' : linkIssueCount > 0 ? `链路 ${linkIssueCount} 项关注` : '链路正常'}
|
||||
<Button size="small" aria-label="顶部实时监控" onClick={() => onChange('realtime')}>实时监控</Button>
|
||||
<Button size="small" aria-label="顶部轨迹回放" onClick={() => onChange('history')}>轨迹回放</Button>
|
||||
<Button size="small" aria-label="顶部历史查询" onClick={() => onChange('history')}>历史查询</Button>
|
||||
<Button size="small" aria-label="顶部统计查询" onClick={() => onChange('mileage')}>统计查询</Button>
|
||||
<Button
|
||||
size="small"
|
||||
aria-label={linkIssueCount == null ? '顶部告警通知' : linkIssueCount > 0 ? `顶部告警通知 ${linkIssueCount}项关注` : '顶部告警通知正常'}
|
||||
className={linkHealthClassName(linkIssueCount)}
|
||||
onClick={() => onChange('quality')}
|
||||
>
|
||||
{linkIssueCount == null ? '告警通知' : linkIssueCount > 0 ? `告警通知 ${linkIssueCount}项关注` : '告警通知正常'}
|
||||
</Button>
|
||||
</Space>
|
||||
</header>
|
||||
|
||||
@@ -29,6 +29,36 @@ test('exposes AMap operations shortcuts when map key is configured', async () =>
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
if (path.includes('/api/mileage/summary')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: { vehicleCount: 0, recordCount: 0, sourceCount: 0, totalMileageKm: 0, averageMileagePerVin: 0 },
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
if (path.includes('/api/quality/summary')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: { issueVehicleCount: 0, issueRecordCount: 0, errorCount: 0, warningCount: 0, protocols: [], issueTypes: [] },
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
if (path.includes('/api/quality/notification-plan')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: { rules: [], policies: [], priorityIssues: [], activeRuleCount: 0, p0RuleCount: 0 },
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
@@ -42,10 +72,16 @@ test('exposes AMap operations shortcuts when map key is configured', async () =>
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByText('地图就绪')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button', { name: '实时地图' }));
|
||||
fireEvent.click(screen.getByRole('button', { name: '顶部实时监控' }));
|
||||
expect(window.location.hash).toBe('#/realtime');
|
||||
fireEvent.click(screen.getByRole('button', { name: '地图回放' }));
|
||||
fireEvent.click(screen.getByRole('button', { name: '顶部轨迹回放' }));
|
||||
expect(window.location.hash.startsWith('#/history')).toBe(true);
|
||||
fireEvent.click(screen.getByRole('button', { name: '顶部历史查询' }));
|
||||
expect(window.location.hash.startsWith('#/history')).toBe(true);
|
||||
fireEvent.click(screen.getByRole('button', { name: '顶部统计查询' }));
|
||||
expect(window.location.hash.startsWith('#/mileage')).toBe(true);
|
||||
fireEvent.click(await screen.findByRole('button', { name: '顶部告警通知正常' }));
|
||||
expect(window.location.hash).toBe('#/quality');
|
||||
});
|
||||
|
||||
test('shows vehicle service status distribution on dashboard', async () => {
|
||||
|
||||
Reference in New Issue
Block a user