Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UXE-6045] feat: migrate network list dropdown api v4 #2066

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/router/routes/edge-firewall-routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as EdgeFunctionServiceV4 from '@/services/edge-functions-services/v4'
import * as EdgeFirewallRulesEngineServicesV4 from '@/services/edge-firewall-rules-engine-services/v4'

import * as WafRulesServices from '@/services/waf-rules-services'
import * as NetworkListsService from '@/services/network-lists-services'
import * as NetworkListsServiceV4 from '@/services/network-lists-services/v4'

/** @type {import('vue-router').RouteRecordRaw} */
export const edgeFirewallRoutes = {
Expand Down Expand Up @@ -62,7 +62,7 @@ export const edgeFirewallRoutes = {
component: () => import('@/views/EdgeFirewall/TabsView.vue'),
props: {
listDomainsService: DomainServices.listDomainsService,
listNetworkListService: NetworkListsService.listNetworkListService,
listNetworkListService: NetworkListsServiceV4.listNetworkListService,
edgeFirewallServices: {
loadEdgeFirewallService: EdgeFirewallServicesV4.loadEdgeFirewallService,
editEdgeFirewallService: EdgeFirewallServicesV4.editEdgeFirewallService,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AxiosHttpClientAdapter, parseHttpResponse } from '../axios/AxiosHttpClientAdapter'
import { makeNetworkListBaseUrl } from '../network-lists-services/make-network-list-base-url'
import { makeNetworkListBaseUrl } from '../network-lists-services/v4/make-network-list-service'

export const listNetworkListService = async () => {
let httpResponse = await AxiosHttpClientAdapter.request({
url: `${makeNetworkListBaseUrl()}?pagination=false&exclude_azion_lists=true`,
url: `${makeNetworkListBaseUrl()}?page_size=100`,
method: 'GET'
})

Expand All @@ -16,12 +16,11 @@ const adapt = (httpResponse) => {

const networkList = isArray
? httpResponse.body.results.map((networkList) => {
const disabledIP = networkList.list_type === 'ip_cidr'
const disabledCountries = networkList.list_type === 'countries'
const disabledIP = networkList.type === 'ip_cidr'
const disabledCountries = networkList.type === 'countries'
return {
value: {
id: networkList.id,
value: networkList.value,
disabledIP,
disabledCountries
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('WafRulesServices', () => {
await sut()

expect(requestSpy).toHaveBeenCalledWith({
url: `v3/network_lists?pagination=false&exclude_azion_lists=true`,
url: `v4/workspace/network_lists?page_size=100`,
method: 'GET'
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,8 @@
const setNetworkListOptions = async () => {
try {
loadingNetworkList.value = true
const result = await props.listNetworkListService()
networkListOptions.value = result
const { body } = await props.listNetworkListService({ pageSize: 100 })
networkListOptions.value = body
} catch (error) {
toast.add({
closable: true,
Expand Down
Loading