CN-866 fix: 单测用例--network overview ddos检测图

This commit is contained in:
@changcode
2023-01-30 14:02:28 +08:00
parent 7ce190f3c7
commit 049d5f92b4
4 changed files with 119 additions and 29 deletions

View File

@@ -29,13 +29,13 @@
<script>
import { api } from '@/utils/api'
import { get } from '@/utils/http'
import { getSecond } from '@/utils/date-util'
import ChartNoData from '@/views/charts/charts/ChartNoData'
import chartMixin from '@/views/charts2/chart-mixin'
import ChartError from '@/components/common/Error'
import unitConvert from '@/utils/unit-convert'
import { unitTypes } from '@/utils/constants'
import axios from 'axios'
export default {
name: 'NetworkOverviewDdosDetection',
components: {
@@ -67,16 +67,12 @@ export default {
endTime: this.timeFilter && this.timeFilter.endTime ? getSecond(this.timeFilter.endTime) : ''
}
this.toggleLoading(true)
get(api.netWorkOverview.ddosEventAnalysis, params).then(res => {
axios.get(api.netWorkOverview.ddosEventAnalysis, { params: params }).then(res => {
res = res.data
if (res.code === 200) {
this.showError = false
this.isNoData = res.data.result.length === 0
this.ddosData = res.data.result[0]
this.ddosData = {
attackEventCount: 1200000,
attackerCount: 2687878,
victimCount: 36676767
}
} else {
this.isNoData = false
this.showError = true
@@ -92,7 +88,9 @@ export default {
}
},
mounted () {
this.ddosDetectDataRequests()
this.$nextTick(() => {
this.ddosDetectDataRequests()
})
},
beforeUnmount () {
this.unitConvert = null

View File

@@ -2,21 +2,21 @@
<div class="npm-header">
<div class="npm-header-body" v-for="(item, index) in chartData" :key=index>
<div class="npm-header-body-severity">
<div class="npm-header-body-severity-icon" :class="item.eventSeverity"></div>
<div class="npm-header-body-severity-value">{{item.eventSeverity}}</div>
<div class="npm-header-body-severity-icon" :class="item.eventSeverity" :test-id="`icon${index}`"></div>
<div class="npm-header-body-severity-value" :test-id="`severity${index}`">{{item.eventSeverity}}</div>
</div>
<chart-error v-if="showError" tooltip :content="errorMsg" />
<div v-else class="npm-header-body-total">{{item.count}}</div>
<div v-else class="npm-header-body-total" :test-id="`total${index}`">{{item.count}}</div>
</div>
</div>
</template>
<script>
import { getSecond } from '@/utils/date-util'
import { get } from '@/utils/http'
import { api } from '@/utils/api'
import chartMixin from '@/views/charts2/chart-mixin'
import ChartError from '@/components/common/Error'
import axios from 'axios'
export default {
name: 'NpmEventsHeader',
components: { ChartError },
@@ -65,12 +65,13 @@ export default {
methods: {
recentEventsListData () {
const params = {
startTime: getSecond(this.timeFilter.startTime),
endTime: getSecond(this.timeFilter.endTime),
startTime: this.timeFilter && this.timeFilter.startTime ? getSecond(this.timeFilter.startTime) : '',
endTime: this.timeFilter && this.timeFilter.endTime ? getSecond(this.timeFilter.endTime) : '',
type: this.type
}
this.toggleLoading(true)
get(api.npm.events.list, params).then(res => {
axios.get(api.npm.events.list, { params: params }).then(res => {
res = res.data
if (res.code === 200) {
this.showError = false
if (res.data.result.length === 0) {
@@ -96,7 +97,9 @@ export default {
}
},
mounted () {
this.recentEventsListData()
this.$nextTick(() => {
this.recentEventsListData()
})
}
}
</script>