CN-465 fix: npm单值图问题修复

This commit is contained in:
chenjinsong
2022-04-07 14:53:13 +08:00
parent 429ca0653f
commit 051af32d6e
4 changed files with 26 additions and 37 deletions

View File

@@ -244,12 +244,12 @@ export default {
if (chartParams && chartParams.dataKey) { if (chartParams && chartParams.dataKey) {
if (response.data.result && (response.data.result[chartParams.dataKey] || response.data.result[chartParams.dataKey] === 0)) { if (response.data.result && (response.data.result[chartParams.dataKey] || response.data.result[chartParams.dataKey] === 0)) {
this.chartData = response.data.result[chartParams.dataKey] this.chartData = response.data.result[chartParams.dataKey]
} else if (response.data.result && (response.data.result[chartParams.dataKey + 'Avg'] || response.data.result[chartParams.dataKey + 'Avg'] === 0)) { } else if (response.data.result && (response.data.result[chartParams.dataKey + 'Value'] || response.data.result[chartParams.dataKey + 'Value'] === 0)) {
this.chartData = [{ this.chartData = {
value: response.data.result[chartParams.dataKey + 'Avg'], value: response.data.result[chartParams.dataKey + 'Value'],
p50: response.data.result[chartParams.dataKey + 'P50'], p50: response.data.result[chartParams.dataKey + 'P50'],
p90: response.data.result[chartParams.dataKey + 'P90'] p90: response.data.result[chartParams.dataKey + 'P90']
}] }
} else { } else {
this.chartData = null this.chartData = null
} }

View File

@@ -270,23 +270,15 @@ export default {
this.color = n.params.color this.color = n.params.color
this.type = n.type this.type = n.type
} }
},
chartData: {
deep: true,
handler (n) {
if (this.chartData && this.chartData.length > 0) {
// this.handleSingleValue()
}
}
} }
}, },
computed: { computed: {
handleSingleValue () { handleSingleValue () {
let value = null let value = null
if (this.type === 506 || this.type === 507) { if (this.isSingleValueWithPercentileLeft(this.chartInfo.type) || this.isSingleValueWithPercentileRight(this.chartInfo.type)) {
value = this.chartData && (this.chartData.value || this.chartData.value === 0) ? this.chartData.value : '' value = (this.chartData && (this.chartData.value || this.chartData.value === 0)) ? this.chartData.value : ''
} else { } else {
value = this.$_.isEmpty(this.chartData) || this.$_.get(this, 'chartData') value = (this.chartData || this.chartData === 0)
? this.chartData ? this.chartData
: '' : ''
} }
@@ -296,7 +288,7 @@ export default {
let p50 = '' let p50 = ''
let p90 = '' let p90 = ''
if (this.type === 506 || this.type === 507) { if (this.isSingleValueWithPercentileLeft(this.chartInfo.type) || this.isSingleValueWithPercentileRight(this.chartInfo.type)) {
p50 = this.chartData ? unitConvert(this.chartData.p50, unitType) : '' p50 = this.chartData ? unitConvert(this.chartData.p50, unitType) : ''
p90 = this.chartData ? unitConvert(this.chartData.p90, unitType) : '' p90 = this.chartData ? unitConvert(this.chartData.p90, unitType) : ''
} }

View File

@@ -137,7 +137,6 @@ export default {
queryDetection () { queryDetection () {
get(this.entityDetectionsIpUrl, this.queryParams).then(response => { get(this.entityDetectionsIpUrl, this.queryParams).then(response => {
if (response.code === 200) { if (response.code === 200) {
console.log(response)
this.detectionsData = response.data.result this.detectionsData = response.data.result
} }
}) })

View File

@@ -148,58 +148,56 @@ export default {
if (this.networkQuantityUrl) { if (this.networkQuantityUrl) {
get(this.networkQuantityUrl, this.getQueryParams()).then(response => { get(this.networkQuantityUrl, this.getQueryParams()).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.entityData.establishLatencyAvg = response.data.result.establishLatencyAvg this.entityData.establishLatencyValue = response.data.result.establishLatencyValue
this.entityData.establishLatencyP50 = response.data.result.establishLatencyP50 this.entityData.establishLatencyP50 = response.data.result.establishLatencyP50
this.entityData.establishLatencyP90 = response.data.result.establishLatencyP90 this.entityData.establishLatencyP90 = response.data.result.establishLatencyP90
this.entityData.httpResponseLantencyAvg = response.data.result.httpResponseLantencyAvg this.entityData.httpResponseLantencyValue = response.data.result.httpResponseLantencyValue
this.entityData.httpResponseLantencyP50 = response.data.result.httpResponseLantencyP50 this.entityData.httpResponseLantencyP50 = response.data.result.httpResponseLantencyP50
this.entityData.httpResponseLantencyP90 = response.data.result.httpResponseLantencyP90 this.entityData.httpResponseLantencyP90 = response.data.result.httpResponseLantencyP90
this.entityData.sslConLatencyAvg = response.data.result.sslConLatencyAvg this.entityData.sslConLatencyValue = response.data.result.sslConLatencyValue
this.entityData.sslConLatencyP50 = response.data.result.sslConLatencyP50 this.entityData.sslConLatencyP50 = response.data.result.sslConLatencyP50
this.entityData.sslConLatencyP90 = response.data.result.sslConLatencyP90 this.entityData.sslConLatencyP90 = response.data.result.sslConLatencyP90
this.entityData.sequenceGapLossAvg = response.data.result.sequenceGapLossAvg this.entityData.sequenceGapLossPercentValue = response.data.result.sequenceGapLossPercentValue
this.entityData.sequenceGapLossP50 = response.data.result.sequenceGapLossP50 this.entityData.sequenceGapLossPercentP50 = response.data.result.sequenceGapLossPercentP50
this.entityData.sequenceGapLossP90 = response.data.result.sequenceGapLossP90 this.entityData.sequenceGapLossPercentP90 = response.data.result.sequenceGapLossPercentP90
this.entityData.pktRetransAvg = response.data.result.pktRetransAvg this.entityData.pktRetransPercentValue = response.data.result.pktRetransPercentValue
this.entityData.pktRetransP50 = response.data.result.pktRetransP50 this.entityData.pktRetransPercentP50 = response.data.result.pktRetransPercentP50
this.entityData.pktRetransP90 = response.data.result.pktRetransP90 this.entityData.pktRetransPercentP90 = response.data.result.pktRetransPercentP90
const establishLatency = { const establishLatency = {
value: this.entityData.establishLatencyAvg, value: this.entityData.establishLatencyValue,
p50: this.entityData.establishLatencyP50, p50: this.entityData.establishLatencyP50,
p90: this.entityData.establishLatencyP90 p90: this.entityData.establishLatencyP90
} }
this.singleValues.chartDatas.splice(0, 1, establishLatency) this.singleValues.chartDatas.splice(0, 1, establishLatency)
const httpResponseLatency = { const httpResponseLatency = {
value: this.entityData.httpResponseLantencyAvg, value: this.entityData.httpResponseLantencyValue,
p50: this.entityData.httpResponseLantencyP50, p50: this.entityData.httpResponseLantencyP50,
p90: this.entityData.httpResponseLantencyP90 p90: this.entityData.httpResponseLantencyP90
} }
this.singleValues.chartDatas.splice(1, 1, httpResponseLatency) this.singleValues.chartDatas.splice(1, 1, httpResponseLatency)
const sslConLatency = { const sslConLatency = {
value: this.entityData.sslConLatencyAvg, value: this.entityData.sslConLatencyValue,
p50: this.entityData.sslConLatencyP50, p50: this.entityData.sslConLatencyP50,
p90: this.entityData.sslConLatencyP90 p90: this.entityData.sslConLatencyP90
} }
this.singleValues.chartDatas.splice(2, 1, sslConLatency) this.singleValues.chartDatas.splice(2, 1, sslConLatency)
const sequenceGapLoss = { const sequenceGapLoss = {
value: this.entityData.sequenceGapLossAvg, value: this.entityData.sequenceGapLossPercentValue,
p50: this.entityData.sequenceGapLossP50, p50: this.entityData.sequenceGapLossPercentP50,
p90: this.entityData.sequenceGapLossP90 p90: this.entityData.sequenceGapLossPercentP90
} }
this.singleValues.chartDatas.splice(3, 1, sequenceGapLoss) this.singleValues.chartDatas.splice(3, 1, sequenceGapLoss)
const pktRetransPercent = { const pktRetransPercent = {
value: this.entityData.pktRetransAvg, value: this.entityData.pktRetransPercentValue,
p50: this.entityData.pktRetransP50, p50: this.entityData.pktRetransPercentP50,
p90: this.entityData.pktRetransP90 p90: this.entityData.pktRetransPercentP90
} }
this.singleValues.chartDatas.splice(4, 1, pktRetransPercent) this.singleValues.chartDatas.splice(4, 1, pktRetransPercent)
console.log(this.singleValues.chartDatas)
} }
}) })
} }