diff --git a/nezha-fronted/src/components/common/header.vue b/nezha-fronted/src/components/common/header.vue index 43a7d3a7b..b739be00e 100644 --- a/nezha-fronted/src/components/common/header.vue +++ b/nezha-fronted/src/components/common/header.vue @@ -325,7 +325,7 @@ this.rightBox.module.show = true; this.editModule = { name: '', - project: this.$store.state.currentProject, + project: {}, port: 9100, path: '', param: '', diff --git a/nezha-fronted/src/components/common/leftMenu.vue b/nezha-fronted/src/components/common/leftMenu.vue index e49c4f23c..32bb2ff5a 100644 --- a/nezha-fronted/src/components/common/leftMenu.vue +++ b/nezha-fronted/src/components/common/leftMenu.vue @@ -166,7 +166,7 @@ currentProjectTitle: '', currentProject: {id: '', name: '', remark: ''}, //endpoint弹框、module列表用来回显project module: {}, //编辑的module - blankModule: {id: '', type: '', name: '', project: {}, port: '', path: '', param: '', paramObj: [], snmpParam: ''}, //空白module + blankModule: {name: '', project: {}, port: 9100, path: '', param: '', type: 'http', paramObj: [], snmpParam: '', walk: [], version: 2, max_repetitions: 25, retries: 3, timeout: 10, community: 'public', username: '', security_level: 'noAuthNoPriv', password: '', auth_protocol: 'MD5', priv_protocol: 'DES', priv_password: '', context_name: ''}, //空白module currentModule: {id: '', type: '', name: '', project: {}, port: '', path: '', param: '', paramObj: [], snmpParam: ''}, //用来回显的module ready: false, rightBox: {module: {show: false}}, @@ -241,6 +241,7 @@ immediate: true, deep: true, handler(n, o) { + console.log(n) bus.$emit("current-project-change", n); //告知project.vue }, }, @@ -340,7 +341,9 @@ }); }, newModule() { - return JSON.parse(JSON.stringify(this.blankModule)); + let module=JSON.parse(JSON.stringify(this.blankModule)); + module.project = this.$store.state.currentProject + return module }, //弹出module编辑页 editModule(module) { diff --git a/nezha-fronted/src/components/page/dashboard/explore/editor.vue b/nezha-fronted/src/components/page/dashboard/explore/editor.vue index fa0f64422..1ac5824bf 100644 --- a/nezha-fronted/src/components/page/dashboard/explore/editor.vue +++ b/nezha-fronted/src/components/page/dashboard/explore/editor.vue @@ -3,7 +3,7 @@
-
+
@@ -153,7 +153,6 @@ this.packageTypeInfo(); }else if(type == 'range'){ this.noStyleSuggestions={range:suggestions.getRateRange()} - this.showSuggestions=this.deepClone(this.noStyleSuggestions) } }, packageTypeInfo:function(){ @@ -267,7 +266,6 @@ this.$set(this.noStyleSuggestions,'metrics',this.tempStoreMetric) // this.$set(this.noStyleSuggestions,'operators',suggestions.getOperators()) this.$set(this.noStyleSuggestions,'functions',suggestions.getFunctions()) - this.showSuggestions=this.deepClone(this.noStyleSuggestions) }, queryValues:function(){ let labelValuesReg=/\{((\w*?(=|!=|=~|!~).*?,{0,1})+?)\}/ @@ -298,7 +296,6 @@ let values=this.labelValues.get(label); this.noStyleSuggestions={values:values} - this.showSuggestions=this.deepClone(this.noStyleSuggestions) } } }, @@ -362,11 +359,9 @@ }) this.noStyleSuggestions={labels:labels} - this.showSuggestions=this.deepClone(this.noStyleSuggestions); //console.log('change labels',this.showSuggestions) }else{ this.noStyleSuggestions={}; - this.showSuggestions=this.deepClone(this.noStyleSuggestions) } }) }, @@ -532,12 +527,12 @@ filterItems:function(input){ //过滤下拉选显示 let suggestions=this.deepClone(this.noStyleSuggestions) - let hasResolve=false; new Promise((resolve => { - let counter = 0; + let start = new Date().getTime(); + let result={}; this.orders.forEach(key=>{ let typeValues=suggestions[key]; - this.showSuggestions[key]=[]; + result[key]=[]; typeValues&&typeValues.forEach(item=>{ let index=item.insertText.toLowerCase().indexOf(input.toLowerCase()); //console.log('index',index,'input',input) @@ -549,20 +544,17 @@ let middle=label.substring(index,index+input.length) let suf=label.substring(index+input.length,label.length) item.label=`${pre}${middle}${suf}` - this.showSuggestions[key].push(item); - if(++counter > 20){ - hasResolve=true; - resolve(); - } + result[key].push(item); } }); - if(this.showSuggestions[key].length<1){ - delete this.showSuggestions[key] + if(result[key].length<1){ + delete result[key] } }) - if(!hasResolve){ - resolve(); - } + this.showSuggestions=result; + let end = new Date().getTime(); + console.log("filter time:",(end - start),'ms') + resolve(); })).then(()=>{ if(Object.keys(this.showSuggestions).length>0){ this.showType=true; diff --git a/nezha-fronted/src/components/page/dashboard/panel.vue b/nezha-fronted/src/components/page/dashboard/panel.vue index 320d74766..9c331b755 100644 --- a/nezha-fronted/src/components/page/dashboard/panel.vue +++ b/nezha-fronted/src/components/page/dashboard/panel.vue @@ -322,11 +322,28 @@ message: this.$t("tip.deleteSuccess") }); let chartList=this.$refs.chartList.dataList; + let nextChart=null,prevChart=null for (let i =0;i< chartList.length;i++){ if(chartList[i].id === data.id){ chartList.splice(i,1); - break; } + if(data.next != -1){ + if(chartList[i].id === data.next){ + nextChart = chartList[i] + } + } + if(data.prev != 0){ + if(chartList[i].id === data.prev){ + prevChart = chartList[i] + } + } + } + if(nextChart&&prevChart){ //删除图表为中间位置 + prevChart.next = nextChart.id; + nextChart.prev = prevChart.id; + }else{ + if(!nextChart) prevChart.next = -1; + if(!prevChart) nextChart.prev = 0; } // this.getTableData(); //删除相关图表后,刷新面板数据 } else { diff --git a/nezha-fronted/static/template/en/asset-template.xlsx b/nezha-fronted/static/template/en/asset-template.xlsx deleted file mode 100644 index 26275ce29..000000000 Binary files a/nezha-fronted/static/template/en/asset-template.xlsx and /dev/null differ diff --git a/nezha-fronted/static/template/en/endpoint-template.xlsx b/nezha-fronted/static/template/en/endpoint-template.xlsx deleted file mode 100644 index d141ac4c1..000000000 Binary files a/nezha-fronted/static/template/en/endpoint-template.xlsx and /dev/null differ