fix: 获取网元状态定时轮询修复
This commit is contained in:
@@ -162,6 +162,7 @@ function loadData() {
|
||||
|
||||
clearInterval(interval10s.value);
|
||||
interval10s.value = setInterval(() => {
|
||||
if (!interval10s.value) return
|
||||
if (upfTFActive.value === '0') {
|
||||
upfTFSend('7');
|
||||
upfTFActive.value = '7';
|
||||
@@ -176,6 +177,7 @@ function loadData() {
|
||||
|
||||
clearInterval(interval5s.value);
|
||||
interval5s.value = setInterval(() => {
|
||||
if (!interval5s.value) return
|
||||
fnGetSkim(); // 获取概览信息
|
||||
fnGetNeState(); // 获取网元状态
|
||||
}, 5_000);
|
||||
|
||||
@@ -30,11 +30,12 @@ function fnRanderData() {
|
||||
}
|
||||
|
||||
/**网元状态调度器 */
|
||||
const interval10s = ref<any>(null);
|
||||
const interval = ref<boolean>(true);
|
||||
|
||||
/**查询网元状态 */
|
||||
async function fnGetState() {
|
||||
for (const node of graphG6Data.nodes) {
|
||||
if (!interval.value) return;
|
||||
const ne = node.info;
|
||||
// if (ne.neType === 'OMC') continue;
|
||||
const result = await stateNeInfo(ne.neType, ne.neId);
|
||||
@@ -151,11 +152,21 @@ function fnGetList(refresh: boolean = false) {
|
||||
})
|
||||
.then(randerGroph => {
|
||||
if (!randerGroph) return;
|
||||
fnGetState().finally(() => {
|
||||
interval10s.value = setInterval(() => {
|
||||
fnGetState(); // 获取网元状态
|
||||
}, 10_000);
|
||||
});
|
||||
repeatFn();
|
||||
});
|
||||
}
|
||||
|
||||
/**递归刷新网元状态 */
|
||||
function repeatFn() {
|
||||
if (!interval.value) {
|
||||
return;
|
||||
}
|
||||
fnGetState()
|
||||
.finally(() => {
|
||||
repeatFn(); // 递归调用自己
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -165,7 +176,7 @@ onMounted(() => {
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
clearInterval(interval10s.value);
|
||||
interval.value = false;
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user