From 893b612b588e02f63be4b9bcdf8179d970a49b0f Mon Sep 17 00:00:00 2001 From: zyh Date: Thu, 20 Oct 2022 16:25:03 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-2274=20feat=EF=BC=9A=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=93=8D=E4=BD=9C=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=81=AE=E7=BD=A9=E5=B1=82=E9=81=BF=E5=85=8D=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/common/bottomBox/tabs/panelTabNew.vue | 4 ++-- nezha-fronted/src/components/page/config/model.vue | 2 ++ .../src/components/page/config/template/chartTemp.vue | 2 ++ .../components/page/dashboard/explore/exploreItem.vue | 10 +++------- nezha-fronted/src/components/page/dashboard/panel.vue | 4 ++-- .../src/components/page/monitor/module/moduleList.vue | 2 ++ nezha-fronted/src/http.js | 4 +--- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue b/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue index 5f54fc2d9..c5ded880a 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue @@ -717,7 +717,7 @@ export default { this.$store.dispatch('dispatchPanelLock', { flag: boolean }) }, chartBySync () { - this.panelTabLoading = true + this.$store.dispatch('dispatchHomeLoading', true) const params = {} if (this.from === 'chartTemp') { params.pid = this.obj.id @@ -725,7 +725,7 @@ export default { params.panelId = this.showPanel.id } this.$post('visual/panel/chart/syncTmpl', params).then(res => { - this.panelTabLoading = false + this.$store.dispatch('dispatchHomeLoading', false) if (res.code === 200) { this.getTableData(this.obj.id) this.$message.success(this.$t('tip.syncSuccess')) diff --git a/nezha-fronted/src/components/page/config/model.vue b/nezha-fronted/src/components/page/config/model.vue index fdf205c2a..2768f99ed 100644 --- a/nezha-fronted/src/components/page/config/model.vue +++ b/nezha-fronted/src/components/page/config/model.vue @@ -131,7 +131,9 @@ export default { }, methods: { chartBySync (row) { + this.$store.dispatch('dispatchHomeLoading', true) this.$post('visual/panel/chart/syncTmpl', { models: [row.id] }).then(res => { + this.$store.dispatch('dispatchHomeLoading', false) if (res.code === 200) { this.getTableData() this.$message.success(this.$t('tip.syncSuccess')) diff --git a/nezha-fronted/src/components/page/config/template/chartTemp.vue b/nezha-fronted/src/components/page/config/template/chartTemp.vue index 3956b616b..29781bec2 100644 --- a/nezha-fronted/src/components/page/config/template/chartTemp.vue +++ b/nezha-fronted/src/components/page/config/template/chartTemp.vue @@ -264,7 +264,9 @@ export default { } }, chartBySync (row) { + this.$store.dispatch('dispatchHomeLoading', true) this.$post('visual/panel/chart/syncTmpl', { pid: row.id }).then(res => { + this.$store.dispatch('dispatchHomeLoading', false) if (res.code === 200) { this.getTableData() this.$message.success(this.$t('tip.syncSuccess')) diff --git a/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue b/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue index a1a4dfebb..43aed7532 100644 --- a/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue +++ b/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue @@ -1843,7 +1843,7 @@ import chartDataFormat from '../../../chart/chartDataFormat' import logTab from './logTab' import promqlInputMixin from '@/components/common/mixin/promqlInput' import chartRightBox from '@/components/common/rightBox/chart/chartRightBox' -import {Loading} from "element-ui"; +import { Loading } from 'element-ui' export default { name: 'exploreItem', @@ -2628,13 +2628,9 @@ export default { if (!this.showMetrics) { params.limit = this.$refs.logDetail ? this.$refs.logDetail.getLimit() : 100 } - const loading = Loading.service({ - lock: true, - customClass: 'export-pdf-mask', - background: 'rgba(0,0,0,.2)' - }) + this.$store.dispatch('dispatchHomeLoading', true) this.$get('/visual/explore/snapshot', params, 'blob').then(res => { - loading.close() + this.$store.dispatch('dispatchHomeLoading', false) const self = this let fileName = this.showMetrics ? 'Metrics explore' : 'Logs explore' const resFileName = '' diff --git a/nezha-fronted/src/components/page/dashboard/panel.vue b/nezha-fronted/src/components/page/dashboard/panel.vue index 29b727bff..4fa4adf80 100644 --- a/nezha-fronted/src/components/page/dashboard/panel.vue +++ b/nezha-fronted/src/components/page/dashboard/panel.vue @@ -505,9 +505,9 @@ export default { this.rightBox.chartTemp.show = true }, chartBySync () { - this.panelTabLoading = true + this.$store.dispatch('dispatchHomeLoading', true) this.$post('visual/panel/chart/syncTmpl', { panelId: this.showPanel.id }).then(res => { - this.panelTabLoading = false + this.$store.dispatch('dispatchHomeLoading', false) if (res.code === 200) { this.getData(this.filter) this.$message.success(this.$t('tip.syncSuccess')) diff --git a/nezha-fronted/src/components/page/monitor/module/moduleList.vue b/nezha-fronted/src/components/page/monitor/module/moduleList.vue index b830b1ab9..bcf87e4eb 100644 --- a/nezha-fronted/src/components/page/monitor/module/moduleList.vue +++ b/nezha-fronted/src/components/page/monitor/module/moduleList.vue @@ -473,7 +473,9 @@ export default { }) }, chartBySync (row) { + this.$store.dispatch('dispatchHomeLoading', true) this.$post('visual/panel/chart/syncTmpl', { modules: row.id }).then(res => { + this.$store.dispatch('dispatchHomeLoading', false) if (res.code === 200) { this.getTableData() this.$message.success(this.$t('tip.syncSuccess')) diff --git a/nezha-fronted/src/http.js b/nezha-fronted/src/http.js index 6a86b5869..4d3dd83e9 100644 --- a/nezha-fronted/src/http.js +++ b/nezha-fronted/src/http.js @@ -123,9 +123,7 @@ export function get (url, params, responseType) { if (err.response) { resolve(err.response.data) } else if (err.message) { - if (err.message !== 'cancel') { // 判断是否是路由跳转取消的请求(是的话没必要提示message) - resolve(err.message) - } + resolve(err.message) } else { resolve(err) }