probe-note-fields.mjs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // 只读探针:逐面板列出视图对象里所有「说明类」字段,确认哪些进了摘要、哪些被渲染层丢掉。
  2. import {
  3. monitoringOverviewPanel,
  4. monitoringDistributionPanel,
  5. operationOverviewPanel,
  6. monitoringPointLedgerPanel,
  7. } from '../../../../../src/modules/cockpit/domain/monitoringPanels.js'
  8. import {
  9. situationSummaryPanel,
  10. infrastructureSummaryPanel,
  11. monitoringSummaryPanel,
  12. alertSettingsPanel,
  13. } from '../../../../../src/modules/cockpit/domain/overviewPanels.js'
  14. import {
  15. archivePanel,
  16. emergencyPanel,
  17. managementPanel,
  18. operationPanel,
  19. } from '../../../../../src/modules/cockpit/domain/infrastructurePanels.js'
  20. const NOTE_FIELDS = ['industryNote', 'typeNote', 'eventNote', 'rangeNote', 'gap', 'offlineNote', 'pageNote', 'locateNote', 'note', 'linkNote', 'excludedNote', 'stateText']
  21. const cases = [
  22. ['monitoringOverview', () => monitoringOverviewPanel({}, null)],
  23. ['monitoringDistribution', () => monitoringDistributionPanel({}, null)],
  24. ['operationOverview', () => operationOverviewPanel({}, null)],
  25. ['monitoringPointLedger', () => monitoringPointLedgerPanel({}, null)],
  26. ['situationSummary', () => situationSummaryPanel({}, null)],
  27. ['infrastructureSummary', () => infrastructureSummaryPanel({}, null)],
  28. ['monitoringSummary', () => monitoringSummaryPanel({}, null)],
  29. ['alertSettings', () => alertSettingsPanel({}, null)],
  30. ['archive', () => archivePanel({}, null)],
  31. ['emergency', () => emergencyPanel({}, null)],
  32. ['management', () => managementPanel({}, null)],
  33. ['operation(infra)', () => operationPanel({}, null)],
  34. ]
  35. for (const [id, build] of cases) {
  36. let view
  37. try { view = build() } catch (e) { console.log(`${id.padEnd(24)} BUILD-ERROR ${e.message}`); continue }
  38. const present = NOTE_FIELDS.filter((f) => typeof view?.[f] === 'string' && view[f])
  39. console.log(`${id.padEnd(24)} ${present.length ? present.join(', ') : '(none)'} [label=${view?.label ?? ''}]`)
  40. for (const f of present) console.log(` ${f} → ${String(view[f]).slice(0, 70)}…`.replace('…', view[f].length > 70 ? '…' : ''))
  41. }