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/charts2/charts/networkOverview/NetworkOverviewDdosDetection.vue

78 lines
2.4 KiB
Vue
Raw Normal View History

2022-07-08 09:34:09 +08:00
<template>
<div class="ddos-detection">
<div class="ddos-detection-title"><i class="cn-icon cn-icon-a-DDosDetection"></i>{{$t('network.ddosDetection')}}</div>
<div class="ddos-detection-value">
2022-08-10 09:24:53 +08:00
<chart-no-data v-if="isNoData"></chart-no-data>
<div class="ddos-detection-type" v-else>
<div class="ddos-detection-type-value">
<div class="ddos-detection-type-value-name">{{$t('network.numberOfAttacks')}}</div>
<div class="ddos-detection-type-value-number">{{$_.get(ddosData, 'attackerCount') || 0}}</div>
</div>
<div class="ddos-detection-type-value">
<div class="ddos-detection-type-value-name">{{$t('network.number0fVictims')}}</div>
<div class="ddos-detection-type-value-number">{{$_.get(ddosData, 'victimCount') || 0}}</div>
</div>
<div class="ddos-detection-type-value">
<div class="ddos-detection-type-value-name">{{$t('network.number0fDetectedAttackEvents')}}</div>
<div class="ddos-detection-type-value-number">{{$_.get(ddosData, 'attackEventCount') || 0}}</div>
</div>
2022-07-08 09:34:09 +08:00
</div>
<el-button size="small">{{$t('network.ddosDetection')}}<i class="cn-icon cn-icon-arrow-right"></i></el-button>
2022-07-08 09:34:09 +08:00
</div>
</div>
</template>
<script>
import { api } from '@/utils/api'
import { get } from '@/utils/http'
import { getSecond } from '@/utils/date-util'
2022-08-10 09:24:53 +08:00
import ChartNoData from '@/views/charts/charts/ChartNoData'
import chartMixin from '@/views/charts2/chart-mixin'
2022-07-08 09:34:09 +08:00
export default {
name: 'NetworkOverviewDdosDetection',
2022-08-10 09:24:53 +08:00
components: {
ChartNoData
},
mixins: [chartMixin],
data () {
return {
2022-08-10 09:24:53 +08:00
ddosData: {},
isNoData: false
}
},
2022-08-23 21:42:42 +08:00
watch: {
timeFilter: {
deep: true,
handler (n) {
this.ddosDetectDataRequests()
}
}
},
methods: {
ddosDetectDataRequests () {
const params = {
startTime: getSecond(this.timeFilter.startTime),
endTime: getSecond(this.timeFilter.endTime)
}
this.toggleLoading(true)
get(api.netWorkOverview.ddosEventAnalysis, params).then(res => {
if (res.code === 200) {
2022-08-10 09:24:53 +08:00
if (res.data.result.length === 0) {
this.isNoData = true
return
} else {
this.isNoData = false
2022-08-10 09:24:53 +08:00
}
this.ddosData = res.data.result[0]
}
}).finally(() => {
this.toggleLoading(false)
})
}
},
mounted () {
this.ddosDetectDataRequests()
}
2022-07-08 09:34:09 +08:00
}
</script>