diff --git a/package.json b/package.json index 7865e15a7..fe73371e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "azion-platform-kit", - "version": "1.8.1", + "version": "1.8.2", "private": true, "type": "module", "repository": { diff --git a/src/router/routes/users-routes/index.js b/src/router/routes/users-routes/index.js index 9c42a4522..112579ed3 100644 --- a/src/router/routes/users-routes/index.js +++ b/src/router/routes/users-routes/index.js @@ -58,7 +58,7 @@ export const usersListsRoutes = { listTimezonesService: UsersService.listTimezonesService, listTeamsService: UsersService.listTeamsService, editAnotherUserService: UsersService.editAnotherUserService, - loadUserService: UsersService.loadUserService, + loadAnotherUserService: UsersService.loadAnotherUserService, updatedRedirect: 'list-users' }, meta: { diff --git a/src/services/edge-application-functions-services/loader-function-service.js b/src/services/edge-application-functions-services/loader-function-service.js index 46e989eca..89c0647c0 100644 --- a/src/services/edge-application-functions-services/loader-function-service.js +++ b/src/services/edge-application-functions-services/loader-function-service.js @@ -17,7 +17,7 @@ const adapt = (httpResponse) => { id: httpResponse.body.results.id, edgeFunctionID: httpResponse.body.results.edge_function_id, name: httpResponse.body.results.name, - args: JSON.stringify(httpResponse.body.results.args) + args: JSON.stringify(httpResponse.body.results.args, null, '\t') } return { diff --git a/src/services/edge-firewall-functions-services/loader-function-service.js b/src/services/edge-firewall-functions-services/loader-function-service.js index a36805493..c8b99abdb 100644 --- a/src/services/edge-firewall-functions-services/loader-function-service.js +++ b/src/services/edge-firewall-functions-services/loader-function-service.js @@ -17,7 +17,7 @@ const adapt = (httpResponse) => { id: httpResponse.body.results.id, edgeFunctionID: httpResponse.body.results.edge_function, name: httpResponse.body.results.name, - args: JSON.stringify(httpResponse.body.results.json_args) + args: JSON.stringify(httpResponse.body.results.json_args, null, '\t') } return { diff --git a/src/services/edge-service-resources-services/make-resources-base-url.js b/src/services/edge-service-resources-services/make-resources-base-url.js index 976468403..f7fa3cbe7 100644 --- a/src/services/edge-service-resources-services/make-resources-base-url.js +++ b/src/services/edge-service-resources-services/make-resources-base-url.js @@ -1,3 +1,4 @@ export const makeResourcesBaseUrl = () => { - return `edge_services` + const version = 'v3' + return `${version}/edge_services` } diff --git a/src/services/users-services/create-users-service.js b/src/services/users-services/create-users-service.js index 7eedec547..96d12d753 100644 --- a/src/services/users-services/create-users-service.js +++ b/src/services/users-services/create-users-service.js @@ -21,7 +21,7 @@ const adapt = (payload) => { email: payload.email, language: payload.language, timezone: payload.timezone, - country_call_code: payload.countryCallCode.value, + country_call_code: payload.countryCallCode, mobile: payload.mobile?.toString(), is_account_owner: payload.isAccountOwner, teams_ids: payload.teamsIds, diff --git a/src/services/users-services/edit-another-user-service.js b/src/services/users-services/edit-another-user-service.js index 0e7d4b5be..e31c3dfd2 100644 --- a/src/services/users-services/edit-another-user-service.js +++ b/src/services/users-services/edit-another-user-service.js @@ -21,7 +21,7 @@ const adapt = (payload) => { email: payload.email, language: payload.language, timezone: payload.timezone, - country_call_code: payload.countryCallCode.value, + country_call_code: payload.countryCallCode, mobile: payload.mobile?.toString(), is_account_owner: payload.isAccountOwner, teams_ids: payload.teamsIds, diff --git a/src/services/users-services/index.js b/src/services/users-services/index.js index b18b8a0e6..1dbf2be51 100644 --- a/src/services/users-services/index.js +++ b/src/services/users-services/index.js @@ -9,6 +9,7 @@ import { listTeamsService } from './list-teams-service' import { editAnotherUserService } from './edit-another-user-service' import { loadUserService } from './load-user-service' import { editUsersService } from './edit-users-service' +import { loadAnotherUserService } from './load-another-user-service' export { listUsersService, @@ -21,5 +22,6 @@ export { listTeamsService, loadUserService, editAnotherUserService, - editUsersService + editUsersService, + loadAnotherUserService } diff --git a/src/services/users-services/load-another-user-service.js b/src/services/users-services/load-another-user-service.js new file mode 100644 index 000000000..944277287 --- /dev/null +++ b/src/services/users-services/load-another-user-service.js @@ -0,0 +1,41 @@ +import { AxiosHttpClientAdapter, parseHttpResponse } from '../axios/AxiosHttpClientAdapter' +import { makeUsersBaseUrl } from './make-users-base-url' + +export const loadAnotherUserService = async ({ id }) => { + let httpResponse = await AxiosHttpClientAdapter.request({ + url: `${makeUsersBaseUrl()}/${id}`, + method: 'GET' + }) + httpResponse = adapt(httpResponse) + + return parseHttpResponse(httpResponse) +} + +const adapt = (httpResponse) => { + const responseData = httpResponse.body.data + const parsedUser = { + id: responseData.id, + firstName: responseData.first_name, + lastName: responseData.last_name, + email: responseData.email, + language: responseData.language, + timezone: responseData.timezone, + countryCallCode: responseData.country_call_code, + mobile: responseData.mobile, + isAccountOwner: responseData.is_account_owner, + teamsIds: responseData.teams.map((value) => value.id), + twoFactorEnabled: responseData.two_factor_enabled, + dateJoined: responseData.date_joined, + isActive: responseData.is_active, + isStaff: responseData.is_staff, + isTrial: responseData.is_trial, + lastLogin: responseData.last_login, + phone: responseData.phone, + teams: responseData.teams + } + + return { + body: parsedUser, + statusCode: httpResponse.statusCode + } +} diff --git a/src/templates/create-form-block/index.vue b/src/templates/create-form-block/index.vue index a94b888f5..19768175c 100644 --- a/src/templates/create-form-block/index.vue +++ b/src/templates/create-form-block/index.vue @@ -41,7 +41,7 @@ return blockViewRedirection.value && isDirty.value }) - const { meta, errors, handleSubmit, isSubmitting, values } = useForm({ + const { meta, errors, handleSubmit, isSubmitting, values, resetForm } = useForm({ validationSchema: props.schema, initialValues: props.initialValues }) @@ -90,7 +90,10 @@ diff --git a/src/views/EdgeFirewall/TabsView.vue b/src/views/EdgeFirewall/TabsView.vue index abe52ae2f..01e86d46f 100644 --- a/src/views/EdgeFirewall/TabsView.vue +++ b/src/views/EdgeFirewall/TabsView.vue @@ -127,7 +127,7 @@ /> -