From 55bd2fde5b72fbd2b18791b213a45d0c85c30ad4 Mon Sep 17 00:00:00 2001 From: wangwenrui Date: Wed, 14 Oct 2020 12:23:40 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E4=BB=8Eheader?= =?UTF-8?q?=E7=82=B9=E5=BC=80=E7=9A=84=E4=BE=A7=E6=BB=91=E8=A2=AB=E4=B8=8B?= =?UTF-8?q?=E6=96=B9=E5=BC=B9=E5=87=BA=E6=A1=86=E9=81=AE=E6=8C=A1=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/common/header.vue | 1 - .../src/components/page/project/project.vue | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/nezha-fronted/src/components/common/header.vue b/nezha-fronted/src/components/common/header.vue index b739be00e..0f908dcf6 100644 --- a/nezha-fronted/src/components/common/header.vue +++ b/nezha-fronted/src/components/common/header.vue @@ -724,7 +724,6 @@ width: 100%; height: 50px; background-color: #232f3e; - z-index: 1; } diff --git a/nezha-fronted/src/components/page/project/project.vue b/nezha-fronted/src/components/page/project/project.vue index bc9bcfc3f..83cdf5d42 100644 --- a/nezha-fronted/src/components/page/project/project.vue +++ b/nezha-fronted/src/components/page/project/project.vue @@ -103,6 +103,8 @@   + + @@ -439,6 +441,22 @@ this.bottomBox.targetTab = "panel"; this.bottomBox.showSubList = true; }, + delEndpoint(endpoint) { + this.$confirm(this.$t("tip.confirmDelete"), { + confirmButtonText: this.$t("tip.yes"), + cancelButtonText: this.$t("tip.no"), + type: 'warning' + }).then(() => { + this.$delete("endpoint?ids=" + endpoint.id).then(response => { + if (response.code === 200) { + this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")}); + this.getEndpointTableData(); + } else { + this.$message.error(response.msg); + } + }); + }); + }, jumpToAlertMsg(endpoint) { this.endpoint = Object.assign({}, endpoint); this.bottomBox.targetTab = 'alertMessage'; From 448d013f6dcbedea74a34d49387585ace67c8256 Mon Sep 17 00:00:00 2001 From: wangwenrui Date: Wed, 14 Oct 2020 15:41:07 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E4=BB=8E=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E9=A1=B5=E5=88=A0=E9=99=A4=E5=9B=BE=E8=A1=A8=E7=9A=84?= =?UTF-8?q?bug=20&=20=E6=96=B0=E5=A2=9Etable=E7=B1=BB=E5=9E=8B=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/charts/chart-list.vue | 3 ++ .../common/bottomBox/tabs/panelTab.vue | 22 ++++++++++++-- .../src/components/common/language/cn.js | 1 + .../src/components/common/language/en.js | 1 + .../components/page/dashboard/chartBox.vue | 30 +++++++------------ .../src/components/page/dashboard/panel.vue | 3 +- 6 files changed, 38 insertions(+), 22 deletions(-) diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index 817756c84..739de0b37 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -842,6 +842,9 @@ chartInfo.param.nullType=chartInfo.param.nullType||'connected'; query+='&nullType='+chartInfo.param.nullType; } + if(chartInfo.type === 'table'&&chartInfo.param&&chartInfo.param.last == 1){ + return this.$get('/prom/api/v1/query_range?query=' + query + "&start=" + this.$stringTimeParseToUnix(endTime) + "&end=" + this.$stringTimeParseToUnix(endTime) + '&step=' + step); + } return this.$get('/prom/api/v1/query_range?query=' + query + "&start=" + this.$stringTimeParseToUnix(startTime) + "&end=" + this.$stringTimeParseToUnix(endTime) + '&step=' + step); }); // 一个图表的所有element单独获取数据 diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/panelTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/panelTab.vue index 4f6ef65a6..dd804eb0a 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/panelTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/panelTab.vue @@ -86,7 +86,7 @@ - + @@ -249,12 +249,30 @@ type: 'success', message: this.$t("tip.deleteSuccess") }); + this.rightBox.show = false; 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(this.obj.id); //删除相关图表后,刷新面板数据 } else { diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index f622020c9..2d891365e 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -129,6 +129,7 @@ const cn = { url: "URL", statistics:'Statistics', sync: '同步到设备', + last:'Last', threshold:'阈值', typeVal: { line: { diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 61ff121a3..5d682e154 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -138,6 +138,7 @@ const en = { statistics:'Statistics', legendTip:'Controls the name of the time series, using name or pattern. For example {{hostname}} will be replaced with label value for the label hostname.', sync: 'Sync to assets', + last:'Last', threshold:'Threshold', typeVal:{ line:{ diff --git a/nezha-fronted/src/components/page/dashboard/chartBox.vue b/nezha-fronted/src/components/page/dashboard/chartBox.vue index 1088b290f..afc1c6553 100644 --- a/nezha-fronted/src/components/page/dashboard/chartBox.vue +++ b/nezha-fronted/src/components/page/dashboard/chartBox.vue @@ -143,6 +143,9 @@ px + + + @@ -531,24 +534,8 @@ } }); }, - del(u) { - this.$confirm(this.$t("tip.confirmDelete"), { - confirmButtonText: this.$t("tip.yes"), - cancelButtonText: this.$t("tip.no"), - type: 'warning' - }).then(() => { - this.$delete("panel/" + this.panelId + "/charts?ids=" + u.id).then(response => { - if (response.code === 200) { - if(this.$refs.chartForm){ - this.$refs.chartForm.resetFields();//清空表单 - } - this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")}); - this.esc(true); - } else { - this.$message.error(response.msg); - } - }) - }); + del() { + this.$emit('delete-chart',this.editChart) }, //---------------------------------- @@ -1054,6 +1041,7 @@ this.editChart.height = 400+''; this.editChart.unit=2; let param = {}; + param.last=0; param.url=''; param.threshold=''; param.valueMapping={type:'text',mapping:[{value:'',text:''}]}; @@ -1120,6 +1108,8 @@ this.setIsOtherChart(); if(chartType === 'bar'||chartType === 'line'||chartType === 'stackArea'){ this.editChart.param={nullType:this.editChart.param.nullType,threshold:'',legendValue:{min:'off',max:'off',avg:'off',last:'off',total:'off'}} + }else if(chartType == 'table'){ + this.editChart.param.last= 0; } /*if(this.$refs.chartTag){ this.$refs.chartTag.forEach((item, index) => { @@ -1295,7 +1285,9 @@ } else if(n.type === 'singleStat'){ n.param&&!n.param.valueMapping&&this.$set(this.editChart.param,'valueMapping',{type:'value',mapping:[{text:'',value:''}]}) this.setIsSingleStat(); - } else { + } else if(n.type === 'table'){ + n.param.last?this.$set(this.editChart.param,'last',n.param.last):this.$set(this.editChart.param,'last',0) + }else { this.setIsOtherChart(); n.param&&!n.param.legendValue&&this.$set(this.editChart.param,'legendValue',{min:'off',max:'off',avg:'off',last:'off',total:'off'}) } diff --git a/nezha-fronted/src/components/page/dashboard/panel.vue b/nezha-fronted/src/components/page/dashboard/panel.vue index c7e7c0989..2e47bcb1e 100644 --- a/nezha-fronted/src/components/page/dashboard/panel.vue +++ b/nezha-fronted/src/components/page/dashboard/panel.vue @@ -84,7 +84,7 @@ - + @@ -321,6 +321,7 @@ type: 'success', message: this.$t("tip.deleteSuccess") }); + this.rightBox.chart.show = false; let chartList=this.$refs.chartList.dataList; let nextChart=null,prevChart=null for (let i =0;i< chartList.length;i++){ From c6669196320aed2bb972d79f2740e041d9ef5a0f Mon Sep 17 00:00:00 2001 From: wangwenrui Date: Wed, 14 Oct 2020 16:14:52 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8Dalert=20message?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=9C=AA=E6=90=BA=E5=B8=A6=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/common/exportXLSX.vue | 1 + nezha-fronted/src/components/page/alert/list.vue | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/nezha-fronted/src/components/common/exportXLSX.vue b/nezha-fronted/src/components/common/exportXLSX.vue index c396099ab..5f0873f86 100644 --- a/nezha-fronted/src/components/common/exportXLSX.vue +++ b/nezha-fronted/src/components/common/exportXLSX.vue @@ -159,6 +159,7 @@ if(this.paramsType){ form.append('type',this.paramsType); } + form.append('language',localStorage.getItem("nz-language") ? localStorage.getItem("nz-language") : 'en') this.$post(this.importUrl,form,{'Content-Type': 'multipart/form-data'}).then(response=>{ if(response.code==200 && response.msg=='success'){ this.importResult=response.data; diff --git a/nezha-fronted/src/components/page/alert/list.vue b/nezha-fronted/src/components/page/alert/list.vue index 1441ba29f..2db97d482 100644 --- a/nezha-fronted/src/components/page/alert/list.vue +++ b/nezha-fronted/src/components/page/alert/list.vue @@ -443,12 +443,15 @@ this.deleteBox.show = false; }, exportCur:function(){ - this.exportExcel(this.searchLabel); + let searchLabel=Object.assign({},this.searchLabel) + this.$set(searchLabel,'language',localStorage.getItem("nz-language") ? localStorage.getItem("nz-language") : 'en') + this.exportExcel(searchLabel); this.closeDialog(); }, exportAll:function(){ let temp = JSON.parse(JSON.stringify(this.searchLabel)); temp.pageSize = -1; + this.$set(temp,'language',localStorage.getItem("nz-language") ? localStorage.getItem("nz-language") : 'en') this.exportExcel(temp); this.closeDialog(); },