feat: npm 第三级下钻分数计算
This commit is contained in:
@@ -49,6 +49,7 @@ const panel = {
|
|||||||
networkOverviewTabList: [], // 存储tab列表的一些状态:如是否选中
|
networkOverviewTabList: [], // 存储tab列表的一些状态:如是否选中
|
||||||
tabOperationType: 0, // 操作类型:2-二级菜单;3-三级菜单;4-四级菜单;5-切换tab;6-切换metric;7-操作Customize
|
tabOperationType: 0, // 操作类型:2-二级菜单;3-三级菜单;4-四级菜单;5-切换tab;6-切换metric;7-操作Customize
|
||||||
tabOperationBeforeType: 0, // 记录上次的操作类型
|
tabOperationBeforeType: 0, // 记录上次的操作类型
|
||||||
|
npmThirdLevelMenuScore: null, // npm overview 第三级菜单的panel分数
|
||||||
npmLocationCountry: '', // npm location的查询条件--国家
|
npmLocationCountry: '', // npm location的查询条件--国家
|
||||||
npmLocationSide: 'server' // npm location的查询条件--方向
|
npmLocationSide: 'server' // npm location的查询条件--方向
|
||||||
},
|
},
|
||||||
@@ -139,6 +140,9 @@ const panel = {
|
|||||||
},
|
},
|
||||||
setNpmLocationSide (state, side) {
|
setNpmLocationSide (state, side) {
|
||||||
state.npmLocationSide = side
|
state.npmLocationSide = side
|
||||||
|
},
|
||||||
|
setNpmThirdLevelMenuScore (state, score) {
|
||||||
|
state.npmThirdLevelMenuScore = score
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
@@ -222,6 +226,9 @@ const panel = {
|
|||||||
},
|
},
|
||||||
getNpmLocationSide (state) {
|
getNpmLocationSide (state) {
|
||||||
return state.npmLocationSide
|
return state.npmLocationSide
|
||||||
|
},
|
||||||
|
getNpmThirdLevelMenuScore (state) {
|
||||||
|
return state.npmThirdLevelMenuScore
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { getSecond } from '@/utils/date-util'
|
|||||||
import { api } from '@/utils/api'
|
import { api } from '@/utils/api'
|
||||||
import chartMixin from '@/views/charts2/chart-mixin'
|
import chartMixin from '@/views/charts2/chart-mixin'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import { getChainRatio } from '@/utils/tools'
|
import { computeScore, getChainRatio } from '@/utils/tools'
|
||||||
export default {
|
export default {
|
||||||
name: 'NpmNetworkQuantity',
|
name: 'NpmNetworkQuantity',
|
||||||
components: { SingleValue },
|
components: { SingleValue },
|
||||||
@@ -93,12 +93,37 @@ export default {
|
|||||||
const packetPercent = get(api.npm.overview.packetRetransPercent, params)
|
const packetPercent = get(api.npm.overview.packetRetransPercent, params)
|
||||||
this.toggleLoading(true)
|
this.toggleLoading(true)
|
||||||
Promise.all([tcp, http, ssl, tcpPercent, packetPercent]).then(res => {
|
Promise.all([tcp, http, ssl, tcpPercent, packetPercent]).then(res => {
|
||||||
res.forEach(t => {
|
const keyPre = ['tcp', 'http', 'ssl', 'tcpLost', 'packetRetrans']
|
||||||
|
const scoreInfo = {}
|
||||||
|
res.forEach((t, i) => {
|
||||||
if (t.code === 200) {
|
if (t.code === 200) {
|
||||||
|
if (t.data.result.establishLatencyAvg || t.data.result.establishLatencyAvg === 0) {
|
||||||
|
t.data.result.establishLatencyMs = t.data.result.establishLatencyAvg
|
||||||
|
}
|
||||||
|
if (t.data.result.httpResponseLatencyAvg || t.data.result.httpResponseLatencyAvg === 0) {
|
||||||
|
t.data.result.httpResponseLatency = t.data.result.httpResponseLatencyAvg
|
||||||
|
}
|
||||||
|
if (t.data.result.sequenceGapLossAvg || t.data.result.sequenceGapLossAvg === 0) {
|
||||||
|
t.data.result.tcpLostlenPercent = t.data.result.sequenceGapLossAvg
|
||||||
|
}
|
||||||
|
if (t.data.result.pktRetransAvg || t.data.result.pktRetransAvg === 0) {
|
||||||
|
t.data.result.pktRetransPercent = t.data.result.pktRetransAvg
|
||||||
|
}
|
||||||
|
if (t.data.result.sslConLatencyAvg || t.data.result.sslConLatencyAvg === 0) {
|
||||||
|
t.data.result.sslConLatency = t.data.result.sslConLatencyAvg
|
||||||
|
}
|
||||||
|
scoreInfo[keyPre[i] + 'Score'] = computeScore(t.data.result, i)
|
||||||
this.npmNetworkLastCycleData.push(t.data.result)
|
this.npmNetworkLastCycleData.push(t.data.result)
|
||||||
this.npmNetworkQuantity(this.npmNetworkCycleData, this.npmNetworkLastCycleData)
|
this.npmNetworkQuantity(this.npmNetworkCycleData, this.npmNetworkLastCycleData)
|
||||||
|
} else {
|
||||||
|
t[keyPre[i] + 'Score'] = 0
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
scoreInfo.score = Math.ceil((scoreInfo.tcpScore + scoreInfo.httpScore + scoreInfo.sslScore + scoreInfo.tcpLostScore + scoreInfo.packetRetransScore) * 6)
|
||||||
|
if (scoreInfo.score > 6) {
|
||||||
|
scoreInfo.score = 6
|
||||||
|
}
|
||||||
|
this.$store.commit('setNpmThirdLevelMenuScore', scoreInfo.score)
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.toggleLoading(false)
|
this.toggleLoading(false)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user