diff --git a/src/views/monitor/topology/graph.ts b/src/views/monitor/topology/graph.ts
index 99f295b2..4486d4cf 100644
--- a/src/views/monitor/topology/graph.ts
+++ b/src/views/monitor/topology/graph.ts
@@ -1700,9 +1700,8 @@ export function randerGroph(graphG6Dom: HTMLElement | undefined, data: any) {
edges: processedEdges,
});
layout.instance.execute();
- // console.log(processedEdges)
+
bindListener(graph);
- // graph.data({ nodes: aggregatedData.nodes, edges: processedEdges });
graph.data({ nodes: aggregatedData.nodes, edges: processedEdges });
graph.render();
@@ -1740,3 +1739,17 @@ export function randerGroph(graphG6Dom: HTMLElement | undefined, data: any) {
return graph;
}
+
+let gridLayout = false;
+export function switchLayout() {
+ gridLayout = !gridLayout;
+ if (gridLayout) {
+ stopLayout();
+ graph.updateLayout({
+ type: 'grid',
+ begin: [20, 20],
+ });
+ } else {
+ layout.instance.execute();
+ }
+}
diff --git a/src/views/monitor/topology/index.vue b/src/views/monitor/topology/index.vue
index 02a6ac55..3c855c77 100644
--- a/src/views/monitor/topology/index.vue
+++ b/src/views/monitor/topology/index.vue
@@ -6,7 +6,7 @@ import useI18n from '@/hooks/useI18n';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { listNe, stateNe } from '@/api/ne/ne';
import message from 'ant-design-vue/lib/message';
-import { randerGroph } from './graph';
+import { randerGroph, switchLayout } from './graph';
import { parseDateToStr } from '@/utils/date-utils';
const { t } = useI18n();
@@ -40,11 +40,16 @@ async function fnGetState() {
ne.serverState.refreshTime,
'HH:mm:ss'
);
- const node = graphG6.value.findById(ne.neName);
- console.log('查询网元状态', node);
- graphG6.value.setItemState(node, 'neState', true);
}
+ // 修改网元状态颜色
+ const neShape = graphG6.value.findById(ne.neName);
+ graphG6.value.setItemState(
+ neShape,
+ 'neState',
+ result.code === RESULT_CODE_SUCCESS
+ );
}
+ setTimeout(() => fnGetState(), 30_000);
}
/**查询全部网元数据列表 */
@@ -75,7 +80,7 @@ function fnGetList(refresh: boolean = false) {
expire: '2024-03-31',
refreshTime: '10:31:47',
sn: '13770707',
- version: '2.2312.9',
+ version: '2.2312.8',
};
nodes.push({
id: item.neName,
@@ -151,10 +156,6 @@ function fnGetList(refresh: boolean = false) {
});
}
-function fnAdd() {
- fnGetList(true);
-}
-
onMounted(() => {
// 获取网元列表
fnGetList();
@@ -171,7 +172,7 @@ onMounted(() => {
-
-
- {{ t('common.reloadText') }}
-
-
-
-
+
+
+
+ Switch Layout
+
@@ -243,7 +242,7 @@ onMounted(() => {
刷新时间:18:37:22
ID:neID
名称:neName
- 版本:2.2312.9
+ 版本:2.2312.8
SN:13770707
有效期:2024-03-31