fix: 修复实体下拉有时候没值是没有默认'-'的问题

This commit is contained in:
chenjinsong
2023-09-01 18:05:53 +08:00
parent 8c03ef2a48
commit 4a57792f76
5 changed files with 20 additions and 74 deletions

View File

@@ -4,23 +4,23 @@
<div class="overview__content">
<div class="overview__row">
<div class="row__label row__label--width130">APP ID</div>
<div class="row__content">{{$_.get(entity, 'category.appId', '-')}}</div>
<div class="row__content">{{$_.get(entity, 'category.appId', '-') || '-'}}</div>
</div>
<div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.category')}}</div>
<div class="row__content">{{$_.get(entity, 'category.appCategory', '-')}}</div>
<div class="row__content">{{$_.get(entity, 'category.appCategory', '-') || '-'}}</div>
</div>
<div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.subcategory')}}</div>
<div class="row__content">{{$_.get(entity, 'category.appSubcategory', '-')}}</div>
<div class="row__content">{{$_.get(entity, 'category.appSubcategory', '-') || '-'}}</div>
</div>
<div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.riskLevel')}}</div>
<div class="row__content">{{appRisk(parseInt(entity.category.appRisk)) || '-'}}</div>
<div class="row__content">{{$_.get(entity, 'category.appRisk') ? appRisk(parseInt(entity.category.appRisk)) : '-'}}</div>
</div>
<div class="overview__row">
<div class="row__label row__label--width130">{{$t('overall.remark')}}</div>
<div class="row__content">{{$_.get(entity, 'category.appDescription', '-')}}</div>
<div class="row__content">{{$_.get(entity, 'category.appDescription', '-') || '-'}}</div>
</div>
</div>
</div>

View File

@@ -4,31 +4,31 @@
<div class="overview__content">
<div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.category')}}</div>
<div class="row__content">{{$_.get(entityData, 'category.categoryName', '-')}}</div>
<div class="row__content">{{$_.get(entityData, 'category.categoryName', '-') || '-'}}</div>
</div>
<div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.domainDetail.categoryGroup')}}</div>
<div class="row__content">{{$_.get(entityData, 'category.categoryGroup', '-')}}</div>
<div class="row__content">{{$_.get(entityData, 'category.categoryGroup', '-') || '-'}}</div>
</div>
<div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.reputationLevel')}}</div>
<div class="row__content">{{$_.get(entityData, 'category.reputationLevel', '-')}}</div>
<div class="row__content">{{$_.get(entityData, 'category.reputationLevel', '-') || '-'}}</div>
</div>
<div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.registration')}}</div>
<div class="row__content">{{$_.get(entityData, 'whois.registrantCountry', '-')}}</div>
<div class="row__content">{{$_.get(entityData, 'whois.registrantCountry', '-') || '-'}}</div>
</div>
<div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.org')}}</div>
<div class="row__content">{{$_.get(entityData, 'whois.registrantOrg', '-')}}</div>
<div class="row__content">{{$_.get(entityData, 'whois.registrantOrg', '-') || '-'}}</div>
</div>
<div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.icpCompanyName')}}</div>
<div class="row__content">{{$_.get(entityData, 'icp.icpCompanyName', '-')}}</div>
<div class="row__content">{{$_.get(entityData, 'icp.icpCompanyName', '-') || '-'}}</div>
</div>
<div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.icpLicense')}}</div>
<div class="row__content">{{$_.get(entityData, 'icp.icpSiteLicense', '-')}}</div>
<div class="row__content">{{$_.get(entityData, 'icp.icpSiteLicense', '-') || '-'}}</div>
</div>
</div>
</div>

View File

@@ -17,7 +17,7 @@
</div>
<div class="overview__row">
<div class="row__label row__label--width130">ASN</div>
<div class="row__content">{{$_.get(entity, 'asn.asn', '-')}}</div>
<div class="row__content">{{$_.get(entity, 'asn.asn', '-') || '-'}}</div>
</div>
<div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.openPort')}}</div>

View File

@@ -8,6 +8,7 @@ import { metricOption } from '@/views/detections/options/detectionOptions'
import { sortBy, reverseSortBy, computeScore } from '@/utils/tools'
import { getSecond } from '@/utils/date-util'
import { api } from '@/utils/api'
import i18n from '@/i18n'
export default {
props: {
@@ -115,7 +116,7 @@ export default {
...this.chartOption,
series: [
{
name: this.$t('entities.sentThroughput'),
name: i18n.global.t('entities.sentThroughput'),
type: 'line',
legendHoverLink: false,
itemStyle: {
@@ -135,7 +136,7 @@ export default {
...this.chartOption,
series: [
{
name: this.$t('entities.receivedThroughput'),
name: i18n.global.t('entities.receivedThroughput'),
type: 'line',
legendHoverLink: false,
itemStyle: {
@@ -322,60 +323,6 @@ export default {
}
},
queryEntityDetailLinkInUrl () {
this.loadingIn = true
if (this.linkInUrl) {
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.data.result.forEach(r => {
sum += parseFloat(r.bytes)
})
const sorted = response.data.data.result.sort((r1, r2) => {
return parseFloat(r2.bytes) - parseFloat(r1.bytes)
})
const sortedId = response.data.data.result.sort((r1, r2) => {
return parseFloat(r2.commonIngressLinkId) - parseFloat(r1.commonIngressLinkId)
})
const max = parseFloat(sorted[0].bytes)
const maxId = parseFloat(sortedId[0].commonIngressLinkId)
this.entityData.linkInPercent = (parseFloat(max / sum)).toFixed(2)
this.entityData.linkInId = maxId
}
}
this.loadingIn = false
})
}
},
queryEntityDetailLinkOutUrl () {
this.loadingOut = true
if (this.linkOutUrl) {
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.data.result.forEach(r => {
sum += parseFloat(r.bytes)
})
const sorted = response.data.data.result.sort((r1, r2) => {
return parseFloat(r2.bytes) - parseFloat(r1.bytes)
})
const sortedId = response.data.data.result.sort((r1, r2) => {
return parseFloat(r2.commonEgressLinkId) - parseFloat(r1.commonEgressLinkId)
})
const max = parseFloat(sorted[0].bytes)
const maxId = parseFloat(sortedId[0].commonEgressLinkId)
this.entityData.linkOutPercent = (parseFloat(max / sum)).toFixed(2)
this.entityData.linkOutId = maxId
}
}
this.loadingOut = false
})
}
},
queryEntityDetailPerformance () {
this.loadingAlert = true
axios.get(this.performanceUrl, { params: this.getQueryParams() }).then(response => {
@@ -442,7 +389,7 @@ export default {
...this.chartOption,
series: [
{
name: this.$t('entities.sentThroughput'),
name: i18n.global.t('entities.sentThroughput'),
type: 'line',
legendHoverLink: false,
itemStyle: {
@@ -469,8 +416,6 @@ export default {
this.queryEntityDetailPerformance()
this.queryEntityDetailSecurity()
this.queryEntityDetailNetworkQuantity()
this.queryEntityDetailLinkOutUrl()
this.queryEntityDetailLinkInUrl()
if (this.entity.entityType === 'ip') {
if (!this.entityData.dnsServerRole) {
this.loadingDns = true

View File

@@ -8,6 +8,7 @@ import { getSecond } from '@/utils/date-util'
import { valueToRangeValue } from '@/utils/unit-convert'
import { shallowRef } from 'vue'
import { computeScore } from '@/utils/tools'
import i18n from '@/i18n'
export default {
props: {
@@ -121,7 +122,7 @@ export default {
} else if (t.legend === 'bytesSentRate') {
this.entityData.bytesSentRate = _.nth(t.values, -3)[1]
sentSeries = {
name: this.$t('entities.sentThroughput'),
name: i18n.global.t('entities.sentThroughput'),
type: 'line',
legendHoverLink: false,
itemStyle: {
@@ -136,7 +137,7 @@ export default {
} else if (t.legend === 'bytesReceivedRate') {
this.entityData.bytesReceivedRate = t.aggregation.last
receivedSeries = {
name: this.$t('entities.receivedThroughput'),
name: i18n.global.t('entities.receivedThroughput'),
type: 'line',
legendHoverLink: false,
itemStyle: {