feat(platform): show capability status summaries
This commit is contained in:
@@ -246,30 +246,40 @@ export function Dashboard({
|
|||||||
const capabilities = [
|
const capabilities = [
|
||||||
{
|
{
|
||||||
title: '实时监控',
|
title: '实时监控',
|
||||||
|
status: `在线 ${formatCount(serviceSummary?.onlineVehicles ?? summary?.onlineVehicles)}`,
|
||||||
|
color: 'green' as const,
|
||||||
description: '按车辆聚合最新位置、在线状态和多来源实时字段,支持地图态势查看。',
|
description: '按车辆聚合最新位置、在线状态和多来源实时字段,支持地图态势查看。',
|
||||||
action: '查看在线车辆',
|
action: '查看在线车辆',
|
||||||
onClick: () => onOpenRealtime({ online: 'online' })
|
onClick: () => onOpenRealtime({ online: 'online' })
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '轨迹回放',
|
title: '轨迹回放',
|
||||||
|
status: `有效定位 ${formatCount(commandLocatedCount)}`,
|
||||||
|
color: commandLocatedCount > 0 ? 'blue' as const : 'grey' as const,
|
||||||
description: '围绕车辆回放历史位置轨迹,结合高德线路和 RAW 证据定位异常。',
|
description: '围绕车辆回放历史位置轨迹,结合高德线路和 RAW 证据定位异常。',
|
||||||
action: '打开轨迹',
|
action: '打开轨迹',
|
||||||
onClick: () => onOpenHistory()
|
onClick: () => onOpenHistory()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '历史数据查询',
|
title: '历史数据查询',
|
||||||
|
status: `今日帧 ${formatCount(summary?.frameToday)}`,
|
||||||
|
color: 'blue' as const,
|
||||||
description: '查询位置历史、RAW 帧和解析字段,为车辆问题复盘提供证据链。',
|
description: '查询位置历史、RAW 帧和解析字段,为车辆问题复盘提供证据链。',
|
||||||
action: '查询历史',
|
action: '查询历史',
|
||||||
onClick: () => onOpenHistory({ tab: 'raw' })
|
onClick: () => onOpenHistory({ tab: 'raw' })
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '告警事件触发与通知',
|
title: '告警事件触发与通知',
|
||||||
|
status: `告警 ${formatCount(summary?.issueVehicles)}`,
|
||||||
|
color: (summary?.issueVehicles ?? 0) > 0 ? 'orange' as const : 'green' as const,
|
||||||
description: '围绕断链、无来源、VIN 缺失、字段缺失形成告警和通知闭环。',
|
description: '围绕断链、无来源、VIN 缺失、字段缺失形成告警和通知闭环。',
|
||||||
action: '查看告警',
|
action: '查看告警',
|
||||||
onClick: () => onOpenQuality()
|
onClick: () => onOpenQuality()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '统计查询',
|
title: '统计查询',
|
||||||
|
status: `统计车辆 ${formatCount(serviceSummary?.totalVehicles)}`,
|
||||||
|
color: 'green' as const,
|
||||||
description: '提供里程等运营统计查询,保证区间总值与每日统计口径闭合。',
|
description: '提供里程等运营统计查询,保证区间总值与每日统计口径闭合。',
|
||||||
action: '查看统计',
|
action: '查看统计',
|
||||||
onClick: () => onOpenMileage()
|
onClick: () => onOpenMileage()
|
||||||
@@ -311,6 +321,7 @@ export function Dashboard({
|
|||||||
<Typography.Title heading={6} style={{ margin: 0 }}>{item.title}</Typography.Title>
|
<Typography.Title heading={6} style={{ margin: 0 }}>{item.title}</Typography.Title>
|
||||||
<Typography.Text type="secondary">{item.description}</Typography.Text>
|
<Typography.Text type="secondary">{item.description}</Typography.Text>
|
||||||
</div>
|
</div>
|
||||||
|
<Tag className="vp-capability-status" color={item.color}>{item.status}</Tag>
|
||||||
<Button size="small" theme="light" type="primary" aria-label={`能力入口 ${item.title}`} onClick={item.onClick}>
|
<Button size="small" theme="light" type="primary" aria-label={`能力入口 ${item.title}`} onClick={item.onClick}>
|
||||||
{item.action}
|
{item.action}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -720,6 +720,10 @@ body {
|
|||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.vp-capability-status {
|
||||||
|
justify-self: start;
|
||||||
|
}
|
||||||
|
|
||||||
.vp-capability-item .semi-button {
|
.vp-capability-item .semi-button {
|
||||||
justify-self: start;
|
justify-self: start;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -387,6 +387,11 @@ test('dashboard exposes vehicle data center capability matrix', async () => {
|
|||||||
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('有效定位 0').length).toBeGreaterThanOrEqual(1);
|
||||||
|
expect(screen.getAllByText('今日帧 1,286,320').length).toBeGreaterThanOrEqual(1);
|
||||||
|
expect(screen.getAllByText('告警 7').length).toBeGreaterThanOrEqual(1);
|
||||||
|
expect(screen.getAllByText('统计车辆 1,033').length).toBeGreaterThanOrEqual(1);
|
||||||
|
|
||||||
fireEvent.click(screen.getByRole('button', { name: '能力入口 实时监控' }));
|
fireEvent.click(screen.getByRole('button', { name: '能力入口 实时监控' }));
|
||||||
expect(window.location.hash).toBe('#/realtime?online=online');
|
expect(window.location.hash).toBe('#/realtime?online=online');
|
||||||
@@ -540,7 +545,7 @@ test('dashboard exposes vehicle command center map actions', async () => {
|
|||||||
|
|
||||||
expect(await screen.findByText('车辆态势指挥台')).toBeInTheDocument();
|
expect(await screen.findByText('车辆态势指挥台')).toBeInTheDocument();
|
||||||
expect(screen.getByText('在线 1 / 2')).toBeInTheDocument();
|
expect(screen.getByText('在线 1 / 2')).toBeInTheDocument();
|
||||||
expect(screen.getByText('有效定位 1')).toBeInTheDocument();
|
expect(screen.getAllByText('有效定位 1').length).toBeGreaterThanOrEqual(1);
|
||||||
expect(screen.getByText('降级/离线 2')).toBeInTheDocument();
|
expect(screen.getByText('降级/离线 2')).toBeInTheDocument();
|
||||||
fireEvent.click(screen.getByRole('button', { name: '处理高优先级告警' }));
|
fireEvent.click(screen.getByRole('button', { name: '处理高优先级告警' }));
|
||||||
expect(window.location.hash).toBe('#/quality?issueType=NO_SOURCE');
|
expect(window.location.hash).toBe('#/quality?issueType=NO_SOURCE');
|
||||||
|
|||||||
Reference in New Issue
Block a user