feat(platform): surface map situation from dashboard
This commit is contained in:
@@ -281,6 +281,12 @@ export default function App() {
|
||||
replaceRealtimeHash(filters);
|
||||
};
|
||||
|
||||
const openMap = (filters: Record<string, string> = {}) => {
|
||||
setRealtimeFilters(filters);
|
||||
setActivePage('map');
|
||||
replaceMapHash(filters);
|
||||
};
|
||||
|
||||
const openVehicle = async (keyword: string, protocol?: string) => {
|
||||
const lookupKey = keyword.trim();
|
||||
const nextProtocol = protocol?.trim() ?? '';
|
||||
@@ -420,7 +426,7 @@ export default function App() {
|
||||
};
|
||||
|
||||
const pages: Record<PageKey, JSX.Element> = {
|
||||
dashboard: <Dashboard onOpenVehicle={openVehicle} onOpenQuality={openQuality} onOpenRealtime={openRealtime} onOpenVehicles={openVehicles} onOpenHistory={openHistoryWithFilters} onOpenMileage={openMileageWithFilters} />,
|
||||
dashboard: <Dashboard onOpenVehicle={openVehicle} onOpenQuality={openQuality} onOpenMap={openMap} onOpenRealtime={openRealtime} onOpenVehicles={openVehicles} onOpenHistory={openHistoryWithFilters} onOpenMileage={openMileageWithFilters} />,
|
||||
vehicles: <Vehicles onOpenVehicle={openVehicle} onOpenQuality={openQuality} onFiltersChange={updateVehicleFilters} initialFilters={vehicleFilters} />,
|
||||
map: <Realtime title="地图态势" description="以车辆服务为中心查看实时位置、在线状态、来源一致性和高德地图接入状态" onOpenVehicle={openVehicle} onOpenHistory={openHistoryForVehicle} onOpenQuality={openQuality} onFiltersChange={updateMapFilters} initialFilters={realtimeFilters} />,
|
||||
realtime: <Realtime onOpenVehicle={openVehicle} onOpenHistory={openHistoryForVehicle} onOpenQuality={openQuality} onFiltersChange={updateRealtimeFilters} initialFilters={realtimeFilters} />,
|
||||
|
||||
@@ -173,6 +173,7 @@ function sourceConsistencyAction(row: VehicleCoverageRow, onFilter: (filters: Re
|
||||
export function Dashboard({
|
||||
onOpenVehicle,
|
||||
onOpenQuality,
|
||||
onOpenMap,
|
||||
onOpenRealtime,
|
||||
onOpenVehicles,
|
||||
onOpenHistory,
|
||||
@@ -180,6 +181,7 @@ export function Dashboard({
|
||||
}: {
|
||||
onOpenVehicle: (vin: string, protocol?: string) => void;
|
||||
onOpenQuality: (filters?: Record<string, string>) => void;
|
||||
onOpenMap: (filters?: Record<string, string>) => void;
|
||||
onOpenRealtime: (filters?: Record<string, string>) => void;
|
||||
onOpenVehicles: (filters?: Record<string, string>) => void;
|
||||
onOpenHistory: (filters?: Record<string, string>) => void;
|
||||
@@ -309,6 +311,14 @@ export function Dashboard({
|
||||
title: `${row.plate || row.vin || '-'} ${row.primaryProtocol || ''} ${row.lastSeen || ''}`
|
||||
}));
|
||||
const capabilities = [
|
||||
{
|
||||
title: '地图态势',
|
||||
status: `在线态势 ${formatCount(serviceSummary?.onlineVehicles ?? summary?.onlineVehicles)}`,
|
||||
color: 'green' as const,
|
||||
description: '以地图为主视角查看车辆在线分布、定位有效性、来源一致性和高德接入状态。',
|
||||
action: '打开地图',
|
||||
onClick: () => onOpenMap({ online: 'online' })
|
||||
},
|
||||
{
|
||||
title: '实时监控',
|
||||
status: `在线 ${formatCount(serviceSummary?.onlineVehicles ?? summary?.onlineVehicles)}`,
|
||||
@@ -563,7 +573,7 @@ export function Dashboard({
|
||||
<Typography.Text type="secondary">优先处理离线、无来源、身份未绑定和来源不完整车辆。</Typography.Text>
|
||||
</div>
|
||||
<Space vertical align="start">
|
||||
<Button theme="solid" type="primary" onClick={() => onOpenRealtime({ online: 'online' })}>查看实时态势</Button>
|
||||
<Button theme="solid" type="primary" onClick={() => onOpenMap({ online: 'online' })}>查看实时态势</Button>
|
||||
<Button
|
||||
disabled={!highPriorityIssue?.issueType}
|
||||
theme="light"
|
||||
|
||||
@@ -394,12 +394,14 @@ test('dashboard exposes vehicle data center capability matrix', async () => {
|
||||
};
|
||||
|
||||
await renderDashboard();
|
||||
expect(screen.getAllByText('地图态势').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getAllByText('实时监控').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getAllByText('轨迹回放').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getAllByText('历史数据查询').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getAllByText('告警事件触发与通知').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getAllByText('统计查询').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getAllByText('在线 208').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getAllByText('在线态势 208').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getAllByText('有效定位 0').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getAllByText('今日帧 1,286,320').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getAllByText('告警 7').length).toBeGreaterThanOrEqual(1);
|
||||
@@ -409,6 +411,11 @@ test('dashboard exposes vehicle data center capability matrix', async () => {
|
||||
expect(window.location.hash).toBe('#/realtime?online=online');
|
||||
cleanup();
|
||||
|
||||
await renderDashboard();
|
||||
fireEvent.click(screen.getByRole('button', { name: '能力入口 地图态势' }));
|
||||
expect(window.location.hash).toBe('#/map?online=online');
|
||||
cleanup();
|
||||
|
||||
await renderDashboard();
|
||||
fireEvent.click(screen.getByRole('button', { name: '能力入口 轨迹回放' }));
|
||||
expect(window.location.hash.startsWith('#/history')).toBe(true);
|
||||
@@ -592,7 +599,7 @@ test('dashboard exposes vehicle command center map actions', async () => {
|
||||
|
||||
expect(await screen.findByText('实时态势地图')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button', { name: '查看实时态势' }));
|
||||
expect(window.location.hash).toBe('#/realtime?online=online');
|
||||
expect(window.location.hash).toBe('#/map?online=online');
|
||||
});
|
||||
|
||||
test('dashboard shows vehicle service action queue', async () => {
|
||||
|
||||
Reference in New Issue
Block a user