fix: 修改 nullType 二次转码的问题
This commit is contained in:
@@ -734,7 +734,7 @@ export default {
|
||||
this.$nextTick(() => {
|
||||
const axiosArr = chartItem.elements.map((ele) => {
|
||||
const filterItem = ele
|
||||
let query = filterItem.expression
|
||||
let query = escape(filterItem.expression)
|
||||
if ((chartInfo.type === 'line' || chartInfo.type === 'bar' || chartInfo.type === 'stackArea' || chartInfo.type === 'table') && chartInfo.param) { // 如果是这三个 默认给null
|
||||
chartInfo.param.nullType = chartInfo.param.nullType || 'null'
|
||||
query += '&nullType=' + chartInfo.param.nullType
|
||||
@@ -749,7 +749,7 @@ export default {
|
||||
if (chartInfo.type == 'logs') {
|
||||
return chartTempData
|
||||
}
|
||||
return this.$get('/prom/api/v1/query_range?query=' + escape(query) + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)
|
||||
return this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)
|
||||
})
|
||||
// 一个图表的所有element单独获取数据
|
||||
axios.all(axiosArr).then((res) => {
|
||||
@@ -1227,12 +1227,12 @@ export default {
|
||||
const endTime = bus.timeFormate(now, 'yyyy-MM-dd hh:mm:ss')
|
||||
// const step = bus.getStep(startTime, endTime)
|
||||
this.$nextTick(() => {
|
||||
let query = chartInfo.elements[0].expression
|
||||
let query = escape(chartInfo.elements[0].expression)
|
||||
if ((chartInfo.type === 'line' || chartInfo.type === 'bar' || chartInfo.type === 'stackArea') && chartInfo.param) {
|
||||
chartInfo.param.nullType = chartInfo.param.nullType || 'null'
|
||||
query += '&nullType=' + chartInfo.param.nullType
|
||||
}
|
||||
this.$get('/prom/api/v1/query_range?query=' + escape(query) + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=5m').then(response => {
|
||||
this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=5m').then(response => {
|
||||
if (response.status === 'success') {
|
||||
if (response.data.result) {
|
||||
const series = {
|
||||
|
||||
@@ -1004,7 +1004,7 @@ export default {
|
||||
this.$nextTick(() => {
|
||||
const axiosArr = chartItem.elements.map((ele) => {
|
||||
const filterItem = ele
|
||||
let query = filterItem.expression
|
||||
let query = escape(filterItem.expression)
|
||||
if ((chartInfo.type === 'line' || chartInfo.type === 'bar' || chartInfo.type === 'stackArea' || chartInfo.type === 'table') && chartInfo.param) { // 如果是这三个 默认给null
|
||||
chartInfo.param.nullType = chartInfo.param.nullType || 'null'
|
||||
query += '&nullType=' + chartInfo.param.nullType
|
||||
@@ -1018,7 +1018,7 @@ export default {
|
||||
if (chartInfo.type == 'logs') {
|
||||
return chartTempData
|
||||
}
|
||||
return this.$get('/prom/api/v1/query_range?query=' + escape(query) + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)
|
||||
return this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)
|
||||
})
|
||||
// 一个图表的所有element单独获取数据
|
||||
axios.all(axiosArr).then((res) => {
|
||||
|
||||
@@ -418,7 +418,7 @@ export default {
|
||||
this.$nextTick(() => {
|
||||
const axiosArr = chartItem.elements.map((ele) => {
|
||||
const filterItem = ele
|
||||
const query = filterItem.expression
|
||||
const query = escape(filterItem.expression)
|
||||
// if(chartItem.type === 'table'&&chartItem.param&&chartItem.param.last == 1){
|
||||
// return this.$get('/prom/api/v1/query_range?query=' + query + "&start=" + this.$stringTimeParseToUnix(endTime) + "&end=" + this.$stringTimeParseToUnix(endTime) + '&step=' + step);
|
||||
// }
|
||||
@@ -427,7 +427,7 @@ export default {
|
||||
chartItem.param.nullType = chartItem.param.nullType || 'null'
|
||||
str += '&nullType=' + chartItem.param.nullType
|
||||
}
|
||||
return this.$get('/prom/api/v1/query_range?query=' + escape(query) + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step + str)
|
||||
return this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step + str)
|
||||
})
|
||||
// 一个图表的所有element单独获取数据
|
||||
axios.all(axiosArr).then((res) => {
|
||||
@@ -1662,16 +1662,16 @@ export default {
|
||||
const step = bus.getStep(startTime, endTime)
|
||||
axiosArr = this.chart.elements.map((ele) => {
|
||||
const filterItem = ele
|
||||
const query = filterItem.expression
|
||||
const query = escape(filterItem.expression)
|
||||
let str = ''
|
||||
if ((chartItem.type === 'line' || chartItem.type === 'bar' || chartItem.type === 'stackArea' || chartItem.type === 'table') && chartItem.param) { // 如果是这三个 默认给null
|
||||
chartItem.param.nullType = chartItem.param.nullType || 'null'
|
||||
str += '&nullType=' + chartItem.param.nullType
|
||||
}
|
||||
if (chartItem.type === 'table' && chartItem.param && chartItem.param.last == 1) {
|
||||
return this.$get('/prom/api/v1/query_range?query=' + escape(query) + '&start=' + this.$stringTimeParseToUnix(endTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step + str)
|
||||
return this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(endTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step + str)
|
||||
}
|
||||
return this.$get('/prom/api/v1/query_range?query=' + escape(query) + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step + str)
|
||||
return this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step + str)
|
||||
})
|
||||
// 一个图表
|
||||
axios.all(axiosArr).then(res => {
|
||||
|
||||
@@ -1645,44 +1645,44 @@ export default {
|
||||
if (type === 'list') { // 普通模式,主控台使用
|
||||
axiosArr = this.data.elements.map((ele) => {
|
||||
const filterItem = ele
|
||||
let query = filterItem.expression
|
||||
let query = escape(filterItem.expression)
|
||||
if (this.chartInfo.type === 'line' || this.chartInfo.type === 'bar' || this.chartInfo.type === 'stackArea') { // 如果是这三个 默认给null
|
||||
!this.chartInfo.param && (this.chartInfo.param = {})
|
||||
this.chartInfo.param.nullType = this.chartInfo.param.nullType || 'null'
|
||||
query += '&nullType=' + this.chartInfo.param.nullType
|
||||
}
|
||||
return this.$get('/prom/api/v1/query_range?query=' + escape(query) + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)
|
||||
return this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)
|
||||
})
|
||||
if (this.$refs.pickTime.$refs.multipleTime && this.$refs.pickTime.$refs.multipleTime.searchTime.length) { // 判断是否需要添加比较
|
||||
startTime = bus.timeFormate(this.$refs.pickTime.$refs.multipleTime.searchTime[0], 'yyyy-MM-dd hh:mm:ss')
|
||||
endTime = bus.timeFormate(this.$refs.pickTime.$refs.multipleTime.searchTime[1], 'yyyy-MM-dd hh:mm:ss')
|
||||
this.data.elements.forEach((ele) => {
|
||||
const filterItem = ele
|
||||
let query = filterItem.expression
|
||||
let query = escape(filterItem.expression)
|
||||
if (this.chartInfo.type === 'line' || this.chartInfo.type === 'bar' || this.chartInfo.type === 'stackArea') { // 如果是这三个 默认给null
|
||||
!this.chartInfo.param && (this.chartInfo.param = {})
|
||||
this.chartInfo.param.nullType = this.chartInfo.param.nullType || 'null'
|
||||
query += '&nullType=' + this.chartInfo.param.nullType
|
||||
}
|
||||
axiosArr.push(this.$get('/prom/api/v1/query_range?query=' + escape(query) + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step))
|
||||
axiosArr.push(this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step))
|
||||
})
|
||||
}
|
||||
} else if (type === 'dashboard') { // 概览模式,指标概览中使用
|
||||
// 概览模式,需要区分单独一个和多个
|
||||
if (this.stableFilter.chartCount === 'multiple') {
|
||||
let query = this.data.name
|
||||
let query = escape(this.data.name)
|
||||
if (this.chartInfo.type === 'line' || this.chartInfo.type === 'bar' || this.chartInfo.type === 'stackArea') { // 如果是这三个 默认给null
|
||||
this.chartInfo.param.nullType = this.chartInfo.param.nullType || 'null'
|
||||
query += '&nullType=' + this.chartInfo.param.nullType
|
||||
}
|
||||
axiosArr = [this.$get('/prom/api/v1/query_range?query=' + escape(query) + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)]
|
||||
axiosArr = [this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)]
|
||||
} else {
|
||||
let query = this.data.elements[0].expression
|
||||
let query = escape(this.data.elements[0].expression)
|
||||
if (this.chartInfo.type === 'line' || this.chartInfo.type === 'bar' || this.chartInfo.type === 'stackArea') { // 如果是这三个 默认给null
|
||||
this.chartInfo.param.nullType = this.chartInfo.param.nullType || 'null'
|
||||
query += '&nullType=' + this.chartInfo.param.nullType
|
||||
}
|
||||
axiosArr = [this.$get('/prom/api/v1/query_range?query=' + escape(query) + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)]
|
||||
axiosArr = [this.$get('/prom/api/v1/query_range?query=' + query+ '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)]
|
||||
}
|
||||
}
|
||||
// 一个图表
|
||||
|
||||
@@ -681,8 +681,9 @@ export default {
|
||||
resolve({ data: '', status: 'no query' })
|
||||
})
|
||||
}
|
||||
query = escape(query)
|
||||
query += '&nullType=' + 'null'
|
||||
return this.$get('/prom/api/v1/query_range?query=' + escape(query) + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)
|
||||
return this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)
|
||||
})
|
||||
}
|
||||
axiosArr.push({ item, arr })
|
||||
|
||||
@@ -137,7 +137,7 @@ export default {
|
||||
this.$nextTick(() => {
|
||||
const axiosArr = chartItem.elements.map((ele) => {
|
||||
const filterItem = ele
|
||||
let query = filterItem.expression
|
||||
let query = escape(filterItem.expression)
|
||||
if ((chartInfo.type === 'line' || chartInfo.type === 'bar' || chartInfo.type === 'stackArea' || chartInfo.type === 'table') && chartInfo.param) { // 如果是这三个 默认给null
|
||||
chartInfo.param.nullType = chartInfo.param.nullType || 'null'
|
||||
query += '&nullType=' + chartInfo.param.nullType
|
||||
@@ -148,7 +148,7 @@ export default {
|
||||
if (this.from === fromRoute.chartTemp) {
|
||||
return chartTempData
|
||||
}
|
||||
return this.$get('/prom/api/v1/query_range?query=' + escape(query) + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)
|
||||
return this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)
|
||||
})
|
||||
// 一个图表的所有element单独获取数据
|
||||
axios.all(axiosArr).then((res) => {
|
||||
|
||||
@@ -686,8 +686,9 @@ export default {
|
||||
resolve({ data: '', status: 'no query' })
|
||||
})
|
||||
}
|
||||
query = escape(query)
|
||||
query += '&nullType=' + 'null'
|
||||
return this.$get('/prom/api/v1/query_range?query=' + escape(query) + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)
|
||||
return this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)
|
||||
})
|
||||
}
|
||||
axiosArr.push({ item, arr })
|
||||
|
||||
Reference in New Issue
Block a user