From 7ca733dfe14819bf482c5027f2f66ae20145e91f Mon Sep 17 00:00:00 2001 From: zhangyu Date: Thu, 25 Nov 2021 16:29:56 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=20=E4=BF=AE=E6=94=B9=E6=AD=A3?= =?UTF-8?q?=E5=88=99=20\s=20=E4=B8=BA=20\r|\n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/charts/chart-alert-list.vue | 4 ++-- .../components/common/bottomBox/tabs/alertMessageTabNew.vue | 4 ++-- nezha-fronted/src/components/common/searchInput.vue | 2 ++ nezha-fronted/src/components/page/alert/alertMessage.vue | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/nezha-fronted/src/components/charts/chart-alert-list.vue b/nezha-fronted/src/components/charts/chart-alert-list.vue index b938daa22..3de1fed2f 100644 --- a/nezha-fronted/src/components/charts/chart-alert-list.vue +++ b/nezha-fronted/src/components/charts/chart-alert-list.vue @@ -517,7 +517,7 @@ export default { const axiosArr = [] const paramStr = this.currentMsg ? JSON.stringify(this.promQueryParamConvert(this.currentMsg)) : null if (paramStr && paramStr.trim() != '""') { - axiosArr.push(axios.get('/prom/api/v1/query_range?query=' + encodeURIComponent(this.currentMsg.alertRule.expr.replace(/\"/g, '\'').replace(/\s+/g, '')) + '&start=' + this.$stringTimeParseToUnix(start) + '&end=' + this.$stringTimeParseToUnix(end) + '&step=' + step + '&filter=' + encodeURIComponent(decodeURIComponent(this.promQueryParamLabels(this.currentMsg.labels))))) + axiosArr.push(axios.get('/prom/api/v1/query_range?query=' + encodeURIComponent(this.currentMsg.alertRule.expr.replace(/\"/g, '\'').replace(/\r|\n+/g, '')) + '&start=' + this.$stringTimeParseToUnix(start) + '&end=' + this.$stringTimeParseToUnix(end) + '&step=' + step + '&filter=' + encodeURIComponent(decodeURIComponent(this.promQueryParamLabels(this.currentMsg.labels))))) this.legend = [] this.chartDatas = [] axios.all(axiosArr).then(res => { @@ -760,7 +760,7 @@ export default { this.getAlerScreetList() }, promQueryParamConvert (obj) { - let r = '(' + obj.alertRule.expr.replace(/\"/g, '\'').replace(/\s+/g, '') + ')' + let r = '(' + obj.alertRule.expr.replace(/\"/g, '\'').replace(/\r|\n+/g, '') + ')' let intoLabels = false obj.labels = JSON.parse(obj.labels) if (Object.keys(obj.labels).length > 0) { diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue index 9918cd9ee..08e3838d8 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue @@ -264,7 +264,7 @@ export default { if (this.$refs.messageChart) { this.$refs.messageChart.startLoading() const axiosArr = [] - axiosArr.push(axios.get('/prom/api/v1/query_range?query=' + encodeURIComponent(this.currentMsg.alertRule.expr.replace(/\s+/g, '')) + '&start=' + this.$stringTimeParseToUnix(start) + '&end=' + this.$stringTimeParseToUnix(end) + '&step=' + step + '&filter=' + encodeURIComponent(decodeURIComponent(this.promQueryParamLabels(this.currentMsg.labels))))) + axiosArr.push(axios.get('/prom/api/v1/query_range?query=' + encodeURIComponent(this.currentMsg.alertRule.expr.replace(/\r|\n+/g, '')) + '&start=' + this.$stringTimeParseToUnix(start) + '&end=' + this.$stringTimeParseToUnix(end) + '&step=' + step + '&filter=' + encodeURIComponent(decodeURIComponent(this.promQueryParamLabels(this.currentMsg.labels))))) this.legend = [] this.chartDatas = [] axios.all(axiosArr).then(res => { @@ -426,7 +426,7 @@ export default { }, promQueryParamConvert (alert) { const obj = { ...alert } - let r = '(' + obj.alertRule.expr.replace(/\"/g, '\'').replace(/\s+/g, '') + ')' + let r = '(' + obj.alertRule.expr.replace(/\"/g, '\'').replace(/\r|\n+/g, '') + ')' let intoLabels = false obj.labels = JSON.parse(obj.labels) if (Object.keys(obj.labels).length > 0) { diff --git a/nezha-fronted/src/components/common/searchInput.vue b/nezha-fronted/src/components/common/searchInput.vue index 485e96c1e..b9ba4dde9 100644 --- a/nezha-fronted/src/components/common/searchInput.vue +++ b/nezha-fronted/src/components/common/searchInput.vue @@ -1097,6 +1097,8 @@ export default { setTimeout('document.getElementById("one-input").focus()', 500) this.input_list = false this.delcriteriaBool = false + } else if(this.searchMsg.searchLabelList.find(key => this.select_list[this.sreach_num].label == key.label).readonly) { + this.input_sreach = '' } else { if (this.input_sreach == '') { this.delcriteriaBool = true diff --git a/nezha-fronted/src/components/page/alert/alertMessage.vue b/nezha-fronted/src/components/page/alert/alertMessage.vue index df513863c..5699d1ec3 100644 --- a/nezha-fronted/src/components/page/alert/alertMessage.vue +++ b/nezha-fronted/src/components/page/alert/alertMessage.vue @@ -511,7 +511,7 @@ export default { if (this.$refs.messageChart) { this.$refs.messageChart.startLoading() const axiosArr = [] - axiosArr.push(axios.get('/prom/api/v1/query_range?query=' + encodeURIComponent(this.currentMsg.alertRule.expr.replace(/\"/g, '\'').replace(/\s+/g, '')) + '&start=' + this.$stringTimeParseToUnix(start) + '&end=' + this.$stringTimeParseToUnix(end) + '&step=' + step + '&filter=' + encodeURIComponent(decodeURIComponent(this.promQueryParamLabels(this.currentMsg.labels))))) + axiosArr.push(axios.get('/prom/api/v1/query_range?query=' + encodeURIComponent(this.currentMsg.alertRule.expr.replace(/\"/g, '\'').replace(/\r|\n+/g, '')) + '&start=' + this.$stringTimeParseToUnix(start) + '&end=' + this.$stringTimeParseToUnix(end) + '&step=' + step + '&filter=' + encodeURIComponent(decodeURIComponent(this.promQueryParamLabels(this.currentMsg.labels))))) this.legend = [] this.chartDatas = [] axios.all(axiosArr).then(res => { @@ -904,7 +904,7 @@ export default { }, promQueryParamConvert (alert) { const obj = { ...alert } - let r = '(' + obj.alertRule.expr.replace(/\"/g, '\'').replace(/\s+/g, '') + ')' + let r = '(' + obj.alertRule.expr.replace(/\"/g, '\'').replace(/\r|\n+/g, '') + ')' let intoLabels = false obj.labels = JSON.parse(obj.labels) if (Object.keys(obj.labels).length > 0) {