fix: portable 版 3D 拓扑设备位置 fallback 到主进程 JSON
Some checks failed
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
Some checks failed
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
renderer 原来只读 localStorage 的 monitoring-topology-positions, portable 版 userData 是全新空目录,Local Storage 里没有这个 key, 导致设备布局 fallback 到大圆圈自动布局。 加主进程 inspection-data.json 的同步 fallback: - preload/api.cjs 新增 getTopologyPositionsSync(ipcRenderer.sendSync) - index.cjs 新增 ipcMain.on 同步 handler(与 handle 并存) - MonitoringTopologyView.tsx localStorage 找不到时 fallback 读主进程 JSON
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* 运行监控 - 3D 拓扑大屏
|
||||
*
|
||||
* 移植自 ITYUNWEI TopologyView.vue
|
||||
@@ -2306,10 +2306,20 @@ export function MonitoringTopologyView({ hosts, keys }: Props) {
|
||||
}
|
||||
} catch { /* ignore */ }
|
||||
}
|
||||
// 本地 Electron:从 localStorage 读
|
||||
// 本地 Electron:从 localStorage 读,找不到则从主进程 inspection-data.json 读
|
||||
try {
|
||||
const saved = localStorage.getItem('monitoring-topology-positions');
|
||||
return saved ? JSON.parse(saved) : null;
|
||||
let saved = localStorage.getItem('monitoring-topology-positions');
|
||||
if (saved) return JSON.parse(saved);
|
||||
// portable 版 localStorage 为空 → fallback 主进程 JSON(sendSync 同步)
|
||||
try {
|
||||
const nc = (window as any).netcatty;
|
||||
const fromMain = nc?.inspection?.getTopologyPositionsSync?.();
|
||||
if (fromMain && typeof fromMain === 'object' && Object.keys(fromMain).length > 0) {
|
||||
console.info('[Monitoring] localStorage 无位置,从主进程 inspection-data.json 加载');
|
||||
return fromMain;
|
||||
}
|
||||
} catch { /* ignore */ }
|
||||
return null;
|
||||
} catch { return null; }
|
||||
})();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user