diff --git a/src/tests/services/waf-rules-services/list-waf-rules-tuning-attack-service.test.js b/src/tests/services/waf-rules-services/list-waf-rules-tuning-attack-service.test.js index db6743b5b..086204d63 100644 --- a/src/tests/services/waf-rules-services/list-waf-rules-tuning-attack-service.test.js +++ b/src/tests/services/waf-rules-services/list-waf-rules-tuning-attack-service.test.js @@ -5,16 +5,16 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' const fixtures = { wafRulesMock: { hit_count: 10, - top_10_ips: [{ ip: '120.103.10' }], + top_10_ips: [{ ip: '120.103.10', hits: 10 }], rule_id: 1000, ip_count: 8, match_zone: 'value', path_count: 10, - top_10_countries: [{ country: 'Brazil' }], + top_10_countries: [{ country: 'Brazil', hits: 10 }], matches_on: 'query_string', country_count: 10, match_value: 'value', - top_10_paths: [{ path: '/get' }] + top_10_paths: [{ path: '/get', hits: 10 }] } } @@ -63,17 +63,17 @@ describe('WafRulesService', () => { expect(result).toEqual([ { hitCount: fixtures.wafRulesMock.hit_count, - topIps: ['120.103.10'], + topIps: ['120.103.10 (10 hits)'], id: 0, ruleId: fixtures.wafRulesMock.rule_id, ipCount: fixtures.wafRulesMock.ip_count, matchZone: fixtures.wafRulesMock.match_zone, pathCount: fixtures.wafRulesMock.path_count, - topCountries: ['Brazil'], + topCountries: ['Brazil (10 hits)'], matchesOn: fixtures.wafRulesMock.matches_on, ruleDescription: fixtures.wafRulesMock.rule_description, countryCount: fixtures.wafRulesMock.country_count, - topPaths: ['/get'], + topPaths: ['/get (10 hits)'], matchValue: fixtures.wafRulesMock.match_value } ]) diff --git a/src/views/WafRules/Drawer/index.vue b/src/views/WafRules/Drawer/index.vue index 9f4b5b4bc..d93117843 100644 --- a/src/views/WafRules/Drawer/index.vue +++ b/src/views/WafRules/Drawer/index.vue @@ -6,6 +6,7 @@ import GoBack from '@/templates/action-bar-block/go-back' import InputText from 'primevue/inputtext' import EmptyDrawer from '@/templates/empty-drawer' + import { columnBuilder } from '@/templates/list-table-block/columns/column-builder' import WithSelectionBehavior from '@/templates/list-table-block/with-selection-behavior.vue' defineOptions({ @@ -74,7 +75,6 @@ loading.value = true const response = await props.listService(namePath) possibleAttacks.value = response - console.log(possibleAttacks.value) } catch (error) { showToast('error', error) } finally { @@ -133,17 +133,26 @@ { field: 'topIps', header: 'Top 10 IPs', - sortable: true + sortable: true, + type: 'component', + component: (columnData) => + columnBuilder({ data: columnData, columnAppearance: 'expand-column' }) }, { field: 'topCountries', header: 'Top 10 Countries', - sortable: true + sortable: true, + type: 'component', + component: (columnData) => + columnBuilder({ data: columnData, columnAppearance: 'expand-column' }) }, { field: 'topPaths', header: 'Top 10 Paths', - sortable: true + sortable: true, + type: 'component', + component: (columnData) => + columnBuilder({ data: columnData, columnAppearance: 'expand-column' }) } ]