diff --git a/nezha-fronted/src/components/chart/chart/chartMap.vue b/nezha-fronted/src/components/chart/chart/chartMap.vue index 70f3bdf89..bc6a0dc59 100644 --- a/nezha-fronted/src/components/chart/chart/chartMap.vue +++ b/nezha-fronted/src/components/chart/chart/chartMap.vue @@ -33,7 +33,8 @@ export default { x: 0, y: 0 }, - theme: localStorage.getItem(`nz-user-${localStorage.getItem('nz-user-id')}-theme`) + theme: localStorage.getItem(`nz-user-${localStorage.getItem('nz-user-id')}-theme`), + timer: null } }, mounted () { @@ -41,13 +42,19 @@ export default { }, methods: { initMap () { - let loadPromise - this.loadMapConfig().then((mapConfig) => { - if (mapConfig && this.map) { - loadPromise = this.loadDataCenterMapData() - } - }) - return loadPromise + if (this.timer) { + clearTimeout(this.timer) + this.timer = null + } + this.timer = setTimeout(() => { + let loadPromise + this.loadMapConfig().then((mapConfig) => { + if (mapConfig && this.map) { + loadPromise = this.loadDataCenterMapData() + } + }) + return loadPromise + }, 500) }, loadMapConfig () { const vm = this @@ -65,7 +72,8 @@ export default { this.map.remove() this.map = null } - const mapId = 'map' + this.chartInfo.id + console.log(1212) + const mapId = document.getElementById('map' + this.chartInfo.id) const map = L.map(mapId, { minZoom: mapConfig.minZoom, maxZoom: mapConfig.maxZoom, @@ -223,7 +231,11 @@ export default { } }, beforeDestroy () { - // this.map.remove() + if (this.timer) { + clearTimeout(this.timer) + this.timer = null + } + this.map && this.map.remove() this.map = null } } diff --git a/nezha-fronted/src/components/chart/chartMixin.js b/nezha-fronted/src/components/chart/chartMixin.js index 2f40b6b0b..1c3bac371 100644 --- a/nezha-fronted/src/components/chart/chartMixin.js +++ b/nezha-fronted/src/components/chart/chartMixin.js @@ -82,10 +82,10 @@ export default { if (legend.endsWith(',')) { legend = legend.substr(0, legend.length - 1) } - if (data.metric.__name__) { - legend += '}' - } }) + if (data.metric.__name__) { + legend += '}' + } if (!legend) { legend = chartInfo.elements[expressionIndex].expression } diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue b/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue index c1ffb3c24..216bbd517 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue @@ -770,8 +770,8 @@ export default { thresholds: [], enable: { legend: true, - valueMapping: true, - thresholds: true + valueMapping: false, + thresholds: false }, } this.$nextTick(() => { @@ -793,8 +793,8 @@ export default { valueMapping: [], enable: { legend: true, - valueMapping: true, - thresholds: true + valueMapping: false, + thresholds: false } } break @@ -811,8 +811,8 @@ export default { valueMapping: [], enable: { legend: true, - valueMapping: true, - thresholds: true + valueMapping: false, + thresholds: false } } break diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue index 1ae55f8ac..3573c95b9 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue @@ -246,9 +246,9 @@ export default { nullType: 'null', legend: { placement: 'bottom', values: [] }, enable: { - thresholds: true, + thresholds: false, legend: true, - valueMapping: true + valueMapping: false }, thresholds: [{ value: undefined, color: '#eeeeeeff' }] } @@ -262,9 +262,9 @@ export default { unit: 2, type: 'log', enable: { - thresholds: true, + thresholds: false, legend: true, - valueMapping: true + valueMapping: false }, elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A' }], param: { @@ -284,9 +284,9 @@ export default { nullType: 'null', statistics: 'last', enable: { - thresholds: true, + thresholds: false, legend: true, - valueMapping: true + valueMapping: false }, datasource: [{ name: 'System', @@ -311,9 +311,9 @@ export default { height: 4, type: 'url', enable: { - thresholds: true, + thresholds: false, legend: true, - valueMapping: true + valueMapping: false }, param: { url: '' diff --git a/nezha-fronted/src/components/common/rightBox/chart/systemChartConfig.vue b/nezha-fronted/src/components/common/rightBox/chart/systemChartConfig.vue index 3fa7341ab..965a9dfb0 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/systemChartConfig.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/systemChartConfig.vue @@ -8,7 +8,22 @@ label-width="120px" >