feat(platform): collapse advanced dashboard workbench

This commit is contained in:
lingniu
2026-07-06 04:19:48 +08:00
parent ad644d43b1
commit 6246887b86
2 changed files with 91 additions and 0 deletions

View File

@@ -2763,6 +2763,12 @@ export function Dashboard({
</div>
</section>
) : null}
<details className="vp-dashboard-secondary-details vp-dashboard-customer-advanced">
<summary>
<span></span>
<small></small>
</summary>
<div className="vp-dashboard-secondary-body">
<section className="vp-vehicle-command-center" aria-label="车辆服务指挥台">
<div className="vp-vehicle-command-map">
<VehicleMap
@@ -2932,6 +2938,8 @@ export function Dashboard({
))}
</div>
</section>
</div>
</details>
<section className="vp-vehicle-service-cockpit" aria-label="车辆服务驾驶舱">
<div className="vp-vehicle-service-cockpit-copy">
<Space wrap>

View File

@@ -155,6 +155,89 @@ test('dashboard opens with a customer vehicle service path instead of protocol e
expect(screen.getByRole('button', { name: '客户车辆服务路径 数据导出 数据能否交付 导出证据' })).toBeInTheDocument();
});
test('dashboard keeps advanced customer workbench collapsed behind the service path', async () => {
window.history.replaceState(null, '', '/#/dashboard');
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
const path = String(input);
if (path.includes('/api/ops/health')) {
return {
ok: true,
json: async () => ({
data: {
linkHealth: [],
kafkaLag: 0,
activeConnections: 15,
redisOnlineKeys: 92,
tdengineWritable: true,
mysqlWritable: true,
runtime: { requestTimeoutMs: 5000, amapWebJsConfigured: true, amapSecurityProxyEnabled: true, amapSecurityCodeExposed: false }
},
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
}
if (path.includes('/api/dashboard/summary')) {
return {
ok: true,
json: async () => ({
data: {
onlineVehicles: 92,
activeToday: 120,
frameToday: 21000,
issueVehicles: 7,
kafkaLag: 0,
protocols: [],
serviceStatuses: [],
linkHealth: []
},
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
}
if (path.includes('/api/vehicle-service/summary')) {
return {
ok: true,
json: async () => ({
data: {
totalVehicles: 1033,
boundVehicles: 988,
onlineVehicles: 92,
singleSourceVehicles: 170,
multiSourceVehicles: 220,
noDataVehicles: 15,
identityRequiredVehicles: 9,
serviceStatuses: [],
protocols: [],
missingSources: []
},
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
}
return {
ok: true,
json: async () => ({
data: { items: [], total: 0, limit: 8, offset: 0 },
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
});
render(<App />);
expect(await screen.findByRole('heading', { name: '客户车辆服务路径' })).toBeInTheDocument();
const summary = screen.getByText('客户进阶工作台');
const details = summary.closest('details');
expect(details).toBeInTheDocument();
expect(details).not.toHaveAttribute('open');
expect(within(details as HTMLElement).getByText('车辆服务指挥台')).toBeInTheDocument();
expect(within(details as HTMLElement).getByText('车辆地图态势')).toBeInTheDocument();
});
test('topbar frames customer work as a vehicle service delivery strip', () => {
vi.spyOn(globalThis, 'fetch').mockImplementation(async () => ({
ok: true,