fix: 请求成功的判断条件code改为status(部分)

This commit is contained in:
chenjinsong
2023-08-24 17:15:41 +08:00
parent 7b0ec06a05
commit 21f32dfdda
75 changed files with 422 additions and 5595 deletions

View File

@@ -1,154 +0,0 @@
<template>
<div class="cn-home entity-detail">
<div class="entity-detail__header">
<div class="cn-entity__icon"><i :class="iconClass"></i></div>
<div class="cn-entity__name">{{entityData.ip || entityData.domain || entityData.appName }}</div>
</div>
<main class="cn-body entity-detail__body">
<div class="entity-detail__menu">
<template v-for="(anchor,index) in anchorPoints" :key="anchor.id">
<div class="menu-item" :class="{'menu-item--active':anchor.isActive}" @click="jumpToAnchor(index,anchor)">
<span>{{anchor.label}}</span>
</div>
</template>
</div>
<div class="entity-detail__content" @scroll="scroll" id="detailWrapper">
<cn-panel
ref="cnPanel"
:entity="entityData"
:is-entity-detail="true"
@chartLoaded="chartLoaded"
></cn-panel>
</div>
</main>
</div>
</template>
<script>
import { useRoute } from 'vue-router'
import Panel from '@/views/charts/Panel'
export default {
name: 'EntityDetail',
components: {
cnPanel: Panel
},
data () {
return {
anchorPoints: [], // { id, label, top, height }
top: 0,
scrollHeight: 0,
clientHeight: 0,
currentAnchor: 0
}
},
setup (props, ctx) {
const { query } = useRoute()
let panelType
const entityData = { entityType: query.entityType }
switch (query.entityType) {
case 'ip': {
panelType = 4
entityData.ip = query.name
break
}
case 'domain': {
panelType = 5
entityData.domain = query.name
break
}
case 'app': {
panelType = 6
entityData.appName = query.name
break
}
default: {
panelType = 4
break
}
}
entityData.type = panelType
return {
entityData
}
},
methods: {
chartLoaded (chartList) {
this.chartList = chartList
this.anchorPoints = []
let anchorPoints = []
const panelDom = document.querySelector('#detailWrapper')
this.scrollHeight = panelDom.scrollHeight
this.clientHeight = panelDom.clientHeight
chartList.forEach((chart, index) => {
if (chart.params.anchorPoint) {
const dom = document.querySelector(`[id='${chart.params.anchorPoint}']`)
dom && anchorPoints.push({
id: chart.params.anchorPoint,
isActive: index === 0,
label: chart.i18n ? this.$t(chart.i18n) : chart.name,
top: dom.offsetTop + 10/* ,
height: document.querySelector(`#${chart.params.anchorPoint}}`).scrollHeight */
})
}
})
// 从小到大排序
anchorPoints = anchorPoints.sort((a, b) => {
return a.top - b.top
})
if (!this.$_.isEmpty(anchorPoints)) {
anchorPoints[0].top = 0
}
this.anchorPoints = anchorPoints
},
scroll (e) {
this.top = (e.target.scrollTop + 10) || 0
},
jumpToAnchor (index, anchor) {
const anchorEle = document.getElementById(anchor.id)
this.anchorPoints.forEach((anchor, i) => {
if (index === i) {
anchor.isActive = true
} else {
anchor.isActive = false
}
})
if (anchorEle) {
anchorEle.scrollIntoView()
document.documentElement.scrollTop = document.documentElement.scrollTop - 30
}
},
resize () {
this.chartLoaded(this.chartList)
}
},
mounted () {
this.debounceFunc = this.$_.debounce(this.resize, 400)
window.addEventListener('resize', this.debounceFunc)
},
beforeUnmount () {
window.removeEventListener('resize', this.debounceFunc)
},
computed: {
iconClass () {
let className
switch (this.entityData.entityType) {
case ('ip'): {
className = 'cn-icon cn-icon-ip2'
break
}
case ('domain'): {
className = 'cn-icon cn-icon-domain2'
break
}
case ('app'): {
className = 'cn-icon cn-icon-app2'
break
}
default: break
}
return className
}
}
}
</script>

View File

@@ -159,7 +159,7 @@ import ExplorerSearch from '@/views/entityExplorer/search/ExplorerSearch'
import EntityFilter from '@/views/entityExplorer/EntityFilter'
import EntityList from '@/views/entityExplorer/entityList/EntityList'
import { entityType, defaultPageSize, riskLevelMapping } from '@/utils/constants'
import { get } from '@/utils/http'
import axios from 'axios'
import { api } from '@/utils/api'
import { getNowTime, getSecond } from '@/utils/date-util'
import { ref } from 'vue'
@@ -675,8 +675,9 @@ export default {
endTime: getSecond(params.endTime)
}
this.loadingLeft = true
get(api.entityFilter, queryParams).then(response => {
if (response.code === 200 && response.data && response.data.result) {
axios.get(api.entityFilter, { params: queryParams }).then(res => {
const response = res.data
if (res.status === 200 && response.data && response.data.result) {
switch (params.entityType) {
case 'ip': {
this.filterData[0].data.forEach(d => {
@@ -738,20 +739,20 @@ export default {
resource: params.q || ''
}
this.loadingLeft = true
const aggCountry = get(api.entity.entityList.aggCountry, queryParams)
const aggCity = get(api.entity.entityList.aggCity, queryParams)
const aggIPAsn = get(api.entity.entityList.aggIPAsn, queryParams)
const aggIPIsp = get(api.entity.entityList.aggIPIsp, queryParams)
const aggPort = get(api.entity.entityList.aggPort, queryParams)
const aggDomain = get(api.entity.entityList.aggDomain, queryParams)
const aggAppCategory = get(api.entity.entityList.aggAppCategory, queryParams)
const aggTag = get(api.entity.entityList.aggTag, queryParams)
const aggCountry = axios.get(api.entity.entityList.aggCountry, { params: queryParams })
const aggCity = axios.get(api.entity.entityList.aggCity, { params: queryParams })
const aggIPAsn = axios.get(api.entity.entityList.aggIPAsn, { params: queryParams })
const aggIPIsp = axios.get(api.entity.entityList.aggIPIsp, { params: queryParams })
const aggPort = axios.get(api.entity.entityList.aggPort, { params: queryParams })
const aggDomain = axios.get(api.entity.entityList.aggDomain, { params: queryParams })
const aggAppCategory = axios.get(api.entity.entityList.aggAppCategory, { params: queryParams })
const aggTag = axios.get(api.entity.entityList.aggTag, { params: queryParams })
Promise.all([aggCountry, aggCity, aggIPAsn, aggIPIsp, aggPort, aggDomain, aggAppCategory, aggTag]).then(response => {
response.forEach((item, index) => {
if (item.code === 200 && item.data.list) {
if (item.status === 200 && item.data.data.list) {
this.newFilterData[index].data = []
item.data.list.forEach(item => {
item.data.data.list.forEach(item => {
let obj = {
label: item.value,
topColumn: this.newFilterData[index].topColumn,
@@ -789,15 +790,15 @@ export default {
// endTime: getSecond(params.endTime),
resource: params.q || ''
}
get(api.entity.entityList.list, queryParams).then(response => {
if (response.code === 200) {
axios.get(api.entity.entityList.list, { params: queryParams }).then(response => {
if (response.status === 200) {
this.listData = []
this.$nextTick(() => {
this.listData = response.data.list
this.pageObj.total = response.data.total
this.listData = response.data.data.list
this.pageObj.total = response.data.data.total
})
} else {
this.$message.error(response.message)
this.$message.error(response.data.message)
}
}).finally(() => {
this.listLoading = false
@@ -811,9 +812,9 @@ export default {
// endTime: getSecond(params.endTime),
resource: params.q || '' // 目前版本搜索不支持实体名称搜索,下版本改进
}
get(api.entity.entityList.summaryCount, queryParams).then(response => {
if (response.code === 200) {
this.summaryCount = response.data
axios.get(api.entity.entityList.summaryCount, { params: queryParams }).then(response => {
if (response.status === 200) {
this.summaryCount = response.data.data
} else {
this.summaryCount = { total: 0, domainCount: 0, ipCount: 0, appCount: 0 }
}
@@ -831,9 +832,9 @@ export default {
startTime: getSecond(params.startTime),
endTime: getSecond(params.endTime)
}
get(api.entityListTotal, queryParams).then(response => {
if (response.code === 200) {
this.pageObj.total = response.data.result
axios.get(api.entityListTotal, { params: queryParams }).then(response => {
if (response.status === 200) {
this.pageObj.total = response.data.data.result
}
})
},
@@ -857,33 +858,33 @@ export default {
this.loadingDomainActive = true
this.loadingIpActive = true
get(api.entity.entityList.entityActive).then(response => {
if (response.code === 200) {
this.entityDomainTotal = response.data.domainCount
this.entityIpTotal = response.data.ipCount
this.entityAppTotal = response.data.appCount
axios.get(api.entity.entityList.entityActive).then(response => {
if (response.status === 200) {
this.entityDomainTotal = response.data.data.domainCount
this.entityIpTotal = response.data.data.ipCount
this.entityAppTotal = response.data.data.appCount
}
this.loadingDomain = false
this.loadingIp = false
this.loadingApp = false
})
// New
get(api.entity.entityList.entityNew).then(response => {
if (response.code === 200) {
this.entityDomainNew = response.data.domainCount
this.entityIpNew = response.data.ipCount
this.entityAppNew = response.data.appCount
axios.get(api.entity.entityList.entityNew).then(response => {
if (response.status === 200) {
this.entityDomainNew = response.data.data.domainCount
this.entityIpNew = response.data.data.ipCount
this.entityAppNew = response.data.data.appCount
}
this.loadingDomainNew = false
this.loadingIpNew = false
this.loadingAppNew = false
})
// Active
get(api.entity.entityList.entityActive).then(response => {
if (response.code === 200) {
this.entityDomainActive = response.data.domainCount
this.entityIpActive = response.data.ipCount
this.entityAppActive = response.data.appCount
axios.get(api.entity.entityList.entityActive).then(response => {
if (response.status === 200) {
this.entityDomainActive = response.data.data.domainCount
this.entityIpActive = response.data.data.ipCount
this.entityAppActive = response.data.data.appCount
}
this.loadingDomainActive = false
this.loadingIpActive = false

View File

@@ -1,150 +0,0 @@
<template >
<div class="entity-filter-case">
<div class="filter-case__header">{{$t('entities.filter')}}</div>
<div
class="entity-filter"
v-for="(filters, index) in filterData"
:key="index"
>
<div class="filter__header">{{filters.title}}</div>
<div class="filter__body">
<div class="filter__row" v-for="(item, i) in filters.data" :key="i">
<el-popover popper-class="filter__row-popover" placement="right-start" :width="440" v-model:visible="item.showTopTen">
<template #reference>
<div class="filter__row-popover" @click="showTopDialog(i, item, filters)">
<div class="row__label">
<i :class="item.icon"></i>
<span>{{item.label}}</span>
</div>
<div class="row__value">
<loading :loading="loadingLeft" size="small"></loading>
<span>{{item.value}}</span>
</div>
</div>
</template>
<entity-top
ref="entityTopTenPop"
:loading="loading"
:popover-data="popoverData"
:item-data="itemData"
:total-count="totalCount"
:top-column="item.topColumn"
@filter="filter"
></entity-top>
</el-popover>
</div>
</div>
</div>
</div>
</template>
<script>
import EntityTop from '@/views/entityExplorer/EntityTop'
import { get } from '@/utils/http'
import { api } from '@/utils/api'
import Loading from '@/components/common/Loading'
import { getSecond } from '@/utils/date-util'
export default {
name: 'EntityFilter',
components: {
Loading,
EntityTop
},
props: {
filterData: Array,
q: String,
timeFilter: Object,
loadingLeft: Boolean
},
data () {
return {
topList: 'list',
topData: [],
entityTopTenData: [],
currentColumn: {},
totalCount: 0,
loading: false,
popoverData: [],
itemData: {}
}
},
watch: {
currentColumn (n, o) {
if (n.column === 'dnsServerOrgCount') {
this.totalCount = this.filterData[3].orgTotalCount
} else if (n.column === 'dnsServerSoftwareCount') {
this.totalCount = this.filterData[3].softwareTotalCount
} else if (n.column === 'dnsServerOsCount') {
this.totalCount = this.filterData[3].osTotalCount
} else if (n.column === 'categoryDistinctCount' && n.type === 'app') {
this.totalCount = this.filterData[1].totalCount
} else {
let count = 0
this.filterData.forEach(f => {
const filter = f.data.some(d => d.column === n.column)
if (filter) {
count = f.totalCount
}
})
this.totalCount = count
}
}
},
methods: {
showTopDialog (i, item, filter) {
if (this.currentColumn.column === item.column && item.showTopTen) {
item.showTopTen = false
return
}
this.filterData.forEach(f => {
f.data.forEach(ff => {
ff.showTopTen = false
})
})
item.showTopTen = true
this.currentColumn = {
column: item.column,
type: filter.type
}
const queryParams = {
q: this.q,
entityType: filter.type,
column: item.topColumn,
top: 10,
startTime: getSecond(this.timeFilter.startTime),
endTime: getSecond(this.timeFilter.endTime)
}
this.loading = true
this.popoverData = []
this.itemData = {}
get(api.filterTop, queryParams).then(response => {
if (response.code === 200) {
if (this.currentColumn.column === item.column) {
if (filter.type === 'dns') {
this.popoverData = response.data.result.filter(f => {
return f.count > 0
})
} else {
this.popoverData = response.data.result
}
this.itemData = item
}
} else {
this.popoverData = []
this.itemData = item
}
this.loading = false
}).catch(e => {
this.popoverData = []
this.itemData = item
this.loading = false
})
},
filter (name, topData) {
this.showTopDialog('', topData)
this.$emit('filter', name, topData)
}
}
}
</script>

View File

@@ -108,7 +108,7 @@ export default class Node {
console.error(e)
throw e
})
if (response.data && response.data.code === 200) {
if (response.data && response.status === 200) {
return response.data.data
} else {
console.error(response)
@@ -121,7 +121,7 @@ export default class Node {
console.error(e)
throw e
})
if (response.data && response.data.code === 200) {
if (response.data && response.status === 200) {
return response.data.data
} else {
console.error(response)
@@ -134,7 +134,7 @@ export default class Node {
console.error(e)
throw e
})
if (response.data && response.data.code === 200) {
if (response.data && response.status === 200) {
return response.data.data
} else {
console.error(response)
@@ -173,7 +173,7 @@ export async function queryRelatedEntity (node, targetEntityType) {
console.error(e)
throw e
})
if (response.data && response.data.code === 200) {
if (response.data && response.status === 200) {
return response.data.data
} else {
console.error(response)

View File

@@ -1,5 +1,5 @@
import _ from 'lodash'
import { get } from '@/utils/http'
import axios from 'axios'
import * as echarts from 'echarts'
import { entityListLineOption } from '@/views/charts/charts/chart-options'
import { riskLevelMapping, unitTypes } from '@/utils/constants'
@@ -101,9 +101,9 @@ export default {
this.sentChart = echarts.init(document.getElementById(`entityDetailSend${this.entityName}`))
this.receivedChart = echarts.init(document.getElementById(`entityDetailReceived${this.entityName}`))
this.loadingTraffic = true
get(this.trafficUrl, this.getQueryParams()).then(response => {
if (response.code === 200 && response.data.result && response.data.result.length > 0) {
response.data.result.forEach(t => {
axios.get(this.trafficUrl, { params: this.getQueryParams() }).then(response => {
if (response.status === 200 && response.data.data.result && response.data.data.result.length > 0) {
response.data.data.result.forEach(t => {
if (t.legend === 'bytesRate') {
this.entityData.max = t.aggregation.max
this.entityData.avg = t.aggregation.avg
@@ -190,14 +190,16 @@ export default {
}
if (url) {
get(url, {
...this.getPerformanceQueryParams(),
startTime: searchStartTime,
endTime: searchEndTime,
eventType: item.eventType
}).then((response) => {
if (response.code === 200) {
const metricDataList = response.data.result[0] && response.data.result[0].values
axios.get(url, {
params: {
...this.getPerformanceQueryParams(),
startTime: searchStartTime,
endTime: searchEndTime,
eventType: item.eventType
}
}).then(response => {
if (response.status === 200) {
const metricDataList = response.data.data.result[0] && response.data.data.result[0].values
this.$nextTick(() => {
if (metricDataList && metricDataList.length > 0) {
metricDataList.sort(reverseSortBy(0))// 将返回的数据按时间降序排序,方便找到实线和虚线的交点
@@ -244,9 +246,9 @@ export default {
}
},
queryEntityDetailRelation () {
get(this.relationUrl, this.getQueryParams()).then(response => {
if (response.code === 200) {
this.handleRelationData(response.data.result)
axios.get(this.relationUrl, { params: this.getQueryParams() }).then(response => {
if (response.status === 200) {
this.handleRelationData(response.data.data.result)
}
})
},
@@ -254,35 +256,35 @@ export default {
queryEntityDetailNetworkQuantity () {
this.loadingNetworkQuality = true
if (this.networkQuantityUrl) {
get(this.networkQuantityUrl, this.getQueryParams()).then(response => {
if (response.code === 200) {
axios.get(this.networkQuantityUrl, { params: this.getQueryParams() }).then(response => {
if (response.status === 200) {
const data = {
establishLatencyMs: response.data.result.establishLatencyValue || null,
httpResponseLatency: response.data.result.httpResponseLatencyValue || null,
sslConLatency: response.data.result.sslConLatencyValue || null,
tcpLostlenPercent: response.data.result.sequenceGapLossPercentValue || null,
pktRetransPercent: response.data.result.pktRetransPercentValue || null
establishLatencyMs: response.data.data.result.establishLatencyValue || null,
httpResponseLatency: response.data.data.result.httpResponseLatencyValue || null,
sslConLatency: response.data.data.result.sslConLatencyValue || null,
tcpLostlenPercent: response.data.data.result.sequenceGapLossPercentValue || null,
pktRetransPercent: response.data.data.result.pktRetransPercentValue || null
}
this.score = computeScore(data)
this.entityData.establishLatencyValue = response.data.result.establishLatencyValue
this.entityData.establishLatencyP50 = response.data.result.establishLatencyP50
this.entityData.establishLatencyP90 = response.data.result.establishLatencyP90
this.entityData.establishLatencyValue = response.data.data.result.establishLatencyValue
this.entityData.establishLatencyP50 = response.data.data.result.establishLatencyP50
this.entityData.establishLatencyP90 = response.data.data.result.establishLatencyP90
this.entityData.httpResponseLantencyValue = response.data.result.httpResponseLantencyValue
this.entityData.httpResponseLantencyP50 = response.data.result.httpResponseLantencyP50
this.entityData.httpResponseLantencyP90 = response.data.result.httpResponseLantencyP90
this.entityData.httpResponseLantencyValue = response.data.data.result.httpResponseLantencyValue
this.entityData.httpResponseLantencyP50 = response.data.data.result.httpResponseLantencyP50
this.entityData.httpResponseLantencyP90 = response.data.data.result.httpResponseLantencyP90
this.entityData.sslConLatencyValue = response.data.result.sslConLatencyValue
this.entityData.sslConLatencyP50 = response.data.result.sslConLatencyP50
this.entityData.sslConLatencyP90 = response.data.result.sslConLatencyP90
this.entityData.sslConLatencyValue = response.data.data.result.sslConLatencyValue
this.entityData.sslConLatencyP50 = response.data.data.result.sslConLatencyP50
this.entityData.sslConLatencyP90 = response.data.data.result.sslConLatencyP90
this.entityData.sequenceGapLossPercentValue = response.data.result.sequenceGapLossPercentValue
this.entityData.sequenceGapLossPercentP50 = response.data.result.sequenceGapLossPercentP50
this.entityData.sequenceGapLossPercentP90 = response.data.result.sequenceGapLossPercentP90
this.entityData.sequenceGapLossPercentValue = response.data.data.result.sequenceGapLossPercentValue
this.entityData.sequenceGapLossPercentP50 = response.data.data.result.sequenceGapLossPercentP50
this.entityData.sequenceGapLossPercentP90 = response.data.data.result.sequenceGapLossPercentP90
this.entityData.pktRetransPercentValue = response.data.result.pktRetransPercentValue
this.entityData.pktRetransPercentP50 = response.data.result.pktRetransPercentP50
this.entityData.pktRetransPercentP90 = response.data.result.pktRetransPercentP90
this.entityData.pktRetransPercentValue = response.data.data.result.pktRetransPercentValue
this.entityData.pktRetransPercentP50 = response.data.data.result.pktRetransPercentP50
this.entityData.pktRetransPercentP90 = response.data.data.result.pktRetransPercentP90
const establishLatency = {
value: this.entityData.establishLatencyValue,
@@ -323,17 +325,17 @@ export default {
queryEntityDetailLinkInUrl () {
this.loadingIn = true
if (this.linkInUrl) {
get(this.linkInUrl, this.getQueryParams()).then(response => {
if (response.code === 200) {
if (!this.$_.isEmpty(response.data.result)) {
axios.get(this.linkInUrl, { params: this.getQueryParams() }).then(response => {
if (response.status === 200) {
if (!this.$_.isEmpty(response.data.data.result)) {
let sum = 0
response.data.result.forEach(r => {
response.data.data.result.forEach(r => {
sum += parseFloat(r.bytes)
})
const sorted = response.data.result.sort((r1, r2) => {
const sorted = response.data.data.result.sort((r1, r2) => {
return parseFloat(r2.bytes) - parseFloat(r1.bytes)
})
const sortedId = response.data.result.sort((r1, r2) => {
const sortedId = response.data.data.result.sort((r1, r2) => {
return parseFloat(r2.commonIngressLinkId) - parseFloat(r1.commonIngressLinkId)
})
const max = parseFloat(sorted[0].bytes)
@@ -350,17 +352,17 @@ export default {
queryEntityDetailLinkOutUrl () {
this.loadingOut = true
if (this.linkOutUrl) {
get(this.linkOutUrl, this.getQueryParams()).then(response => {
if (response.code === 200) {
if (!this.$_.isEmpty(response.data.result)) {
axios.get(this.linkOutUrl, { params: this.getQueryParams() }).then(response => {
if (response.status === 200) {
if (!this.$_.isEmpty(response.data.data.result)) {
let sum = 0
response.data.result.forEach(r => {
response.data.data.result.forEach(r => {
sum += parseFloat(r.bytes)
})
const sorted = response.data.result.sort((r1, r2) => {
const sorted = response.data.data.result.sort((r1, r2) => {
return parseFloat(r2.bytes) - parseFloat(r1.bytes)
})
const sortedId = response.data.result.sort((r1, r2) => {
const sortedId = response.data.data.result.sort((r1, r2) => {
return parseFloat(r2.commonEgressLinkId) - parseFloat(r1.commonEgressLinkId)
})
const max = parseFloat(sorted[0].bytes)
@@ -376,10 +378,10 @@ export default {
queryEntityDetailPerformance () {
this.loadingAlert = true
get(this.performanceUrl, this.getQueryParams()).then(response => {
if (response.code === 200) {
this.entityData.performanceNum = response.data.result.length
this.performanceData = response.data.result
axios.get(this.performanceUrl, { params: this.getQueryParams() }).then(response => {
if (response.status === 200) {
this.entityData.performanceNum = response.data.data.result.length
this.performanceData = response.data.data.result
this.entityData.performanceList = this.getTargetPageData(1, this.showMore.performancePageSize, this.performanceData)
}
this.loadingAlert = false
@@ -388,10 +390,10 @@ export default {
queryEntityDetailSecurity () {
this.loadingSecurityEvents = true
get(this.securityUrl, this.getQueryParams()).then(response => {
if (response.code === 200) {
this.entityData.securityNum = response.data.result.length
this.securityData = response.data.result
axios.get(this.securityUrl, { params: this.getQueryParams() }).then(response => {
if (response.status === 200) {
this.entityData.securityNum = response.data.data.result.length
this.securityData = response.data.data.result
this.entityData.securityList = this.getTargetPageData(1, this.showMore.securityPageSize, this.securityData)
}
this.loadingSecurityEvents = false
@@ -399,16 +401,8 @@ export default {
},
performanceShowMore (num) {
// const startIndex = this.showMore.performancePageSize
this.showMore.performancePageSize += num
this.entityData.performanceList = this.getTargetPageData(this.showMore.pageNo, this.showMore.performancePageSize, this.performanceData)
// this.$nextTick(() => {
// setTimeout(() => lltext
// if (this.entityData.performanceList && this.entityData.performanceList.length > 0) {
// this.queryEntityDetailPerformanceChart(this.entityData.performanceList.slice(startIndex, this.entityData.performanceList.length), startIndex)
// }
// }, 200)
// })
},
securityShowMore (num) {
@@ -421,15 +415,15 @@ export default {
},
queryDnsServerInfo () {
get(this.entityDetectionsIpUrl, this.getQueryParams()).then(response => {
if (response.code === 200) {
this.entityData.dnsServerRole = response.data.result.dnsServerRole
this.entityData.dnsServerOrg = response.data.result.dnsServerOrg
this.entityData.dnsServerSoftware = response.data.result.dnsServerSoftware
this.entityData.dnsServerOs = response.data.result.dnsServerOs
this.entityData.dohSupport = response.data.result.dohSupport
this.entityData.dotSupport = response.data.result.dotSupport
this.entityData.dnssecSupport = response.data.result.dnssecSupport
axios.get(this.entityDetectionsIpUrl, { params: this.getQueryParams() }).then(response => {
if (response.status === 200) {
this.entityData.dnsServerRole = response.data.data.result.dnsServerRole
this.entityData.dnsServerOrg = response.data.data.result.dnsServerOrg
this.entityData.dnsServerSoftware = response.data.data.result.dnsServerSoftware
this.entityData.dnsServerOs = response.data.data.result.dnsServerOs
this.entityData.dohSupport = response.data.data.result.dohSupport
this.entityData.dotSupport = response.data.data.result.dotSupport
this.entityData.dnssecSupport = response.data.data.result.dnssecSupport
}
if (this.entityData.dnsServerRole) {
this.loadingDns = false
@@ -440,9 +434,9 @@ export default {
queryDnsServerInfoRate () {
this.loading = true
this.detectionChart = echarts.init(document.getElementById(`entityDnsServerInfo${this.entityName}`))
get(this.entityDetectionsIpQueryRateUrl, this.getQueryParams()).then(response => {
if (response.code === 200 && response.data.result && response.data.result.length > 0) {
response.data.result.forEach(t => {
axios.get(this.entityDetectionsIpQueryRateUrl, { params: this.getQueryParams() }).then(response => {
if (response.status === 200 && response.data.data.result && response.data.data.result.length > 0) {
response.data.data.result.forEach(t => {
this.entityData.queryRate = _.nth(t.values, -3)[1]
this.chartDetectionQueryRate = {
...this.chartOption,

View File

@@ -1,5 +1,5 @@
import _ from 'lodash'
import { get } from '@/utils/http'
import axios from 'axios'
import { api } from '@/utils/api'
import * as echarts from 'echarts'
import { entityListLineOption } from '@/views/charts/charts/chart-options'
@@ -123,9 +123,9 @@ export default {
}
default: break
}
get(url, queryParams).then(response => {
if (response.code === 200) {
this.entityData.securityCount = response.data.result ? response.data.result.length : 0
axios.get(url, { params: queryParams }).then(response => {
if (response.status === 200) {
this.entityData.securityCount = response.data.data.result ? response.data.data.result.length : 0
}
})
},
@@ -153,9 +153,9 @@ export default {
}
default: break
}
get(url, queryParams).then(response => {
if (response.code === 200) {
this.entityData.performanceCount = response.data.result ? response.data.result.length : 0
axios.get(url, { params: queryParams }).then(response => {
if (response.status === 200) {
this.entityData.performanceCount = response.data.data.result ? response.data.data.result.length : 0
}
})
},
@@ -168,11 +168,11 @@ export default {
},
queryEntityDetailTraffic () {
this.loading = true
get(this.trafficUrl, this.getQueryParams()).then(response => {
if (response.code === 200 && response.data.result && response.data.result.length > 0) {
axios.get(this.trafficUrl, { params: this.getQueryParams() }).then(response => {
if (response.status === 200 && response.data.data.result && response.data.data.result.length > 0) {
let sentSeries
let receivedSeries
response.data.result.forEach(t => {
response.data.data.result.forEach(t => {
if (t.legend === 'bytesRate') {
this.entityData.max = t.aggregation.max
this.entityData.avg = t.aggregation.avg
@@ -281,14 +281,14 @@ export default {
queryNetworkQuantity () {
this.loadingNetworkQuality = true
get(this.scoreUrl, this.getQueryParams()).then(response => {
if (response.code === 200) {
axios.get(this.scoreUrl, { params: this.getQueryParams() }).then(response => {
if (response.status === 200) {
const data = {
establishLatencyMs: response.data.result.establishLatencyValue || null,
httpResponseLatency: response.data.result.httpResponseLatencyValue || null,
sslConLatency: response.data.result.sslConLatencyValue || null,
tcpLostlenPercent: response.data.result.sequenceGapLossPercentValue || null,
pktRetransPercent: response.data.result.pktRetransPercentValue || null
establishLatencyMs: response.data.data.result.establishLatencyValue || null,
httpResponseLatency: response.data.data.result.httpResponseLatencyValue || null,
sslConLatency: response.data.data.result.sslConLatencyValue || null,
tcpLostlenPercent: response.data.data.result.sequenceGapLossPercentValue || null,
pktRetransPercent: response.data.data.result.pktRetransPercentValue || null
}
this.score = computeScore(data)
}
@@ -299,12 +299,12 @@ export default {
/** 获取事件数量 */
queryEventNum () {
this.loadingEvent = true
const performance = get(this.performanceEventUrl, this.getQueryParams())
const security = get(this.securityEventUrl, this.getQueryParams())
const performance = axios.get(this.performanceEventUrl, { params: this.getQueryParams() })
const security = axios.get(this.securityEventUrl, { params: this.getQueryParams() })
this.eventNum = 0
Promise.all([performance, security]).then(response => {
this.eventNum = response[0].data.result.length + response[1].data.result.length
this.eventNum = response[0].data.data.result.length + response[1].data.data.result.length
}).catch(e => {
this.eventNum = 0
}).finally(() => {