fix: 获取网元状态定时轮询修复

This commit is contained in:
TsMask
2024-11-21 18:19:07 +08:00
parent 78f963fbea
commit fb855fd74e
3 changed files with 29 additions and 15 deletions

View File

@@ -166,7 +166,7 @@ const graphNodeTooltip = new Tooltip({
</span></div>
<div><strong>${t('views.monitor.topology.expiryDate')}</strong><span>
${neState.expire ?? '--'}
</span></div>
</span></div>
</div>
`;
},
@@ -294,7 +294,8 @@ function fnGraphDataLoad(reload: boolean = false) {
Reflect.set(node, 'neState', { online: false });
// 图片路径处理
if (node.img) node.img = parseBasePath(node.img);
if (node.icon.show && node.icon?.img) node.icon.img = parseBasePath(node.icon.img);
if (node.icon.show && node.icon?.img)
node.icon.img = parseBasePath(node.icon.img);
// 遍历是否有网元数据
const nodeID: string = node.id;
const hasNe = res.neList.some(ne => {
@@ -352,11 +353,11 @@ function fnGraphDataLoad(reload: boolean = false) {
}
clearInterval(interval10s.value);
interval10s.value = null;
fnGetState().finally(() => {
interval10s.value = setInterval(() => {
fnGetState(); // 获取网元状态
}, 10_000);
});
fnGetState();
interval10s.value = setInterval(async () => {
if (!interval10s.value) return;
fnGetState(); // 获取网元状态
}, 20_000);
});
}
@@ -364,7 +365,7 @@ function fnGraphDataLoad(reload: boolean = false) {
const interval10s = ref<any>(null);
/**查询网元状态 */
async function fnGetState() {
function fnGetState() {
// 获取节点状态
for (const node of graphState.data.nodes) {
if (notNeNodes.includes(node.id)) continue;