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/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/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js
index 9ea335383..03923a0a1 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 055550d6b..5577a0702 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/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();
},
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++){