This {{ informationForDeletion.title }} will be deleted along with any associated settings
@@ -112,10 +113,13 @@
})
const loading = ref(false)
+ const canDelete = ref(false)
const deleteDialogVisible = ref(false)
const removeItem = async () => {
+ if (canDelete.value === false) return
if (!meta.value.valid) return
+
loading.value = true
let toastConfig = {
closable: true,
@@ -162,10 +166,20 @@
() => props.informationForDeletion,
(value) => {
if (value) {
+ canDelete.value = false
resetForm()
deleteDialogVisible.value = props.informationForDeletion.deleteDialogVisible
}
},
{ deep: true }
)
+ watch(
+ () => confirmation.value,
+ (value) => {
+ if (value) {
+ canDelete.value = true
+ }
+ },
+ { deep: true }
+ )
diff --git a/src/tests/services/edge-application-functions-services/load-function-service.test.js b/src/tests/services/edge-application-functions-services/load-function-service.test.js
index 536eb2398..5dd2c51a6 100644
--- a/src/tests/services/edge-application-functions-services/load-function-service.test.js
+++ b/src/tests/services/edge-application-functions-services/load-function-service.test.js
@@ -51,7 +51,7 @@ describe('LoaderFunctionService', () => {
id: fixture.functionInstance.id,
edgeFunctionID: fixture.functionInstance.edge_function_id,
name: fixture.functionInstance.name,
- args: JSON.stringify(fixture.functionInstance.args)
+ args: JSON.stringify(fixture.functionInstance.args, null, '\t')
})
})
diff --git a/src/tests/services/edge-firewall-functions-services/load-function-service.test.js b/src/tests/services/edge-firewall-functions-services/load-function-service.test.js
index ec084fb02..cb2fc6cae 100644
--- a/src/tests/services/edge-firewall-functions-services/load-function-service.test.js
+++ b/src/tests/services/edge-firewall-functions-services/load-function-service.test.js
@@ -51,7 +51,7 @@ describe('EdgeFirewallFunctionsServices', () => {
id: fixture.functionInstance.id,
edgeFunctionID: fixture.functionInstance.edge_function,
name: fixture.functionInstance.name,
- args: JSON.stringify(fixture.functionInstance.json_args)
+ args: JSON.stringify(fixture.functionInstance.json_args, null, '\t')
})
})
diff --git a/src/tests/services/edge-service-resources-services/create-resources-services.test.js b/src/tests/services/edge-service-resources-services/create-resources-services.test.js
index 914aef0b5..ba5add877 100644
--- a/src/tests/services/edge-service-resources-services/create-resources-services.test.js
+++ b/src/tests/services/edge-service-resources-services/create-resources-services.test.js
@@ -26,14 +26,14 @@ describe('EdgeServiceResourcesServices', () => {
statusCode: 201,
body: { id: '123' }
})
-
+ const version = 'v3'
const { sut } = makeSut()
await sut(fixtures.mock)
expect(requestSpy).toHaveBeenCalledWith({
method: 'POST',
- url: `edge_services/${fixtures.mock.id}/resources`,
+ url: `${version}/edge_services/${fixtures.mock.id}/resources`,
body: {
name: 'X Edge Service',
trigger: 'TEST',
diff --git a/src/tests/services/edge-service-resources-services/delete-resources-services.test.js b/src/tests/services/edge-service-resources-services/delete-resources-services.test.js
index 091881d2a..5fec7921b 100644
--- a/src/tests/services/edge-service-resources-services/delete-resources-services.test.js
+++ b/src/tests/services/edge-service-resources-services/delete-resources-services.test.js
@@ -23,13 +23,13 @@ describe('EdgeServiceResourcesServices', () => {
const requestSpy = vi.spyOn(AxiosHttpClientAdapter, 'request').mockResolvedValueOnce({
statusCode: 204
})
+ const version = 'v3'
const { sut } = makeSut()
-
await sut(fixtures.mock)
expect(requestSpy).toHaveBeenCalledWith({
method: 'DELETE',
- url: `edge_services/${fixtures.mock.edgeServiceId}/resources/${fixtures.mock.id}`
+ url: `${version}/edge_services/${fixtures.mock.edgeServiceId}/resources/${fixtures.mock.id}`
})
})
diff --git a/src/tests/services/edge-service-resources-services/edit-resources-services.test.js b/src/tests/services/edge-service-resources-services/edit-resources-services.test.js
index a89a1ca05..465ad4330 100644
--- a/src/tests/services/edge-service-resources-services/edit-resources-services.test.js
+++ b/src/tests/services/edge-service-resources-services/edit-resources-services.test.js
@@ -34,13 +34,14 @@ describe('EdgeServiceResourcesServices', () => {
statusCode: 200,
body: fixtures.mockResponse
})
+ const version = 'v3'
const { sut } = makeSut()
await sut(fixtures.mockPayload)
const { id, edgeServiceId } = fixtures.mockPayload
expect(requestSpy).toHaveBeenCalledWith({
- url: `edge_services/${edgeServiceId}/resources/${id}`,
+ url: `${version}/edge_services/${edgeServiceId}/resources/${id}`,
method: 'PATCH',
body: fixtures.mockResponse
})
diff --git a/src/tests/services/edge-service-resources-services/list-resources-services.test.js b/src/tests/services/edge-service-resources-services/list-resources-services.test.js
index 24d683d70..f2a32889d 100644
--- a/src/tests/services/edge-service-resources-services/list-resources-services.test.js
+++ b/src/tests/services/edge-service-resources-services/list-resources-services.test.js
@@ -53,13 +53,13 @@ describe('EdgeServiceResourcesServices', () => {
})
const edgeServiceIdMock = 1
const { sut } = makeSut()
-
+ const version = 'v3'
await sut({
id: edgeServiceIdMock
})
expect(requestSpy).toHaveBeenCalledWith({
- url: `edge_services/${edgeServiceIdMock}/resources?filter=&order_by=name&sort=asc&page=1&page_size=200`,
+ url: `${version}/edge_services/${edgeServiceIdMock}/resources?filter=&order_by=name&sort=asc&page=1&page_size=200`,
method: 'GET'
})
})
diff --git a/src/tests/services/edge-service-resources-services/load-resources-services.test.js b/src/tests/services/edge-service-resources-services/load-resources-services.test.js
index d42942773..92ea8cd68 100644
--- a/src/tests/services/edge-service-resources-services/load-resources-services.test.js
+++ b/src/tests/services/edge-service-resources-services/load-resources-services.test.js
@@ -29,13 +29,14 @@ describe('EdgeServiceResourcesServices', () => {
const id = 812783
const edgeServiceId = 7879123
const { sut } = makeSut()
+ const version = 'v3'
await sut({
id,
edgeServiceId
})
expect(requestSpy).toHaveBeenCalledWith({
- url: `edge_services/${edgeServiceId}/resources/${id}`,
+ url: `${version}/edge_services/${edgeServiceId}/resources/${id}`,
method: 'GET'
})
})
diff --git a/src/tests/services/edge-service-resources-services/make-resources-base-url.test.js b/src/tests/services/edge-service-resources-services/make-resources-base-url.test.js
index b50529fed..02c8a413f 100644
--- a/src/tests/services/edge-service-resources-services/make-resources-base-url.test.js
+++ b/src/tests/services/edge-service-resources-services/make-resources-base-url.test.js
@@ -12,7 +12,8 @@ const makeSut = () => {
describe('EdgeServiceServices', () => {
it('should return the API base url to edge services service', () => {
const { sut } = makeSut()
- const correctApiUrl = 'edge_services'
+ const version = 'v3'
+ const correctApiUrl = `${version}/edge_services`
const baseUrl = sut()
diff --git a/src/tests/services/users-services/create-users-service.test.js b/src/tests/services/users-services/create-users-service.test.js
index ed2e7f32c..dd3490058 100644
--- a/src/tests/services/users-services/create-users-service.test.js
+++ b/src/tests/services/users-services/create-users-service.test.js
@@ -10,7 +10,7 @@ const fixtures = {
timezone: 'America/New_York',
language: 'en_US',
email: 'johndoe@example.com',
- countryCallCode: { value: 'AF +93' },
+ countryCallCode: 'AF +93',
mobile: '+1-123-456-7890',
isAccountOwner: true,
teamsIds: 1,
@@ -43,7 +43,7 @@ describe('UsersServices', () => {
last_name: fixtures.userMock.lastName,
timezone: fixtures.userMock.timezone,
language: fixtures.userMock.language,
- country_call_code: fixtures.userMock.countryCallCode.value,
+ country_call_code: fixtures.userMock.countryCallCode,
email: fixtures.userMock.email,
mobile: fixtures.userMock.mobile,
is_account_owner: fixtures.userMock.isAccountOwner,
diff --git a/src/tests/services/users-services/edit-user-service.test.js b/src/tests/services/users-services/edit-user-service.test.js
index f6396a99d..45f75c2b8 100644
--- a/src/tests/services/users-services/edit-user-service.test.js
+++ b/src/tests/services/users-services/edit-user-service.test.js
@@ -11,11 +11,7 @@ const fixtures = {
timezone: 'GMT',
language: 'en',
email: 'test.test@azion.com',
- countryCallCode: {
- label: 'AL (Albania) +355',
- labelFormat: 'AL +355',
- value: 'AL - 355'
- },
+ countryCallCode: 'AL - 355',
mobile: 12312312,
isAccountOwner: false,
teamsIds: [1580],
@@ -49,7 +45,7 @@ describe('UsersService', () => {
timezone: fixtures.userMock.timezone,
language: fixtures.userMock.language,
email: fixtures.userMock.email,
- country_call_code: fixtures.userMock.countryCallCode.value,
+ country_call_code: fixtures.userMock.countryCallCode,
mobile: fixtures.userMock.mobile.toString(),
is_account_owner: fixtures.userMock.isAccountOwner,
teams_ids: fixtures.userMock.teamsIds,
diff --git a/src/tests/services/users-services/load-another-user-service.test.js b/src/tests/services/users-services/load-another-user-service.test.js
new file mode 100644
index 000000000..e1c8b0337
--- /dev/null
+++ b/src/tests/services/users-services/load-another-user-service.test.js
@@ -0,0 +1,84 @@
+import { AxiosHttpClientAdapter } from '@/services/axios/AxiosHttpClientAdapter'
+import { loadAnotherUserService } from '@/services/users-services'
+import { describe, expect, it, vi } from 'vitest'
+
+const fixtures = {
+ userMock: {
+ id: 4462,
+ last_login: '2023-12-08T11:35:55.072822Z',
+ first_name: 'test name',
+ last_name: 'test last name',
+ email: 'test@azion.com',
+ is_staff: false,
+ is_active: false,
+ phone: null,
+ country_call_code: 'AL - 355',
+ mobile: '16993388829',
+ date_joined: '2023-12-08T11:35:55.072822Z',
+ timezone: 'GMT',
+ language: 'en',
+ is_trial: false,
+ two_factor_enabled: false,
+ is_account_owner: false,
+ teams: [{ id: 1580, name: 'Default Team', is_active: true }]
+ }
+}
+
+const makeSut = () => {
+ const sut = loadAnotherUserService
+
+ return {
+ sut
+ }
+}
+
+describe('UsersServices', () => {
+ it('should call api with correct params', async () => {
+ const requestSpy = vi.spyOn(AxiosHttpClientAdapter, 'request').mockResolvedValueOnce({
+ statusCode: 200,
+ body: { data: fixtures.userMock }
+ })
+
+ const { sut } = makeSut()
+
+ const userId = fixtures.userMock.id
+ await sut({ id: userId })
+
+ const version = 'v4'
+ expect(requestSpy).toHaveBeenCalledWith({
+ url: `${version}/iam/users/${userId}`,
+ method: 'GET'
+ })
+ })
+
+ it('should parse correctly each returned item', async () => {
+ vi.spyOn(AxiosHttpClientAdapter, 'request').mockResolvedValueOnce({
+ statusCode: 200,
+ body: { data: fixtures.userMock }
+ })
+ const { sut } = makeSut()
+
+ const result = await sut({ id: fixtures.userMock.id })
+
+ expect(result).toEqual({
+ id: fixtures.userMock.id,
+ firstName: fixtures.userMock.first_name,
+ lastName: fixtures.userMock.last_name,
+ email: fixtures.userMock.email,
+ countryCallCode: fixtures.userMock.country_call_code,
+ mobile: fixtures.userMock.mobile,
+ timezone: fixtures.userMock.timezone,
+ language: fixtures.userMock.language,
+ twoFactorEnabled: fixtures.userMock.two_factor_enabled,
+ isAccountOwner: fixtures.userMock.is_account_owner,
+ teamsIds: [fixtures.userMock.teams[0].id],
+ dateJoined: fixtures.userMock.date_joined,
+ isActive: fixtures.userMock.is_active,
+ isStaff: fixtures.userMock.is_staff,
+ isTrial: fixtures.userMock.is_trial,
+ lastLogin: fixtures.userMock.last_login,
+ phone: fixtures.userMock.phone,
+ teams: fixtures.userMock.teams
+ })
+ })
+})
diff --git a/src/views/EdgeApplicationsFunctions/FormFields/FormFieldsEdgeApplicationsFunctions.vue b/src/views/EdgeApplicationsFunctions/FormFields/FormFieldsEdgeApplicationsFunctions.vue
index b4748cea2..5d6c850e7 100644
--- a/src/views/EdgeApplicationsFunctions/FormFields/FormFieldsEdgeApplicationsFunctions.vue
+++ b/src/views/EdgeApplicationsFunctions/FormFields/FormFieldsEdgeApplicationsFunctions.vue
@@ -95,7 +95,8 @@
class="min-h-[200px] overflow-clip surface-border border rounded-md"
/>
- Customize the arguments in JSON format. Once set, they can be called in code using event.args("arg_name")
.
+ Customize the arguments in JSON format. Once set, they can be called in code using
+ event.args("arg_name")
.