-
-
-
-
+
+
@@ -155,10 +155,16 @@
watch:{
nodeData:{
handler(n){
- for(let key in this.form){
- this.form[key]=n[key]
- }
this.form.moduleId=n.id;
+ if( n.expressions){
+ n.expressions.forEach((item,index)=>{
+ this.addExpression();
+ this.name[index]=item.name;
+ this.unit[index]=item.unit;
+ this.expressions[index]=item.metric;
+ this.legends[index]=item.legend;
+ })
+ }
},
immediate: true,
deep: true,
@@ -212,7 +218,12 @@
},
mounted(){
// this.addExpression();
- this.addNodeInit()
+ this.addNodeInit();
+ if( this.nodeData.expressions){
+ this.nodeData.expressions.forEach((item,index)=>{
+ this.$refs['promql-'+(index)][0].metricChange(this.expressions[index]);
+ })
+ }
},
methods:{
addNodeInit(selImageId){
@@ -228,8 +239,8 @@
setTimeout(()=>{
this.iconArray=[...this.iconArray];
this.imgageLoading=false;
- if(selImageId){
- this.form.iconId=selImageId;
+ if(selImageId || this.nodeData.iconId){
+ this.form.iconId=selImageId || this.nodeData.iconId;
}
},100)
}
diff --git a/nezha-fronted/src/components/common/project/topology.vue b/nezha-fronted/src/components/common/project/topology.vue
index 0cd2812a9..c1698c2f9 100644
--- a/nezha-fronted/src/components/common/project/topology.vue
+++ b/nezha-fronted/src/components/common/project/topology.vue
@@ -4,12 +4,12 @@
Module element :
Add
- Remove
+
Line :
Add
- Remove
+
save
@@ -284,6 +284,7 @@
type: 'error'
});
});
+ // this.$put('/project/topo',{topo:'{}',projectId:this.allModuleInfo.basic.id});
this.$emit('editVisNetworkChange',false);
},
cancelTopology(){
@@ -353,7 +354,7 @@
edges: {
width: 2,
smooth:{ //设置两个节点之前的连线的状态
- enabled: true,//默认是true,设置为false之后,两个节点之前的连线始终为直线,不会出现贝塞尔曲线
+ enabled: false,//默认是true,设置为false之后,两个节点之前的连线始终为直线,不会出现贝塞尔曲线
roundness:0.5,
type: "curvedCW",
},
@@ -456,6 +457,7 @@
x:'',
y:'',
image:'',
+ id:'',
}
},
addLine(edges){ // 添加或者編輯line
@@ -658,7 +660,7 @@
this_.network.selectNodes(this_.NodeArr,true);
return
}
- if(this_.NodeArr.length===0){
+ if(this_.NodeArr.length===0&&this_.editVisNetwork){
this_.nodeEdit();
}
this_.setPopPosition(selId,params);
@@ -677,7 +679,6 @@
}
if(this_.editVisNetwork){
this_.lineData.color=this_.lineData.color.color?this_.lineData.color.color:this_.lineData.color;
- console.log(this_.lineData);
this_.addLineShow=true;
this_.isLineAdd=false;
}
@@ -895,7 +896,7 @@
margin-left: 30px;
}
.edit-topologyLine{
- margin-left: 130px;
+ margin-left: 60px;
}
.edit-topology-add,.edit-topology-remove,.edit-topologyCancel{
color: #1989fa;
diff --git a/nezha-fronted/src/components/common/project/visNetwork.vue b/nezha-fronted/src/components/common/project/visNetwork.vue
index ecb2c04a8..72968d291 100644
--- a/nezha-fronted/src/components/common/project/visNetwork.vue
+++ b/nezha-fronted/src/components/common/project/visNetwork.vue
@@ -198,7 +198,7 @@
this.topologyLoading=true;
this.editVisNetwork=false;
this.$get('/project/topo',{projectId:n.id}).then(res=>{
- if(res.data.topo&&res.data.topo.nodes.length>0){
+ if(res.data.topo&&res.data.topo.nodes&&res.data.topo.nodes.length>0){
this.nodesArray=[];
this.edgesArray=[];
this.nodesArrayOther=this.formatNodesArr(res.data.topo.nodes);
@@ -221,7 +221,7 @@
this.topologyLoading=true;
this.editVisNetwork=false;
this.$get('/project/topo',{projectId:this.projectInfo.id}).then(res=>{
- if(res.data.topo&&res.data.topo.nodes.length>0){
+ if(res.data.topo&&res.data.topo.nodes&&res.data.topo.nodes.length>0){
this.nodesArray=[];
this.edgesArray=[];
this.nodesArrayOther=this.formatNodesArr(res.data.topo.nodes);