-
-
- {{moduleName}}
-
-
+
+
+ {{moduleName}}
+
+
{{moduleName}}
@@ -377,20 +381,15 @@
this.$chartResizeTool.start(vm, this.data, e);
},
setLabels:function(source){
- let labels=[];
- source.forEach(item=>{
- labels=labels.concat(Object.keys(item))
- })
- labels=Array.from(new Set(labels));
-
- labels=labels.map(item=>{
+ let labels = Object.keys(source[0]);
+ labels = labels.map(item=>{
return{
label:this.replaceSplit(item),
prop:item,
show:true,
}
});
- console.info(labels)
+ console.info(labels);
return labels;
},
replaceSplit(key){
diff --git a/nezha-fronted/src/components/charts/chart.scss b/nezha-fronted/src/components/charts/chart.scss
index fa1074e3e..3e4ef7b6f 100644
--- a/nezha-fronted/src/components/charts/chart.scss
+++ b/nezha-fronted/src/components/charts/chart.scss
@@ -379,6 +379,16 @@
box-sizing: border-box;
height: 26px;
}
+ .item-tip.deep:nth-of-type(2) {
+ padding-left: 13px;
+ box-sizing: border-box;
+ height: 26px;
+ }
+ .item-tip.deepp:last-of-type {
+ padding-left: 13px;
+ box-sizing: border-box;
+ height: 26px;
+ }
.tag-value:hover .item-tip-show {
display: block;
}
diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue
index 860498163..f9178513d 100644
--- a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue
+++ b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue
@@ -276,7 +276,7 @@
prop: 'endAt',
show: true,
}, {
- label: this.$t('alert.list.current'),
+ label: this.$t('overall.value'),
prop: 'current',
show: true
}, {
diff --git a/nezha-fronted/src/components/common/header.vue b/nezha-fronted/src/components/common/header.vue
index 8810b3973..efd732e00 100644
--- a/nezha-fronted/src/components/common/header.vue
+++ b/nezha-fronted/src/components/common/header.vue
@@ -509,12 +509,12 @@
//this.$router.go(-1);
},
getLinkData(){
- console.log('aaa');
+ //console.log('aaa');
this.$get('link').then(response=>{
- console.log(response);
+ //console.log(response);
// this.linkData=response.data;
this.$store.commit('setLinkData',response.data);
- console.log(this.$store)
+ //console.log(this.$store)
});
},
},
diff --git a/nezha-fronted/src/components/common/rightBox/moduleBox.vue b/nezha-fronted/src/components/common/rightBox/moduleBox.vue
index 8289d0803..9d770129d 100644
--- a/nezha-fronted/src/components/common/rightBox/moduleBox.vue
+++ b/nezha-fronted/src/components/common/rightBox/moduleBox.vue
@@ -692,7 +692,7 @@
immediate: true,
deep: true,
handler(n, o) {
- if (n.type && n.type.toLowerCase() == 'snmp') {
+ if (!n.id && n.type && n.type.toLowerCase() == 'snmp') {
n.port = 161;
this.expandedWalkData = [];
this.$nextTick(() => {
@@ -701,6 +701,8 @@
for (let i = 0; i < n.walk.length; i++) {
this.expandedWalkData.push(n.walk[i].substring(0, n.walk[i].lastIndexOf(".")));
}
+ } else if (!n.id && n.type && n.type.toLowerCase() == 'http') {
+ n.port = 9100;
}
}
},
diff --git a/nezha-fronted/src/components/page/alert/list.vue b/nezha-fronted/src/components/page/alert/list.vue
index cc9076d0d..7e1dde121 100644
--- a/nezha-fronted/src/components/page/alert/list.vue
+++ b/nezha-fronted/src/components/page/alert/list.vue
@@ -69,9 +69,10 @@
>
- {{scope.row[item.prop].alertName}}
+ v-if="scope.row[item.prop].alertName">{{scope.row[item.prop].alertName}}-->
+
{{scope.row[item.prop].alertName}}
-
diff --git a/nezha-fronted/src/components/page/dashboard/chartBox.vue b/nezha-fronted/src/components/page/dashboard/chartBox.vue
index 4fd43e0d6..6e00f6d20 100644
--- a/nezha-fronted/src/components/page/dashboard/chartBox.vue
+++ b/nezha-fronted/src/components/page/dashboard/chartBox.vue
@@ -394,13 +394,13 @@
'promql-input': promqlInput,
},
mounted() {
- if(this.showPanel){
- this.panelName2 = this.showPanel.name;
- }
this.rightBox.show = true;
this.isUrl = false;
this.isSingleStat = false;
this.$nextTick(() => {
+ if(this.showPanel){
+ this.panelName2 = this.showPanel.name;
+ }
this.initElements();
});
},
diff --git a/nezha-fronted/src/components/page/dashboard/overview/overview2.vue b/nezha-fronted/src/components/page/dashboard/overview/overview2.vue
index dd5a4d7a7..3ee2aef32 100644
--- a/nezha-fronted/src/components/page/dashboard/overview/overview2.vue
+++ b/nezha-fronted/src/components/page/dashboard/overview/overview2.vue
@@ -494,77 +494,88 @@
queryAlertTrendData() {
this.$refs.chartbox.startLoading();
this.chartSeries = [];
-
- this.$get('/prom/api/v1/query_range', this.trendParamHandle('rx')).then(response=>{
- if(response.status == 'success'){
- if(response.data.result){
- let series={
- name: 'RX',
- symbol:'none', //去掉点
- smooth:0.2, //曲线变平滑
- data: [],
- type:'line',
- lineStyle: {
- width: 1,
- opacity: 0.9
- },
- };
- if (response.data.result.length > 0) {
- series.data=response.data.result[0].values.map((item)=>{
- return [item[0]*1000,item[1]];
- });
- }
- this.chartSeries.push(series);
- if (this.chartSeries.length == 2) {
- this.$refs.chartbox.modifyOption("tooltip", "backgroundColor", "rgba(221,228,237,1)");
- this.$refs.chartbox.modifyOption("tooltip", "textStyle", {color: "#000"});
- this.$refs.chartbox.modifyOption("grid", "top", 30);
- this.$refs.chartbox.modifyOption("grid", "left", 0);
- this.$refs.chartbox.modifyOption("grid", "right", 30);
- this.$refs.chartbox.modifyOption("grid", "bottom", 8);
- this.$refs.chartbox.modifyOption("grid", "containLabel", true);
- this.$refs.chartbox.setSeries(this.chartSeries);
- this.$refs.chartbox.endLoading();
+ let rxPromise = new Promise((resolve, reject) => {
+ this.$get('/prom/api/v1/query_range', this.trendParamHandle('rx')).then(response=>{
+ if(response.status == 'success'){
+ if(response.data.result){
+ let series={
+ name: 'RX',
+ symbol:'none', //去掉点
+ smooth:0.2, //曲线变平滑
+ data: [],
+ type:'line',
+ lineStyle: {
+ width: 1,
+ opacity: 0.9
+ },
+ };
+ if (response.data.result.length > 0) {
+ series.data=response.data.result[0].values.map((item)=>{
+ return [item[0]*1000,item[1]];
+ });
+ }
+ this.chartSeries.push(series);
+ if (this.chartSeries.length == 2) {
+ this.$refs.chartbox.modifyOption("tooltip", "backgroundColor", "rgba(221,228,237,1)");
+ this.$refs.chartbox.modifyOption("tooltip", "textStyle", {color: "#000"});
+ this.$refs.chartbox.modifyOption("grid", "top", 30);
+ this.$refs.chartbox.modifyOption("grid", "left", 0);
+ this.$refs.chartbox.modifyOption("grid", "right", 30);
+ this.$refs.chartbox.modifyOption("grid", "bottom", 8);
+ this.$refs.chartbox.modifyOption("grid", "containLabel", true);
+ this.$refs.chartbox.setSeries(this.chartSeries);
+ }
}
+ resolve(true);
+ }else{
+ console.error(response);
+ resolve(false);
}
- }else{
- console.error(response)
- }
+ });
});
- this.$get('/prom/api/v1/query_range', this.trendParamHandle('tx')).then(response=>{
- if(response.status == 'success'){
- if(response.data.result){
- let series={
- name: 'TX',
- symbol:'none', //去掉点
- smooth:0.2, //曲线变平滑
- data: [],
- type:'line',
- lineStyle: {
- width: 1,
- opacity: 0.9
- },
- };
- if (response.data.result.length > 0) {
- series.data=response.data.result[0].values.map((item)=>{
- return [item[0]*1000,item[1]];
- });
- }
- this.chartSeries.push(series);
- if (this.chartSeries.length == 2) {
- this.$refs.chartbox.modifyOption("tooltip", "backgroundColor", "rgba(221,228,237,1)");
- this.$refs.chartbox.modifyOption("tooltip", "textStyle", {color: "#000"});
- this.$refs.chartbox.modifyOption("grid", "top", 30);
- this.$refs.chartbox.modifyOption("grid", "left", 0);
- this.$refs.chartbox.modifyOption("grid", "right", 30);
- this.$refs.chartbox.modifyOption("grid", "bottom", 8);
- this.$refs.chartbox.setSeries(this.chartSeries);
- this.$refs.chartbox.endLoading();
+ let txPromise = new Promise((resolve, reject) => {
+ this.$get('/prom/api/v1/query_range', this.trendParamHandle('tx')).then(response=>{
+ if(response.status == 'success'){
+ if(response.data.result){
+ let series={
+ name: 'TX',
+ symbol:'none', //去掉点
+ smooth:0.2, //曲线变平滑
+ data: [],
+ type:'line',
+ lineStyle: {
+ width: 1,
+ opacity: 0.9
+ },
+ };
+ if (response.data.result.length > 0) {
+ series.data=response.data.result[0].values.map((item)=>{
+ return [item[0]*1000,item[1]];
+ });
+ }
+ this.chartSeries.push(series);
+ if (this.chartSeries.length == 2) {
+ this.$refs.chartbox.modifyOption("tooltip", "backgroundColor", "rgba(221,228,237,1)");
+ this.$refs.chartbox.modifyOption("tooltip", "textStyle", {color: "#000"});
+ this.$refs.chartbox.modifyOption("grid", "top", 30);
+ this.$refs.chartbox.modifyOption("grid", "left", 0);
+ this.$refs.chartbox.modifyOption("grid", "right", 30);
+ this.$refs.chartbox.modifyOption("grid", "bottom", 8);
+ this.$refs.chartbox.setSeries(this.chartSeries);
+ //this.$refs.chartbox.endLoading();
+ }
}
+ resolve(true);
+ }else{
+ console.error(response)
+ resolve(false);
}
- }else{
- console.error(response)
- }
+ });
+ });
+ Promise.all([rxPromise, txPromise]).then(resolve => {
+ this.$refs.chartbox.endLoading();
+ }, reject => {
+ this.$refs.chartbox.endLoading();
});
},
trendParamHandle(t) {
diff --git a/nezha-fronted/src/components/page/dashboard/panel.vue b/nezha-fronted/src/components/page/dashboard/panel.vue
index 6b6485b69..dad67480f 100644
--- a/nezha-fronted/src/components/page/dashboard/panel.vue
+++ b/nezha-fronted/src/components/page/dashboard/panel.vue
@@ -226,7 +226,7 @@
}
this.filter.searchName='';
//this.$refs.searchInput.select();
- this.showPanel = val
+ this.showPanel = val;
this.filter.panelId = this.showPanel.id;
// let curTime = this.$refs.calendarPanel.getCurrentTime();
let curTime=this.searchTime;
@@ -429,15 +429,13 @@
let isInitData = false;
if (response.data.list.length > 0) {
if (this.$store.state.showPanel.id !== 0 && this.$store.state.showPanel.name !== '') {
- this.showPanel.name = this.$store.state.showPanel.name;
- this.showPanel.id = this.$store.state.showPanel.id;
+ this.showPanel = this.$store.state.showPanel;
}
if (clearShowPanel) {
this.showPanel.id = '';
}
- if (this.showPanel.id === '') {
- this.showPanel.id = response.data.list[0].id;
- this.showPanel.name = response.data.list[0].name;
+ if (!this.showPanel.id) {
+ this.showPanel = response.data.list[0];
this.filter.panelId = this.showPanel.id;
this.getData(this.filter);
isInitData = true;
@@ -453,7 +451,7 @@
}
this.$store.state.showPanel.id = 0;
this.$store.state.showPanel.name = '';
-
+ this.$store.state.showPanel.type = 'dashboard';
}else {
if(response.msg){
this.$message.error(response.msg);
@@ -580,7 +578,7 @@
});
}
this.panelDataDragTmp = [...this.panelData];
- console.log(this.panelDataDragTmp)
+ //console.log(this.panelDataDragTmp)
},
end (event) {
// console.info("end event:", event)
diff --git a/nezha-fronted/src/store/index.js b/nezha-fronted/src/store/index.js
index e19c98010..a1eeaecaa 100644
--- a/nezha-fronted/src/store/index.js
+++ b/nezha-fronted/src/store/index.js
@@ -33,7 +33,8 @@ const store = new Vuex.Store({
},
showPanel:{
id:0,
- name:''
+ name:'',
+ type: "dashboard"
},
consoleShow:false,//是否显示console窗口
consoleCount:0,//当前console窗口数