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/detections/DetectionRow.vue

178 lines
7.4 KiB
Vue
Raw Normal View History

2022-02-14 22:22:31 +08:00
<template>
2022-02-18 17:54:22 +08:00
<div class="cn-detection--list" :style="{zIndex: !isCollapse ? 1 : 'unset'}">
2022-02-14 22:22:31 +08:00
<!-- 左侧下拉按钮 -->
2022-02-18 17:54:22 +08:00
<div class="cn-detection__collapse">
2022-02-14 22:22:31 +08:00
<span @click="switchCollapse" :class="{'reg-down': !isCollapse}"><i class="cn-icon cn-icon-arrow-right"></i></span>
</div>
2022-02-18 17:54:22 +08:00
<div class="cn-detection__case">
<div class="cn-detection__icon" :style="`background-color: ${eventSeverityColor[detection.eventSecurity]}`"></div>
2022-02-18 17:54:22 +08:00
<div class="cn-detection__row">
<div class="cn-detection__header" v-if="pageType === detectionPageType.securityEvent">
<i class="cn-icon cn-icon-attacker" ></i>{{detection.offenderIp || '-'}}
2022-02-18 17:54:22 +08:00
<span class="line">-------</span>
<span class="circle"></span>
<i class="cn-icon cn-icon-attacked" ></i>{{detection.victimIp || '-'}}
2022-02-18 17:54:22 +08:00
</div>
<div class="cn-detection__header" v-else-if="pageType === detectionPageType.performanceEvent">
<div class="cn-entity__icon"><i :class="iconClass"></i></div>
<div style="padding-left: 3px;">{{detection.serverIp || detection.domain || detection.appName || 'Unknown'}}</div>
</div>
<div class="cn-detection__body">
2022-02-14 22:22:31 +08:00
<div class="body__basic-info">
<div class="basic-info">
<div class="basic-info__item" v-if="detection.eventSecurity">
2022-02-18 17:54:22 +08:00
<i class="cn-icon cn-icon-severity-level"></i>
<span>{{$t('detection.list.eventSecurity')}}&nbsp;:&nbsp;&nbsp;</span>
<span>{{detection.eventSecurity || '-'}}</span>
2022-02-14 22:22:31 +08:00
</div>
<div class="basic-info__item" v-if="detection.eventSeverity">
<i class="cn-icon cn-icon-severity-level"></i>
<span>{{$t('detections.eventSeverity')}}&nbsp;:&nbsp;&nbsp;</span>
<span>{{detection.eventSeverity || '-'}}</span>
</div>
<div class="basic-info__item" v-if="detection.securityType">
2022-02-18 17:54:22 +08:00
<i class="cn-icon cn-icon-event-type"></i>
<span>{{$t('detection.list.securityType')}}&nbsp;:&nbsp;&nbsp;</span>
<span>{{detection.securityType || '-'}}</span>
2022-02-18 17:54:22 +08:00
</div>
<div class="basic-info__item" v-if="detection.eventType">
<i class="cn-icon cn-icon-event-type"></i>
<span>{{$t('detections.eventType')}}&nbsp;:&nbsp;&nbsp;</span>
<span>{{detection.eventType || '-'}}</span>
</div>
<div class="basic-info__item" v-if="detection.malwareName">
2022-02-18 17:54:22 +08:00
<i class="cn-icon cn-icon-trojan"></i>
<span>{{$t('detection.list.malwareName')}}&nbsp;:&nbsp;&nbsp;</span>
<span>{{detection.malwareName || '-'}}</span>
2022-02-18 17:54:22 +08:00
</div>
<div class="basic-info__item" v-if="detection.cryptominingPool">
2022-02-18 17:54:22 +08:00
<i class="cn-icon cn-icon-mining-pool"></i>
<span>{{$t('detection.list.cryptominingPool')}}&nbsp;:&nbsp;&nbsp;</span>
<span>{{detection.cryptominingPool || '-'}}</span>
2022-02-14 22:22:31 +08:00
</div>
<div class="basic-info__item">
2022-02-18 17:54:22 +08:00
<i class="cn-icon cn-icon-time2"></i>
<span>{{$t('detection.list.startTime')}}&nbsp;:&nbsp;&nbsp;</span>
<span>{{dayJs.tz(getMillisecond(detection.startTime)).format('YYYY-MM-DD HH:mm:ss') || '-'}}</span>
2022-02-14 22:22:31 +08:00
</div>
<div class="basic-info__item">
<i class="cn-icon cn-icon-time2"></i>
<span>{{$t('overall.duration')}}&nbsp;:&nbsp;&nbsp;</span>
<span style="display: inline-block;height: 6px;width: 6px;border-radius: 50%;margin-right: 8px;"
:style="pointColor(detection)"></span>
<span>{{unitConvert(detection.durationMs, 'time', null, null, 0).join(' ') || '-'}}</span>
</div>
2022-02-14 22:22:31 +08:00
</div>
</div>
</div>
</div>
<el-collapse-transition>
2022-02-18 17:54:22 +08:00
<div class="cn-detection__detail-overview" v-if="!isCollapse">
2022-02-14 22:22:31 +08:00
<el-divider></el-divider>
<detection-security-event-overview
v-if="pageType === detectionPageType.securityEvent"
:detection="detection"
2022-02-14 22:22:31 +08:00
:time-filter="timeFilter"
></detection-security-event-overview>
<template v-else>
<detection-performance-event-ip-overview
v-if="detection.entityType === entityType.ip.toLowerCase()"
:detection="detection"
:time-filter="timeFilter"
></detection-performance-event-ip-overview>
<detection-performance-event-domain-overview
v-else-if="detection.entityType === entityType.domain.toLowerCase()"
:detection="detection"
:time-filter="timeFilter"
></detection-performance-event-domain-overview>
<detection-performance-event-app-overview
v-else-if="detection.entityType === entityType.app.toLowerCase()"
:detection="detection"
:time-filter="timeFilter"
></detection-performance-event-app-overview>
</template>
2022-02-14 22:22:31 +08:00
</div>
</el-collapse-transition>
</div>
</div>
</template>
<script>
import { eventSeverityColor, detectionPageType, entityType } from '@/utils/constants'
2022-02-22 22:22:15 +08:00
import { getMillisecond } from '@/utils/date-util'
import unitConvert from '@/utils/unit-convert'
import DetectionSecurityEventOverview from '@/views/detections/overview/DetectionSecurityEventOverview'
import DetectionPerformanceEventIpOverview from '@/views/detections/overview/DetectionPerformanceEventIpOverview'
import DetectionPerformanceEventAppOverview from '@/views/detections/overview/DetectionPerformanceEventAppOverview'
import DetectionPerformanceEventDomainOverview from '@/views/detections/overview/DetectionPerformanceEventDomainOverview'
2022-02-14 22:22:31 +08:00
export default {
name: 'DetectionRow',
components: {
DetectionSecurityEventOverview,
DetectionPerformanceEventIpOverview,
DetectionPerformanceEventAppOverview,
DetectionPerformanceEventDomainOverview
2022-02-14 22:22:31 +08:00
},
props: {
index: Number,
2022-02-18 17:54:22 +08:00
timeFilter: Object,
detection: Object,
pageType: String // 安全事件、服务质量
2022-02-14 22:22:31 +08:00
},
data () {
return {
entityType,
detectionPageType,
2022-02-18 17:54:22 +08:00
isCollapse: true, // 是否是折叠状态
2022-02-22 22:22:15 +08:00
eventSeverityColor
2022-02-14 22:22:31 +08:00
}
},
computed: {
iconClass () {
let className
switch (this.detection.entityType) {
case ('ip'): {
className = 'cn-icon cn-icon-ip'
break
}
case ('domain'): {
className = 'cn-icon cn-icon-domain'
break
}
case ('app'): {
className = 'cn-icon cn-icon-app'
break
}
default:
break
}
return className
},
pointColor () {
return function (detection) {
let color = '#8FA1BE'
if (detection.startTime && detection.endTime) {
if (getMillisecond(detection.endTime) - getMillisecond(detection.startTime) < 5 * 60 * 1000) {
color = '#D84C4C'
}
}
return { backgroundColor: color }
}
}
},
2022-02-14 22:22:31 +08:00
methods: {
unitConvert,
2022-02-22 22:22:15 +08:00
getMillisecond,
2022-02-14 22:22:31 +08:00
/* 切换折叠状态 */
switchCollapse () {
this.isCollapse = !this.isCollapse
this.$emit('switchCollapse', this.isCollapse, this.index)
},
/* 设为折叠状态 */
collapse () {
this.isCollapse = true
}
}
}
</script>