2022-07-08 09:34:09 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="ddos-detection">
|
2022-07-14 17:07:07 +08:00
|
|
|
<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>
|
2022-07-14 17:07:07 +08:00
|
|
|
<div class="ddos-detection-type-value">
|
|
|
|
|
<div class="ddos-detection-type-value-name">{{$t('network.numberOfAttacks')}}</div>
|
2022-08-04 10:26:11 +08:00
|
|
|
<div class="ddos-detection-type-value-number">{{$_.get(ddosData, 'attackerCount') || 0}}</div>
|
2022-07-14 17:07:07 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="ddos-detection-type-value">
|
|
|
|
|
<div class="ddos-detection-type-value-name">{{$t('network.number0fVictims')}}</div>
|
2022-08-04 10:26:11 +08:00
|
|
|
<div class="ddos-detection-type-value-number">{{$_.get(ddosData, 'victimCount') || 0}}</div>
|
2022-07-14 17:07:07 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="ddos-detection-type-value">
|
|
|
|
|
<div class="ddos-detection-type-value-name">{{$t('network.number0fDetectedAttackEvents')}}</div>
|
2022-08-04 10:26:11 +08:00
|
|
|
<div class="ddos-detection-type-value-number">{{$_.get(ddosData, 'attackEventCount') || 0}}</div>
|
2022-07-14 17:07:07 +08:00
|
|
|
</div>
|
2022-07-08 09:34:09 +08:00
|
|
|
</div>
|
2022-07-14 17:07:07 +08:00
|
|
|
<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>
|
2022-08-04 10:26:11 +08:00
|
|
|
import { api } from '@/utils/api'
|
|
|
|
|
import { get } from '@/utils/http'
|
2022-08-05 15:50:54 +08:00
|
|
|
import { getSecond } from '@/utils/date-util'
|
2022-08-10 09:24:53 +08:00
|
|
|
import ChartNoData from '@/views/charts/charts/ChartNoData'
|
2022-08-21 22:11:53 +08:00
|
|
|
import chartMixin from '@/views/charts2/chart-mixin'
|
2022-07-08 09:34:09 +08:00
|
|
|
export default {
|
2022-08-04 10:26:11 +08:00
|
|
|
name: 'NetworkOverviewDdosDetection',
|
2022-08-10 09:24:53 +08:00
|
|
|
components: {
|
|
|
|
|
ChartNoData
|
|
|
|
|
},
|
2022-08-21 22:11:53 +08:00
|
|
|
mixins: [chartMixin],
|
2022-08-04 10:26:11 +08:00
|
|
|
data () {
|
|
|
|
|
return {
|
2022-08-10 09:24:53 +08:00
|
|
|
ddosData: {},
|
|
|
|
|
isNoData: false
|
2022-08-04 10:26:11 +08:00
|
|
|
}
|
|
|
|
|
},
|
2022-08-23 21:42:42 +08:00
|
|
|
watch: {
|
|
|
|
|
timeFilter: {
|
|
|
|
|
deep: true,
|
|
|
|
|
handler (n) {
|
|
|
|
|
this.ddosDetectDataRequests()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-08-04 10:26:11 +08:00
|
|
|
methods: {
|
|
|
|
|
ddosDetectDataRequests () {
|
|
|
|
|
const params = {
|
2022-08-05 15:50:54 +08:00
|
|
|
startTime: getSecond(this.timeFilter.startTime),
|
|
|
|
|
endTime: getSecond(this.timeFilter.endTime)
|
2022-08-04 10:26:11 +08:00
|
|
|
}
|
2022-08-21 22:11:53 +08:00
|
|
|
this.toggleLoading(true)
|
2022-08-04 10:26:11 +08:00
|
|
|
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
|
2022-08-21 22:11:53 +08:00
|
|
|
} else {
|
|
|
|
|
this.isNoData = false
|
2022-08-10 09:24:53 +08:00
|
|
|
}
|
2022-08-04 10:26:11 +08:00
|
|
|
this.ddosData = res.data.result[0]
|
|
|
|
|
}
|
2022-08-21 22:11:53 +08:00
|
|
|
}).finally(() => {
|
|
|
|
|
this.toggleLoading(false)
|
2022-08-04 10:26:11 +08:00
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted () {
|
|
|
|
|
this.ddosDetectDataRequests()
|
|
|
|
|
}
|
2022-07-08 09:34:09 +08:00
|
|
|
}
|
|
|
|
|
</script>
|