diff --git a/vehicle-data-platform/apps/web/src/layout/AppShell.tsx b/vehicle-data-platform/apps/web/src/layout/AppShell.tsx
index 0ad9f1dc..24bbce3d 100644
--- a/vehicle-data-platform/apps/web/src/layout/AppShell.tsx
+++ b/vehicle-data-platform/apps/web/src/layout/AppShell.tsx
@@ -12,6 +12,7 @@ import {
import type { ReactNode } from 'react';
import { useState } from 'react';
import type { VehicleSourceConsistency, VehicleServiceStatus } from '../api/types';
+import { isAMapConfigured } from '../config/appConfig';
export type PageKey = 'dashboard' | 'vehicles' | 'realtime' | 'detail' | 'history' | 'mileage' | 'quality';
@@ -53,6 +54,7 @@ export function AppShell({
}) {
const [keyword, setKeyword] = useState('');
const [searching, setSearching] = useState(false);
+ const amapConfigured = isAMapConfigured();
const search = () => {
const value = keyword.trim();
@@ -106,6 +108,9 @@ export function AppShell({
) : null}
生产环境
多源接入 / 一个车辆服务
+ {amapConfigured ? '地图就绪' : '地图待配置'}
+
+
diff --git a/vehicle-data-platform/apps/web/src/test/App.test.tsx b/vehicle-data-platform/apps/web/src/test/App.test.tsx
index b4b51282..b4bad4c1 100644
--- a/vehicle-data-platform/apps/web/src/test/App.test.tsx
+++ b/vehicle-data-platform/apps/web/src/test/App.test.tsx
@@ -5,6 +5,7 @@ import App from '../App';
afterEach(() => {
cleanup();
window.history.replaceState(null, '', '/');
+ delete window.__LINGNIU_APP_CONFIG__;
vi.restoreAllMocks();
});
@@ -14,6 +15,39 @@ test('renders vehicle platform shell', () => {
expect(screen.getAllByText('总览工作台').length).toBeGreaterThanOrEqual(1);
});
+test('exposes AMap operations shortcuts when map key is configured', async () => {
+ window.__LINGNIU_APP_CONFIG__ = { amapWebJsKey: 'amap-web-key' };
+ 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, redisOnlineKeys: 0, tdengineWritable: true, mysqlWritable: true, runtime: { requestTimeoutMs: 5000 } },
+ traceId: 'trace-test',
+ timestamp: 1783094400000
+ })
+ } as Response;
+ }
+ return {
+ ok: true,
+ json: async () => ({
+ data: { items: [], total: 0, limit: 50, offset: 0 },
+ traceId: 'trace-test',
+ timestamp: 1783094400000
+ })
+ } as Response;
+ });
+
+ render();
+
+ expect(await screen.findByText('地图就绪')).toBeInTheDocument();
+ fireEvent.click(screen.getByRole('button', { name: '实时地图' }));
+ expect(window.location.hash).toBe('#/realtime');
+ fireEvent.click(screen.getByRole('button', { name: '地图回放' }));
+ expect(window.location.hash.startsWith('#/history')).toBe(true);
+});
+
test('shows vehicle service status distribution on dashboard', async () => {
window.history.replaceState(null, '', '/#/dashboard');
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {