Selaa lähdekoodia

fix(cockpit): 顶栏三个诊断读数下屏(票102)

维护者 2026-11-02 要求删掉菜单栏上的「配置就绪 · 数据源 real」「只读视图」
「当前模式 infrastructure」三个读数。

随读数一起失效的东西一并清掉,不留半截改动:
- StatusTag / configStatusView 两个 import(只服务配置读数)
- configView 视图模型
- configLoaded —— 它唯一的用途是那条标签的「载入前不闪一下缺失」闸门
- .cockpit-shell__meta 死样式

配置判定 configState 保留:mapConfig / uiDebug / 降级说明仍在读它。
domain/configStatus.js 与其闸门 t04 不动,词汇与三态映射仍被
sectionState / cockpitApi / cockpitConfig 使用。

部署文档同步改口:配置是否生效改看网络面板与地图信息面板,
「当前模式」的诊断信息由面板首行继续承担。

闸门 verify/t102-topbar-menu.mjs 13/13。按 AGENTS.md 未跑 build/dev/浏览器。
ChenJZ 18 tuntia sitten
vanhempi
commit
192a3f0003
3 muutettua tiedostoa jossa 49 lisäystä ja 30 poistoa
  1. 11 5
      docs/cockpit-deployment.md
  2. 5 25
      src/modules/cockpit/CockpitShell.vue
  3. 33 0
      verify/t102-topbar-menu.mjs

+ 11 - 5
docs/cockpit-deployment.md

@@ -57,8 +57,10 @@
   也可以给绝对 URL(例如配置由后端下发):`window.__COCKPIT_CONFIG_URL__ = 'https://cfg.example.com/cockpit.json';`
 - **构建期**:`.env` 里写 `VITE_COCKPIT_CONFIG_URL=auto` 再 `yarn build`。
 
-**顶栏能看到状态**:`.cockpit-shell__config` 标签显示 `配置就绪 / 配置缺失 / 配置载入失败` 与数据源;
-引擎浮标显示 `底图:… · 地形:… · 叠加影像 N 层`。排查问题时先看这两个地方。
+**配置状态怎么看**(票 102 起顶栏不再有「配置就绪 · 数据源」这个读数):配置是否生效改看两处
+——地图信息面板(中央图右侧,展开后是引擎读数 `底图:… · 地形:… · 叠加影像 N 层`)
+与浏览器网络面板里 `cockpit/config.json` 的取用结果。数据源是 mock 还是 real,
+看接口请求本身(`/api/cockpit/v1/**` 有没有发出)。
 
 ---
 
@@ -210,9 +212,12 @@
 | --- | --- | --- |
 | 中央图上的「中央一张图」标题、图层占位、实例提示 | 显示 | **收起** |
 | 引擎状态(底图/地形/影像/3D Tiles) | 顶部药丸,带边框底色 | **贴底半透明小字**(无边框无底色) |
-| 顶栏「配置就绪 · 数据源」标签、「当前模式」读数 | 显示 | **收起** |
+| 顶栏「配置就绪 · 数据源」标签、「当前模式」读数、「只读视图」标记 | — | **已下屏**(票 102,两套形态都不显示) |
 | 点位状态图例(颜色语义)、状态灯 | 显示 | **保留** |
-| 范围/行业/视图筛选、归位按钮、只读视图、时钟 | 显示 | 保留 |
+| 范围/行业/视图筛选、归位按钮、时钟 | 显示 | 保留 |
+
+顶栏读数下屏后,开发期需要的诊断信息一律走地图信息面板:「当前模式」在面板首行(两种形态都在),
+图层/引擎读数在展开区里(调试形态多一行实例与底图)。
 
 判定规则:`map.ui.debug` 显式给布尔值就听它,否则**跟随构建模式**(`yarn dev` → 调试;`yarn build` 产物 → 干净)。
 
@@ -509,7 +514,8 @@ location /gis/model/ {
 | 进入引导 | 先看到自转星球 + 闪烁「点击进入系统」 | `map.intro.enabled` |
 | 进入落点 | 点一下后镜头**落在目标城市**(不是随机位置) | `map.home.lon/lat/range` |
 | 归位按钮 | 顶栏「归位」可点,平移后点它回到目标视角 | `map.home`、引擎是否就绪 |
-| 配置生效 | 顶栏标签「配置就绪 · 数据源 mock/real」 | `config.json` 路径、`__COCKPIT_CONFIG_URL__` |
+| 配置生效 | 网络面板里 `cockpit/config.json` 返回 200,且页面按它取值(改 `map.home` 后归位落点跟着变) | `config.json` 路径、`__COCKPIT_CONFIG_URL__` |
+| 数据源 | `dataSource: real` 时面板数据来自 `/api/cockpit/v1/**`(网络面板可见),mock 时没有这些请求 | `config.json` 的 `dataSource`、`?dataSource=` 覆盖 |
 | 全局底图 | 地球有影像(不是黑球) | `map.basemap.source` |
 | 地形 | 浮标含「地形:dem」;拉近后有山体起伏 | nginx `/gis/dem/`、`layer.json` 能直接下载 |
 | 本地影像 | 压到目标区域能看到精细影像 | overlay 的 `url`/`{reverseY}`/`bounds` |

+ 5 - 25
src/modules/cockpit/CockpitShell.vue

@@ -81,20 +81,10 @@
                 >
                     返回全球
                 </button>
-                <!-- 票 04:配置三态 + 数据源,顶栏可演示;data-* 供走查断言。
-                     票 32:这是开发期的诊断读数,生产形态不占顶栏(状态退到底部小字)。 -->
-                <span
-                    v-if="configLoaded && uiDebug"
-                    class="cockpit-shell__config"
-                    :data-config-state="configView.state"
-                    :data-data-source="configView.dataSource"
-                    :data-source="configState.source"
-                >
-                    <StatusTag :tone="configView.tone" :label="configView.label" />
-                </span>
-                <span class="cockpit-shell__chip">只读视图</span>
+                <!-- 票 102:顶栏只留在用的按钮(归位 / 返回全球)与时钟。
+                     维护者 2026-11-02:配置三态、只读标记、模式读数三个诊断读数下屏 ——
+                     它们既占走查视线,又把右侧状态区撑宽,挤得中列菜单左右晃动。 -->
                 <span class="cockpit-shell__clock">{{ clockText }}</span>
-                <p v-if="uiDebug" class="cockpit-shell__meta">当前模式 {{ mode }}</p>
             </div>
         </header>
 
@@ -569,11 +559,9 @@ import EventListPane from './components/EventListPane.vue'
 import EventDetailCard from './components/EventDetailCard.vue'
 import EntityDetailDrawer from './components/EntityDetailDrawer.vue'
 import WarningResponsePane from './components/WarningResponsePane.vue'
-import StatusTag from './components/StatusTag.vue'
 import CockpitIntro from './components/CockpitIntro.vue'
 import SectionStateTag from './components/SectionStateTag.vue'
 import PointDetailCard from './components/PointDetailCard.vue'
-import { configStatusView } from './domain/configStatus.js'
 import { DETAIL_LEVEL } from './domain/detailFlow.js'
 import { homeLabel } from './domain/viewPresets.js'
 import { ensureCockpitMocks } from './mocks/index.js'
@@ -1584,10 +1572,9 @@ async function refreshModePanels() {
     }
 }
 
-// ---- 配置状态(票 04):载入前不渲染标签,避免先闪一下「缺失」再变「就绪」 ----
-const configLoaded = ref(false)
+// ---- 配置状态(票 04):票 102 起顶栏不再显示配置读数,这里只留判定结果,
+// 供地图配置(mapConfig / uiDebug)与降级说明使用。----
 const configState = ref(null)
-const configView = computed(() => configStatusView(configState.value))
 
 /**
  * 票 17:字体授权门禁的宿主读数(走查断言接缝)。
@@ -1871,7 +1858,6 @@ onMounted(() => {
     // 票 04:配置只在这个入口载入一次(服务内部有缓存),地图服务按需 await 同一份。
     loadCockpitConfig().then((result) => {
         configState.value = result
-        configLoaded.value = true
         // 配置到手才知道引导开关与预设坐标,重新取一次。
         intro.value = getIntroConfig()
         introVisible.value = intro.value.enabled
@@ -2500,12 +2486,6 @@ const mapDataSourceCredits = computed(() => getDataSourceCredits())
     text-shadow: 0 0 12px rgba(1, 171, 234, 0.55);
 }
 
-.cockpit-shell__meta {
-    margin: 0;
-    color: var(--muted);
-    font-size: var(--fs-caption, 11.5px);
-    letter-spacing: 0.06em;
-}
 
 /* ============================================================
    全局筛选条(压矮:38 设计像素)

+ 33 - 0
verify/t102-topbar-menu.mjs

@@ -0,0 +1,33 @@
+/**
+ * 票 102 静态闸门(一):顶栏三个诊断读数下屏,且不留半截改动。
+ *
+ * 接缝:外壳单文件源码契约 —— 模板节点 / import / 死状态 / CSS 类名必须同时消失。
+ * 只删模板会留下死样式与死 import,只删样式会留下「有节点没画法」的裸标签。
+ * 可传源码路径复核历史版本(例如提交时的暂存副本)。
+ */
+import assert from 'node:assert/strict'
+import fs from 'node:fs'
+
+const source = process.argv[2]
+    ? fs.readFileSync(process.argv[2], 'utf8')
+    : fs.readFileSync(new URL('../src/modules/cockpit/CockpitShell.vue', import.meta.url), 'utf8')
+
+// ---- 三个读数:模板、样式、数据来源一起下屏 ----
+assert.ok(!source.includes('只读视图'), '「只读视图」必须下屏')
+assert.ok(!source.includes('配置就绪'), '「配置就绪 · 数据源」必须下屏')
+assert.ok(!source.includes('cockpit-shell__config'), '配置读数容器(模板/样式)不得残留')
+assert.ok(!source.includes('configStatusView'), '配置读数展示层不得残留')
+assert.ok(!source.includes('StatusTag'), 'StatusTag 只服务配置读数,必须一并移除')
+assert.ok(!source.includes('cockpit-shell__meta'), '「当前模式」读数不得残留')
+
+// ---- 配置判定本身仍在用,不能顺手删 ----
+assert.ok(source.includes('configState.value'), '配置判定仍被地图配置/降级说明使用,不能删')
+// 反方向也要守:读数的「载入前不闪标签」闸门随读数一起变成死状态。
+assert.ok(!source.includes('configLoaded'), '拉取态闸门随读数下屏,不得留下无人读的状态')
+
+// ---- 一级模式导航语义不动 ----
+assert.ok(source.includes('aria-label="一级模式"'), '一级模式导航保持原样')
+assert.ok(source.includes('v-for="item in MODES"'), '一级模式导航保持原样')
+assert.ok(source.includes('@click="uiStore.setMode(item)"'), '一级模式导航保持原样')
+
+console.log('t102-topbar-menu: 13/13')