diff --git a/nezha-fronted/src/components/chart/chart/legend.vue b/nezha-fronted/src/components/chart/chart/legend.vue index cfb4dff47..5f87d3ae6 100644 --- a/nezha-fronted/src/components/chart/chart/legend.vue +++ b/nezha-fronted/src/components/chart/chart/legend.vue @@ -216,7 +216,7 @@ export default { getMaxValue (dataArg, chartInfo) { let maxValue = 0 let minValue = 0 - if (chartInfo.unit && dataArg.length > 0) { + if (dataArg.length > 0) { maxValue = 0 minValue = 0 for (let j = 0; j < dataArg.length; j++) { diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue index 0edfa4fb6..d0b71ba7a 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue @@ -621,7 +621,7 @@ export default { } chartInfo.elements[0].expression = this.currentMsg.alertRule.expr.replace(/\"/g, '\'').replace(/\r|\n+/g, '') chartInfo.elements[0].filter = encodeURIComponent(decodeURIComponent(this.promQueryParamLabels(this.currentMsg.labels))) - chartInfo.unit = this.currentMsg.unit + chartInfo.unit = this.currentMsg.alertRule.unit this.showFullscreen(true, chartInfo) } else if (this.currentMsg.alertRule.type === 2) { const chartInfo = lodash.cloneDeep(logData) @@ -635,7 +635,7 @@ export default { } chartInfo.elements[0].expression = encodeURIComponent(this.currentMsg.alertRule.expr.replace(/\"/g, '\'').replace(/\r|\n+/g, '')) chartInfo.elements[0].filter = encodeURIComponent(decodeURIComponent(this.promQueryParamLabels(this.currentMsg.labels))) - chartInfo.unit = this.currentMsg.unit + chartInfo.unit = this.currentMsg.alertRule.unit this.showFullscreen(true, chartInfo) } }, diff --git a/nezha-fronted/src/components/page/alert/alertMessage.vue b/nezha-fronted/src/components/page/alert/alertMessage.vue index 0793ceee0..989cfda62 100644 --- a/nezha-fronted/src/components/page/alert/alertMessage.vue +++ b/nezha-fronted/src/components/page/alert/alertMessage.vue @@ -595,7 +595,8 @@ export default { } chartInfo.elements[0].expression = this.currentMsg.alertRule.expr.replace(/\"/g, '\'').replace(/\r|\n+/g, '') chartInfo.elements[0].filter = encodeURIComponent(decodeURIComponent(this.promQueryParamLabels(this.currentMsg.labels))) - chartInfo.unit = this.currentMsg.unit + chartInfo.unit = this.currentMsg.alertRule.unit + console.log(chartInfo.unit) this.showFullscreen(true, chartInfo) } else if (this.currentMsg.alertRule.type === 2) { const chartInfo = lodash.cloneDeep(logData) @@ -609,7 +610,7 @@ export default { } chartInfo.elements[0].expression = encodeURIComponent(this.currentMsg.alertRule.expr.replace(/\"/g, '\'').replace(/\r|\n+/g, '')) chartInfo.elements[0].filter = encodeURIComponent(decodeURIComponent(this.promQueryParamLabels(this.currentMsg.labels))) - chartInfo.unit = this.currentMsg.unit + chartInfo.unit = this.currentMsg.alertRule.unit this.showFullscreen(true, chartInfo) } },