This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
cyber-narrator-cn-ui/src/views/entityExplorer/entityList/Row.vue

316 lines
11 KiB
Vue
Raw Normal View History

<template>
<div class="cn-entity--list" :style="{ zIndex: !isCollapse ? 1 : 'unset' }">
2021-12-16 18:22:47 +08:00
<!-- 左侧下拉按钮 -->
<div class="cn-entity__collapse">
<span @click="switchCollapse" :class="{ 'reg-down': !isCollapse }"
><i class="cn-icon cn-icon-arrow-right"></i
></span>
2021-12-16 18:22:47 +08:00
</div>
<div class="cn-entity__case">
<div class="cn-entity__icon"><i :class="iconClass"></i></div>
<div class="cn-entity__row">
<div class="cn-entity__header">
{{
entityData.ipAddr ||
entityData.domainName ||
entityData.appName ||
'Unknown'
}}
</div>
2021-12-16 18:22:47 +08:00
<div class="cn-entity__body">
<div class="body__basic-info">
<div class="basic-info">
<template v-if="entityData.entityType === 'ip'">
<div class="basic-info__item">
<i class="cn-icon cn-icon-country"></i>
<span>{{ $t('overall.country') }}&nbsp;:&nbsp;&nbsp;</span>
<span>{{ entityData.ipLocationCountry || '-' }}</span>
2021-12-16 18:22:47 +08:00
</div>
<div class="basic-info__item">
<i class="cn-icon cn-icon-position"></i>
<span>{{ $t('overall.region') }}&nbsp;:&nbsp;&nbsp;</span>
<span>{{ ipLocationRegion(entityData) }}</span>
2021-12-16 18:22:47 +08:00
</div>
<div class="basic-info__item">
<i class="cn-icon cn-icon-cloud"></i>
<span>{{ $t('entities.asn') }}&nbsp;:&nbsp;&nbsp;</span>
<span>{{ entityData.ipAsn || '-' }}</span>
2021-12-16 18:22:47 +08:00
</div>
</template>
<template v-else-if="entityData.entityType === 'domain'">
<div class="basic-info__item">
<i class="cn-icon cn-icon-category"></i>
<span
>{{
$t('entities.domainDetail.categoryGroup')
}}&nbsp;:&nbsp;&nbsp;</span
>
<span>{{ entityData.domainCategoryGroup || '-' }}</span>
2021-12-16 18:22:47 +08:00
</div>
<div class="basic-info__item">
<i class="cn-icon cn-icon-sub-category"></i>
<span>{{ $t('entities.category') }}&nbsp;:&nbsp;&nbsp;</span>
<span>{{ entityData.domainCategory || '-' }}</span>
2021-12-16 18:22:47 +08:00
</div>
<div class="basic-info__item">
<i class="cn-icon cn-icon-credit"></i>
<span
>{{
$t('entities.reputationLevel')
}}&nbsp;:&nbsp;&nbsp;</span
>
<span>{{ entityData.domainReputationScore || '-' }}</span>
2021-12-16 18:22:47 +08:00
</div>
</template>
<template v-else-if="entityData.entityType === 'app'">
<div class="basic-info__item">
<i class="cn-icon cn-icon-id"></i>
<span>{{ $t('entities.category') }}&nbsp;:&nbsp;&nbsp;</span>
<span>{{ entityData.appCategory || '-' }}</span>
2021-12-16 18:22:47 +08:00
</div>
<div class="basic-info__item">
<i class="cn-icon cn-icon-category"></i>
<span
>{{ $t('entities.subcategory') }}&nbsp;:&nbsp;&nbsp;</span
>
<span>{{ entityData.appSubcategory || '-' }}</span>
2021-12-16 18:22:47 +08:00
</div>
<div class="basic-info__item">
<i class="cn-icon cn-icon-sub-category"></i>
<span>{{ $t('entities.risk') }}&nbsp;:&nbsp;&nbsp;</span>
<span>{{ appRisk(entityData.appRisk) || '-' }}</span>
2021-12-16 18:22:47 +08:00
</div>
</template>
<!-- 通用字段 -->
<div class="basic-info__item">
<div class="item__box">
<i class="cn-icon cn-icon-rise"></i>
<span
>{{
$t('entities.sentThroughput')
}}&nbsp;:&nbsp;&nbsp;</span
>
<span>{{
entityData.bytesSentRate
? unitConvert(
entityData.bytesSentRate,
unitTypes.byte,
).join(' ') + 'ps'
: '-'
}}</span>
<!-- 曲线-->
<div
class="row__charts"
:id="`entityDetailSend${entityType}`"
v-if="entityData.entityType === 'domain'"
></div>
<div
class="row__charts"
:id="`entityDetailSend${entityType}`"
v-if="entityData.entityType === 'app'"
></div>
<div
class="row__charts"
:id="`entityDetailSend${entityType}`"
v-if="entityData.entityType === 'ip'"
></div>
</div>
2021-12-16 18:22:47 +08:00
</div>
2021-12-16 18:22:47 +08:00
<div class="basic-info__item">
<div class="item__box">
<i class="cn-icon cn-icon-fall"></i>
<span
>{{
$t('entities.receivedThroughput')
}}&nbsp;:&nbsp;&nbsp;</span
>
<span>{{
entityData.bytesReceivedRate
? unitConvert(
entityData.bytesReceivedRate,
unitTypes.byte,
).join(' ') + 'ps'
: '-'
}}</span>
<div
class="row__charts"
:id="`entityDetailReceived${entityType}`"
v-if="entityData.entityType === 'domain'"
></div>
<div
class="row__charts"
:id="`entityDetailReceived${entityType}`"
v-if="entityData.entityType === 'app'"
></div>
<div
class="row__charts"
:id="`entityDetailReceived${entityType}`"
v-if="entityData.entityType === 'ip'"
></div>
</div>
2021-12-16 18:22:47 +08:00
</div>
<div class="basic-info__item">
<i class="cn-icon cn-icon-entity-alert"></i>
<span>{{ $t('entities.recentAlert') }}&nbsp;:&nbsp;&nbsp;</span>
<span>{{ entityData.alertCount || '-' }}</span>
2021-12-16 18:22:47 +08:00
</div>
<div class="basic-info__item">
<i class="cn-icon cn-icon-safe"></i>
<span
>{{ $t('entities.recentSecurity') }}&nbsp;:&nbsp;&nbsp;</span
>
<span>{{ entityData.securityCount || '-' }}</span>
2021-12-16 18:22:47 +08:00
</div>
</div>
2022-01-03 22:46:22 +08:00
<div
class="show-detail"
:style="{ visibility: !isCollapse ? 'visible' : 'hidden' }"
@click="showDetail"
>
{{ $t('overall.detail') }}>>
</div>
2021-12-16 18:22:47 +08:00
</div>
</div>
</div>
<el-collapse-transition>
2022-01-11 11:20:17 +08:00
<div class="cn-entity__detail-overview" v-if="!isCollapse">
<el-divider></el-divider>
<detail-overview
:entity="entityData"
:time-filter="timeFilter"
></detail-overview>
</div>
</el-collapse-transition>
2021-12-16 18:22:47 +08:00
</div>
</div>
</template>
<script>
2021-12-16 18:22:47 +08:00
import entityListMixin from './entityListMixin'
import DetailOverview from '@/views/entityExplorer/entityList/detailOverview/DetailOverview'
import { unitTypes } from '@/utils/constants'
import unitConvert from '@/utils/unit-convert'
import entityDetailMixin from './detailOverview/entityDetailMixin'
import relatedServer from '@/mixins/relatedServer'
import { api } from '@/utils/api'
export default {
2021-12-16 18:22:47 +08:00
name: 'Row',
2021-12-17 20:56:25 +08:00
props: {
2021-12-31 10:40:37 +08:00
index: Number,
timeFilter: Object,
2021-12-17 20:56:25 +08:00
},
components: {
DetailOverview,
},
mixins: [entityListMixin, entityDetailMixin, relatedServer],
data() {
2021-12-16 23:03:39 +08:00
return {
isCollapse: true, // 是否是折叠状态
trafficUrl: '',
entityType: '',
2021-12-16 23:03:39 +08:00
}
},
computed: {
ipLocationRegion() {
return function (entityData) {
const hasProvinceAndCity =
entityData.ipLocationProvince &&
entityData.ipLocationCity &&
entityData.ipLocationProvince !== 'null' &&
entityData.ipLocationCity !== 'null'
const hasProvince =
entityData.ipLocationProvince &&
entityData.ipLocationProvince !== 'null'
const hasCity =
entityData.ipLocationCity && entityData.ipLocationCity !== 'null'
if (hasProvinceAndCity) {
return `${entityData.ipLocationProvince}, ${entityData.ipLocationCity}`
} else if (hasProvince) {
return entityData.ipLocationProvince
} else if (hasCity) {
return entityData.ipLocationCity
} else {
return '-'
}
}
},
entityType() {
let type
switch (this.entityData.entityType) {
case 'ip': {
type = this.entityData.ipAddr
break
}
case 'domain': {
type = this.entityData.domainName
break
}
case 'app': {
type = this.entityData.appName
break
}
default:
break
}
this.entityType = type
return type
},
},
watch: {
entityData: {
deep: true,
handler(n) {
if (n.entityType) {
switch (n.entityType) {
case 'ip': {
this.trafficUrl = api.entityIpDetailTraffic
break
}
case 'domain': {
this.trafficUrl = api.entityDomainDetailTraffic
break
}
case 'app': {
this.trafficUrl = api.entityAppDetailTraffic
break
}
default:
break
}
}
},
},
},
setup() {
return {
unitConvert,
unitTypes,
}
},
2021-12-16 23:03:39 +08:00
methods: {
/* 切换折叠状态 */
switchCollapse() {
2021-12-16 23:03:39 +08:00
this.isCollapse = !this.isCollapse
this.$emit('switchCollapse', this.isCollapse, this.index)
2021-12-17 20:56:25 +08:00
},
/* 设为折叠状态 */
collapse() {
this.isCollapse = true
},
getQueryParams() {
const queryParams = {
startTime: parseInt(this.timeFilter.startTime / 1000),
endTime: parseInt(this.timeFilter.endTime / 1000),
appName: this.entityType,
domain:this.entityType,
ip:this.entityType
}
return queryParams
},
},
}
</script>