fix: 实体代码整理
This commit is contained in:
@@ -192,6 +192,12 @@ export const dnsServerRole = {
|
|||||||
RTDNSM: 'RTDNSM'
|
RTDNSM: 'RTDNSM'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const performanceMetricMapping = {
|
||||||
|
'dns error': 'DNS Error Rate',
|
||||||
|
'http error': 'HTTP Error Rate',
|
||||||
|
'high dns response time': 'DNS Response Latency'
|
||||||
|
}
|
||||||
|
|
||||||
export const chartColor = ['#5370C6', '#90CC74', '#FAC858', '#EE6666',
|
export const chartColor = ['#5370C6', '#90CC74', '#FAC858', '#EE6666',
|
||||||
'#73BFDE', '#3BA172', '#FC8452', '#9960B4',
|
'#73BFDE', '#3BA172', '#FC8452', '#9960B4',
|
||||||
'#E97CCC', '#FEA69E', '#0F8AB2', '#57CBAC',
|
'#E97CCC', '#FEA69E', '#0F8AB2', '#57CBAC',
|
||||||
|
|||||||
@@ -88,9 +88,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { eventSeverityColor } from '@/utils/constants'
|
import { eventSeverityColor, unitTypes } from '@/utils/constants'
|
||||||
import { api, getData } from '@/utils/api'
|
import { api, getData } from '@/utils/api'
|
||||||
import { unitTypes } from '@/utils/constants'
|
|
||||||
import { getSecond } from '@/utils/date-util'
|
import { getSecond } from '@/utils/date-util'
|
||||||
import { get } from '@/utils/http'
|
import { get } from '@/utils/http'
|
||||||
import * as echarts from 'echarts'
|
import * as echarts from 'echarts'
|
||||||
@@ -106,7 +105,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
eventSeverityColor,
|
eventSeverityColor,
|
||||||
basicInfo: {},
|
basicInfo: {},
|
||||||
metricList:[],
|
metricList: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -142,12 +141,12 @@ export default {
|
|||||||
if (this.metricList.length > 0) {
|
if (this.metricList.length > 0) {
|
||||||
this.initChart()
|
this.initChart()
|
||||||
} else {
|
} else {
|
||||||
let chartDom = document.getElementById(`detectionMetricChartApp${this.detection.appName}`)
|
const chartDom = document.getElementById(`detectionMetricChartApp${this.detection.appName}`)
|
||||||
chartDom.innerHTML = '<span style="padding-left:5px;">-</span>'
|
chartDom.innerHTML = '<span style="padding-left:5px;">-</span>'
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
let chartDom = document.getElementById(`detectionMetricChartApp${this.detection.appName}`)
|
const chartDom = document.getElementById(`detectionMetricChartApp${this.detection.appName}`)
|
||||||
chartDom.innerHTML = '<span style="padding-left:5px;">-</span>'
|
chartDom.innerHTML = '<span style="padding-left:5px;">-</span>'
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -166,12 +165,12 @@ export default {
|
|||||||
|
|
||||||
this.metricList.sort(reverseSortBy(0))// 将返回的数据按时间降序排序,方便找到实线和虚线的交点
|
this.metricList.sort(reverseSortBy(0))// 将返回的数据按时间降序排序,方便找到实线和虚线的交点
|
||||||
// let endIndex = (this.metricList). findIndex ((item) => item[0] <= 1435781434781 );
|
// let endIndex = (this.metricList). findIndex ((item) => item[0] <= 1435781434781 );
|
||||||
let endIndex = (this.metricList). findIndex ((item) => item[0] <= this.detection.endTime );
|
let endIndex = (this.metricList).findIndex((item) => item[0] <= this.detection.endTime)
|
||||||
endIndex = this.metricList.length - endIndex
|
endIndex = this.metricList.length - endIndex
|
||||||
|
|
||||||
this.metricList.sort(sortBy(0))// 将返回的数据按时间升序排序,方便找到实线和虚线的交点
|
this.metricList.sort(sortBy(0))// 将返回的数据按时间升序排序,方便找到实线和虚线的交点
|
||||||
// let startIndex = (this.metricList). findIndex ((item) => item[0] >= 1435781432781 );
|
// let startIndex = (this.metricList). findIndex ((item) => item[0] >= 1435781432781 );
|
||||||
let startIndex = (this.metricList). findIndex ((item) => item[0] >= this.detection.startTime );
|
const startIndex = (this.metricList).findIndex((item) => item[0] >= this.detection.startTime)
|
||||||
|
|
||||||
if (startIndex > -1 && endIndex > -1) {
|
if (startIndex > -1 && endIndex > -1) {
|
||||||
this.chartOptionMetric.series[0].data = this.metricList.slice(0, startIndex).map(v => [Number(v[0]) * 1000, Number(v[1]), unitTypes.number])
|
this.chartOptionMetric.series[0].data = this.metricList.slice(0, startIndex).map(v => [Number(v[0]) * 1000, Number(v[1]), unitTypes.number])
|
||||||
@@ -185,8 +184,8 @@ export default {
|
|||||||
queryMetric () {
|
queryMetric () {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
let allTime = this.detection.endTime-this.detection.startTime
|
const allTime = this.detection.endTime - this.detection.startTime
|
||||||
let nowTime = getSecond(new Date())
|
const nowTime = getSecond(new Date())
|
||||||
this.searchStartTime = this.detection.startTime - allTime / 2
|
this.searchStartTime = this.detection.startTime - allTime / 2
|
||||||
this.searchEndTime = _.min([nowTime, (this.detection.endTime + allTime / 2)])
|
this.searchEndTime = _.min([nowTime, (this.detection.endTime + allTime / 2)])
|
||||||
|
|
||||||
@@ -237,8 +236,8 @@ export default {
|
|||||||
},
|
},
|
||||||
setup () {
|
setup () {
|
||||||
return {
|
return {
|
||||||
chartOption: metricOption,
|
chartOption: metricOption
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user