diff --git a/nezha-fronted/src/components/chart/chart.vue b/nezha-fronted/src/components/chart/chart.vue index 268f9a745..90a146ef5 100644 --- a/nezha-fronted/src/components/chart/chart.vue +++ b/nezha-fronted/src/components/chart/chart.vue @@ -115,6 +115,14 @@ :chart-option="chartOption" :is-fullscreen="isFullscreen" > + - +
+ + + + + + +
diff --git a/nezha-fronted/src/components/chart/chart/tools.js b/nezha-fronted/src/components/chart/chart/tools.js index b61ac7d1e..3b87e3343 100644 --- a/nezha-fronted/src/components/chart/chart/tools.js +++ b/nezha-fronted/src/components/chart/chart/tools.js @@ -94,7 +94,9 @@ export function isEndpointInfo (type) { export function isMap (type) { return type === chartType.map } - +export function isTable (type) { + return type === chartType.table +} export function getGroupHeight (arr) { if (arr.length) { let lastItem = [] diff --git a/nezha-fronted/src/components/chart/panelChart.vue b/nezha-fronted/src/components/chart/panelChart.vue index 3bb8c6ecb..771dce0e7 100644 --- a/nezha-fronted/src/components/chart/panelChart.vue +++ b/nezha-fronted/src/components/chart/panelChart.vue @@ -153,7 +153,6 @@ export default { }) } if (this.chartInfo.type === 'diagram') { - this.chartInfo.type = 'map' this.chartData = [this.chartInfo.param.topo] if (!this.chartInfo.param.topo || !this.chartInfo.param.topo.pens.length){ this.chartData = [] diff --git a/nezha-fronted/src/components/common/js/tools.js b/nezha-fronted/src/components/common/js/tools.js index 4d6eddc74..a8cd74bf7 100644 --- a/nezha-fronted/src/components/common/js/tools.js +++ b/nezha-fronted/src/components/common/js/tools.js @@ -830,6 +830,16 @@ export function getMetricTypeValue (queryItem, type) { const total = eval(copy.join('+')) return total } + case 'range': { + const min = copy.sort((x, y) => { return parseFloat(x[1]) - parseFloat(y[1]) })[0][1] + const max = copy.sort((x, y) => { return parseFloat(y[1]) - parseFloat(x[1]) })[0][1] + return max - min + } + case 'different': { + const last = copy.sort((x, y) => { return parseFloat(y[0]) - parseFloat(x[0]) })[0][1] + const first = copy.sort((x, y) => { return parseFloat(y[0]) - parseFloat(x[0]) })[copy.length - 1][1] + return last - first + } } } diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue b/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue index b5291ab26..db139d1dd 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue @@ -163,7 +163,7 @@ prop="param.index" >
- {{$t('dashboard.panel.chartForm.valueMapping')}} + {{$t('dashboard.panel.chartForm.columns')}}
@@ -680,6 +680,7 @@ export default { rules: { }, oldType: '', + tag: '', promqlType: 'log', chartTypeList: [ { diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue index 979cbf053..9f0931f62 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue @@ -171,6 +171,7 @@ export default { } delete params.panel if (params.type === 'table') { + console.log(params.param.tags) delete params.param.tags } if (params.id) { // 修改 @@ -271,12 +272,12 @@ export default { unit: 2, type: 'stat', param: { - refer: 1, + refer: 0, system: '', systemGroup: '', systemSelect: '', sort: 'desc', - limit: undefined, + limit: 100, nullType: 'null', statistics: 'last', valueMapping: { diff --git a/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js b/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js index 85127af00..9c5f7c384 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js +++ b/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js @@ -392,7 +392,10 @@ export default { this.chartConfig.param.columns[index].show = !this.chartConfig.param.columns[index].show }, tagsChange (newTags) { - // this.chartConfig.param.indexs = newTags.map(item => item.text) + console.log(newTags, newTags) + this.chartConfig.param.tags = newTags + this.chartConfig.param.indexs = newTags.map(item => item.text).join(',') + this.change() } } } diff --git a/nezha-fronted/src/components/common/rightBox/chart/systemChartConfig.vue b/nezha-fronted/src/components/common/rightBox/chart/systemChartConfig.vue index 17d577ac9..b3161a517 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/systemChartConfig.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/systemChartConfig.vue @@ -124,6 +124,21 @@ + + + +
@@ -324,11 +339,11 @@
- {{$t('dashboard.panel.chartForm.valueMapping')}} + {{$t('dashboard.panel.chartForm.columns')}}
- + @@ -353,7 +368,7 @@
Title
- +
@@ -372,7 +387,7 @@
Display
- + @@ -404,6 +419,7 @@ export default { groupList: [], selectList: [], oldType: '', + tag: '', chartTypeList: [ { id: 'stat', @@ -478,17 +494,34 @@ export default { if (this.oldType !== 'table') { break } - this.chartConfig.param.valueMapping = { - show: true, - mapping: [] + this.chartConfig.param = { + refer: 1, + system: '', + systemGroup: '', + systemSelect: '', + sort: 'desc', + limit: 100, + nullType: 'null', + statistics: 'last', + valueMapping: { + show: true, + mapping: [] + } } - this.chartConfig.param.refer = 0 - delete this.chartConfig.param.columns break case 'table': - this.chartConfig.param.columns = [] - this.chartConfig.param.refer = 0 - delete this.chartConfig.param.valueMapping + this.chartConfig.param = { + refer: 1, + system: '', + systemGroup: '', + systemSelect: '', + indexs: '', + sort: 'desc', + limit: 100, + nullType: 'null', + statistics: 'last', + columns: [] + } break } this.oldType = type diff --git a/nezha-fronted/src/components/page/dashboard/panel.vue b/nezha-fronted/src/components/page/dashboard/panel.vue index b9db70b96..f23646b22 100644 --- a/nezha-fronted/src/components/page/dashboard/panel.vue +++ b/nezha-fronted/src/components/page/dashboard/panel.vue @@ -416,7 +416,13 @@ export default { this.chart.groupId = '' } if (this.chart.type == 'table') { - this.chart.param.tags = this.chart.param.indexs ? this.chart.param.indexs.split(',') : [] + const arr = this.chart.param.indexs ? this.chart.param.indexs.split(',') : [] + this.chart.param.tags = arr.map((item) => { + return { + text: item, + tiClasses: ['ti-valid'] + } + }) } } else { this.$message.error(res.msg)