From c296fa735925ca923fae84f08267c9f4d79333db Mon Sep 17 00:00:00 2001 From: Vincent BONMARCHAND Date: Tue, 3 Dec 2024 15:35:20 +0100 Subject: [PATCH 1/9] feat(kms): servicekey list ti implementation ref: MANAGER-16001 Signed-off-by: Vincent BONMARCHAND --- .../src/mocks/iam/iam.mock.ts | 6 + .../src/mocks/reference/reference.handler.ts | 27 +++ .../src/mocks/reference/reference.mock.ts | 52 +++++ .../mocks/serviceKeys/serviceKeys.handler.ts | 24 ++- .../src/mocks/serviceKeys/serviceKeys.mock.ts | 21 +- .../ServiceKeyList.page.spec.tsx | 183 ++++++++++++++++++ .../pages/serviceKey/ServiceKey.page.spec.tsx | 111 +++++++++++ .../src/pages/serviceKey/ServiceKey.page.tsx | 2 + .../src/types/okmsServiceKeyReference.type.ts | 4 +- .../src/utils/tests/renderTestApp.tsx | 6 + 10 files changed, 428 insertions(+), 8 deletions(-) create mode 100644 packages/manager/apps/key-management-service/src/mocks/reference/reference.handler.ts create mode 100644 packages/manager/apps/key-management-service/src/mocks/reference/reference.mock.ts create mode 100644 packages/manager/apps/key-management-service/src/pages/dashboard/serviceKeyList/ServiceKeyList.page.spec.tsx create mode 100644 packages/manager/apps/key-management-service/src/pages/serviceKey/ServiceKey.page.spec.tsx diff --git a/packages/manager/apps/key-management-service/src/mocks/iam/iam.mock.ts b/packages/manager/apps/key-management-service/src/mocks/iam/iam.mock.ts index 4ee21531e347..c97e698b92b2 100644 --- a/packages/manager/apps/key-management-service/src/mocks/iam/iam.mock.ts +++ b/packages/manager/apps/key-management-service/src/mocks/iam/iam.mock.ts @@ -1,6 +1,7 @@ import { IamCheckResponse } from '@ovh-ux/manager-react-components'; import { kmsIamActions } from '@/utils/iam/iam.constants'; import { okmsMock } from '../kms/okms.mock'; +import { serviceKeyMock } from '../serviceKeys/serviceKeys.mock'; export const kmsIamMock: IamCheckResponse[] = [ { @@ -8,4 +9,9 @@ export const kmsIamMock: IamCheckResponse[] = [ authorizedActions: [...Object.values(kmsIamActions)], unauthorizedActions: [], }, + { + urn: serviceKeyMock[0].iam.urn, + authorizedActions: [...Object.values(kmsIamActions)], + unauthorizedActions: [], + }, ]; diff --git a/packages/manager/apps/key-management-service/src/mocks/reference/reference.handler.ts b/packages/manager/apps/key-management-service/src/mocks/reference/reference.handler.ts new file mode 100644 index 000000000000..1304e978570e --- /dev/null +++ b/packages/manager/apps/key-management-service/src/mocks/reference/reference.handler.ts @@ -0,0 +1,27 @@ +import { Handler } from '../../../../../../../playwright-helpers'; +import { referenceServiceKeyMock } from './reference.mock'; + +export type GetReferenceMockParams = { + isReferenceKO?: boolean; +}; + +export const getReferenceMock = ({ + isReferenceKO, +}: GetReferenceMockParams): Handler[] => [ + { + url: '/okms/reference/serviceKey', + response: isReferenceKO + ? { + status: 500, + data: { + message: 'serviceKeys error', + }, + } + : () => { + console.log(referenceServiceKeyMock); + return referenceServiceKeyMock; + }, + status: isReferenceKO ? 500 : 200, + api: 'v2', + }, +]; diff --git a/packages/manager/apps/key-management-service/src/mocks/reference/reference.mock.ts b/packages/manager/apps/key-management-service/src/mocks/reference/reference.mock.ts new file mode 100644 index 000000000000..a0d4da5780ff --- /dev/null +++ b/packages/manager/apps/key-management-service/src/mocks/reference/reference.mock.ts @@ -0,0 +1,52 @@ +import { + OkmsKeyTypes, + OkmsServiceKeyOperations, +} from '@/types/okmsServiceKey.type'; +import OkmsServiceKeyReference, { + OkmsServiceKeyReferenceSize, +} from '@/types/okmsServiceKeyReference.type'; + +export const referenceServiceKeyMock: OkmsServiceKeyReference[] = [ + { + sizes: [ + { value: 128, default: false }, + { value: 192, default: false }, + { value: 256, default: true }, + ] as OkmsServiceKeyReferenceSize[], + type: OkmsKeyTypes.oct, + default: true, + operations: [ + { + value: [ + OkmsServiceKeyOperations.encrypt, + OkmsServiceKeyOperations.decrypt, + ], + default: true, + }, + { + value: [ + OkmsServiceKeyOperations.wrapKey, + OkmsServiceKeyOperations.unwrapKey, + ], + default: false, + }, + ], + curves: [], + }, + { + sizes: [], + type: OkmsKeyTypes.EC, + default: false, + operations: [ + { + value: [OkmsServiceKeyOperations.sign, OkmsServiceKeyOperations.verify], + default: true, + }, + ], + curves: [ + { default: true, value: 'P-256' }, + { default: false, value: 'P-384' }, + { default: false, value: 'P-521' }, + ], + }, +]; diff --git a/packages/manager/apps/key-management-service/src/mocks/serviceKeys/serviceKeys.handler.ts b/packages/manager/apps/key-management-service/src/mocks/serviceKeys/serviceKeys.handler.ts index 549ff1e38c16..571bc6bf9c42 100644 --- a/packages/manager/apps/key-management-service/src/mocks/serviceKeys/serviceKeys.handler.ts +++ b/packages/manager/apps/key-management-service/src/mocks/serviceKeys/serviceKeys.handler.ts @@ -7,8 +7,8 @@ export type GetServiceKeysMockParams = { nbServiceKey?: number; }; -const findOkmsById = (params: PathParams) => - serviceKeyMock.find(({ id }) => id === params.id); +const findServiceKeyById = (params: PathParams) => + serviceKeyMock.find(({ id }) => id === params.serviceKeyId); export const getServiceKeysMock = ({ isServiceKeyKO, @@ -23,7 +23,7 @@ export const getServiceKeysMock = ({ message: 'serviceKeys error', }, } - : (_: unknown, params: PathParams) => findOkmsById(params), + : serviceKeyMock.slice(0, nbServiceKey), status: isServiceKeyKO ? 500 : 200, api: 'v2', }, @@ -31,8 +31,24 @@ export const getServiceKeysMock = ({ url: '/okms/resource/:okmsId/serviceKey/:serviceKeyId', response: isServiceKeyKO ? { message: 'serviceKey error' } - : serviceKeyMock.slice(0, nbServiceKey), + : (_: unknown, params: PathParams) => findServiceKeyById(params), status: isServiceKeyKO ? 500 : 200, api: 'v2', }, + { + url: '/okms/resource/:okmsId/serviceKey/:serviceKeyId', + method: 'put', + response: (_: unknown, params: PathParams) => findServiceKeyById(params), + status: 200, + api: 'v2', + }, + { + url: '/okms/resource/:okmsId/serviceKey', + method: 'post', + response: (_: unknown, params: PathParams) => { + findServiceKeyById(params); + }, + status: 200, + api: 'v2', + }, ]; diff --git a/packages/manager/apps/key-management-service/src/mocks/serviceKeys/serviceKeys.mock.ts b/packages/manager/apps/key-management-service/src/mocks/serviceKeys/serviceKeys.mock.ts index 1cb4f34fdd01..99314a00bb5c 100644 --- a/packages/manager/apps/key-management-service/src/mocks/serviceKeys/serviceKeys.mock.ts +++ b/packages/manager/apps/key-management-service/src/mocks/serviceKeys/serviceKeys.mock.ts @@ -7,6 +7,7 @@ import { export const serviceKeyMock: OkmsAllServiceKeys[] = [ { + name: 'ServiceKeyTest', createdAt: '2024-10-23T15:24:23Z', id: '8f8a75b0-3bde-4b8d-a8c0-928ba2ceb8ed', operations: [ @@ -17,10 +18,26 @@ export const serviceKeyMock: OkmsAllServiceKeys[] = [ type: OkmsKeyTypes.EC, curve: 'P-256', iam: { - id: '8f8a75b0-3bde-4b8d-a8c0-928basvced', + id: '8f8a75b0-3bde-4b8d-a8c0-928ba2ceb8ed', urn: - 'urn:v1:eu:resource:okms:8f8a75b0-b57d-45fc-8d4f-256664DFE/serviceKey/dqd63-5688-409c-234-125e24538f34', + 'urn:v1:eu:resource:okms:7f3a82ac-a8d8-4c2a-ab0c-f6e86ddf6a7c/serviceKey/8f8a75b0-3bde-4b8d-a8c0-928ba2ceb8ed', displayName: 'ServiceKeyTest', }, }, ]; + +export const createdKeyMock: OkmsAllServiceKeys = { + name: 'New Key', + createdAt: '2024-10-23T15:24:23Z', + id: '4575b0-3bde-4b8d-a8c0-928ba2ceb8ed', + operations: [OkmsServiceKeyOperations.sign, OkmsServiceKeyOperations.verify], + state: OkmsServiceKeyState.active, + type: OkmsKeyTypes.EC, + curve: 'P-256', + iam: { + id: '4575b0-3bde-4b8d-a8c0-928ba2ceb8ed', + urn: + 'urn:v1:eu:resource:okms:7f3a82ac-a8d8-4c2a-ab0c-f6e86ddf6a7c/serviceKey/4575b0-3bde-4b8d-a8c0-928ba2ceb8ed', + displayName: 'New Key', + }, +}; diff --git a/packages/manager/apps/key-management-service/src/pages/dashboard/serviceKeyList/ServiceKeyList.page.spec.tsx b/packages/manager/apps/key-management-service/src/pages/dashboard/serviceKeyList/ServiceKeyList.page.spec.tsx new file mode 100644 index 000000000000..12fe4013a6bc --- /dev/null +++ b/packages/manager/apps/key-management-service/src/pages/dashboard/serviceKeyList/ServiceKeyList.page.spec.tsx @@ -0,0 +1,183 @@ +import { act, fireEvent, screen, waitFor } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import { renderTestApp } from '@/utils/tests/renderTestApp'; +import '@testing-library/jest-dom'; +import { labels } from '@/utils/tests/init.i18n'; +import { okmsMock } from '@/mocks/kms/okms.mock'; +import { serviceKeyMock } from '@/mocks/serviceKeys/serviceKeys.mock'; + +describe('Service Key list test suite', () => { + it('should display an error if the API is KO', async () => { + await renderTestApp(`/${okmsMock[0].id}/keys`, { + isServiceKeyKO: true, + }); + + await waitFor( + () => expect(screen.getByAltText('OOPS')).toBeInTheDocument(), + { + timeout: 30_000, + }, + ); + }); + + it('should display the kms keys listing page', async () => { + await renderTestApp(`/${okmsMock[0].id}/keys`); + + await waitFor( + () => + expect( + screen.getByText( + labels.serviceKeys['key_management_service_service-keys_headline'], + ), + ).toBeVisible(), + + { timeout: 30_000 }, + ); + + expect(screen.queryByAltText('OOPS')).not.toBeInTheDocument(); + }); + + it(`should navigate to the service key page creation on click on ${labels.serviceKeys['key_management_service_service-keys_cta_create']} and then create a key `, async () => { + const user = userEvent.setup(); + await renderTestApp(`/${okmsMock[0].id}/keys`); + await waitFor( + () => + expect( + screen.getAllByText( + labels.serviceKeys['key_management_service_service-keys_headline'], + { exact: false }, + ).length, + ).toBeGreaterThan(0), + { timeout: 30_000 }, + ); + await waitFor( + () => + expect( + screen.getByText( + labels.serviceKeys[ + 'key_management_service_service-keys_create_title' + ], + ), + ).toBeEnabled(), + { + timeout: 30_000, + }, + ); + + await act(() => + user.click( + screen.getByText( + labels.serviceKeys[ + 'key_management_service_service-keys_create_title' + ], + ), + ), + ); + + await waitFor( + () => + expect( + screen.getByText( + labels.serviceKeys[ + 'key_management_service_service-keys_create_crypto_field_type_description_oct' + ], + ), + ).toBeVisible(), + { timeout: 30_000 }, + ); + await waitFor( + () => + expect( + screen.getByText( + labels.serviceKeys[ + 'key_management_service_service-keys_create_crypto_field_usage_description_encrypt_decrypt' + ], + ), + ).toBeVisible(), + { timeout: 30_000 }, + ); + const keyNameInput = screen.getByPlaceholderText( + labels.serviceKeys[ + 'key_management_service_service-keys_create_general_information_field_name_placeholder' + ], + ); + await act(() => { + fireEvent.change(keyNameInput, { target: { value: '' } }); + fireEvent.change(keyNameInput, { + target: { value: 'New Key' }, + }); + }); + await waitFor( + () => + expect( + screen.getByText( + labels.serviceKeys[ + 'key_management_service_service-keys_create_cta_submit' + ], + ), + ).toBeEnabled(), + { + timeout: 30_000, + }, + ); + + await act(() => + user.click( + screen.getByText( + labels.serviceKeys[ + 'key_management_service_service-keys_create_cta_submit' + ], + ), + ), + ); + await waitFor( + () => + expect( + screen.getByText( + labels.serviceKeys[ + 'key_management_service_service-keys_create_success' + ], + ), + ).toBeEnabled(), + { + timeout: 30_000, + }, + ); + }); + + it('should navigate to the service key dashboard page after clicking on a key from the listing', async () => { + await renderTestApp(`/${okmsMock[0].id}/keys`); + + await waitFor( + () => + expect( + screen.getAllByText( + labels.serviceKeys['key_management_service_service-keys_headline'], + { exact: false }, + ).length, + ).toBeGreaterThan(0), + { timeout: 30_000 }, + ); + + await waitFor( + () => + userEvent.click(screen.getByText(serviceKeyMock[0].iam.displayName)), + { + timeout: 30_000, + }, + ); + await waitFor( + () => + expect( + screen.getByText( + labels.serviceKeys[ + 'key_management_service_service-keys_dashboard_tab_informations' + ], + ), + ).toBeVisible(), + { + timeout: 30_000, + }, + ); + }); +}); diff --git a/packages/manager/apps/key-management-service/src/pages/serviceKey/ServiceKey.page.spec.tsx b/packages/manager/apps/key-management-service/src/pages/serviceKey/ServiceKey.page.spec.tsx new file mode 100644 index 000000000000..fd22d09114a5 --- /dev/null +++ b/packages/manager/apps/key-management-service/src/pages/serviceKey/ServiceKey.page.spec.tsx @@ -0,0 +1,111 @@ +import { act, fireEvent, screen, waitFor } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import { okmsMock } from '@/mocks/kms/okms.mock'; +import { serviceKeyMock } from '@/mocks/serviceKeys/serviceKeys.mock'; +import { labels } from '@/utils/tests/init.i18n'; +import { renderTestApp } from '@/utils/tests/renderTestApp'; + +describe('Service Key dashboard test suite', () => { + it('should display an error if the API is KO', async () => { + await renderTestApp(`/${okmsMock[0].id}/keys/${serviceKeyMock[0].id}`, { + isServiceKeyKO: true, + }); + + await waitFor( + () => expect(screen.getByAltText('OOPS')).toBeInTheDocument(), + { + timeout: 30_000, + }, + ); + }); + it('should display the kms dashboard page', async () => { + await renderTestApp(`/${okmsMock[0].id}/keys/${serviceKeyMock[0].id}`); + + await waitFor( + () => + expect( + screen.getAllByText( + labels.serviceKeys[ + 'key_management_service_service-keys_dashboard_tab_informations' + ], + { exact: false }, + ).length, + ).toBeGreaterThan(0), + + { timeout: 30_000 }, + ); + + expect(screen.queryByAltText('OOPS')).not.toBeInTheDocument(); + }); + + it('should open the edit dialog, modify the name, and confirm the changes', async () => { + const user = userEvent.setup(); + await renderTestApp(`/${okmsMock[0].id}/keys/${serviceKeyMock[0].id}`); + + await waitFor( + () => + expect( + screen.getAllByText( + labels.serviceKeys[ + 'key_management_service_service-keys_dashboard_tab_informations' + ], + { exact: false }, + ).length, + ).toBeGreaterThan(0), + + { timeout: 30_000 }, + ); + await waitFor( + () => expect(screen.getByTestId('edit-button-modal')).toBeEnabled(), + { + timeout: 30_000, + }, + ); + await act(() => user.click(screen.getByTestId('edit-button-modal'))); + + await waitFor( + () => + expect( + screen.getByText(labels.common.key_management_service_modify), + ).toBeVisible(), + { + timeout: 30_000, + }, + ); + const nameInput = screen.getByLabelText('input-edit-service-key-name'); + await act(() => { + fireEvent.change(nameInput, { target: { value: '' } }); + fireEvent.change(nameInput, { + target: { value: 'Updated Encryption Key' }, + }); + }); + + await waitFor( + () => + expect( + screen.getByText(labels.common.key_management_service_modify), + ).toBeEnabled(), + { + timeout: 30_000, + }, + ); + await act(() => + user.click(screen.getByText(labels.common.key_management_service_modify)), + ); + + await waitFor( + () => { + expect( + screen.getByText( + labels.serviceKeys[ + 'key_management_service_service-keys_update_name_success' + ], + ), + ).toBeInTheDocument(); + }, + { + timeout: 30_000, + }, + ); + }); +}); diff --git a/packages/manager/apps/key-management-service/src/pages/serviceKey/ServiceKey.page.tsx b/packages/manager/apps/key-management-service/src/pages/serviceKey/ServiceKey.page.tsx index 1e531ae4d7c1..9dbd110511ae 100644 --- a/packages/manager/apps/key-management-service/src/pages/serviceKey/ServiceKey.page.tsx +++ b/packages/manager/apps/key-management-service/src/pages/serviceKey/ServiceKey.page.tsx @@ -162,6 +162,8 @@ export default function Key() { color={ODS_THEME_COLOR_INTENT.primary} urn={serviceKey.data.iam.urn} iamActions={[kmsIamActions.serviceKeyUpdate]} + aria-label="edit" + data-testid="edit-button-modal" onClick={() => { trackClick({ location: PageLocation.page, diff --git a/packages/manager/apps/key-management-service/src/types/okmsServiceKeyReference.type.ts b/packages/manager/apps/key-management-service/src/types/okmsServiceKeyReference.type.ts index d82a3371ee9b..802fc5c15767 100644 --- a/packages/manager/apps/key-management-service/src/types/okmsServiceKeyReference.type.ts +++ b/packages/manager/apps/key-management-service/src/types/okmsServiceKeyReference.type.ts @@ -6,12 +6,12 @@ import { OkmsServiceKeyTypeRSASize, } from './okmsServiceKey.type'; -type OkmsServiceKeyReferenceSize = { +export type OkmsServiceKeyReferenceSize = { default: boolean; value: OkmsServiceKeyTypeOctSize & OkmsServiceKeyTypeRSASize; }; -type OkmsServiceKeyReferenceCurve = { +export type OkmsServiceKeyReferenceCurve = { default: boolean; value: OkmsServiceKeyTypeECCurve; }; diff --git a/packages/manager/apps/key-management-service/src/utils/tests/renderTestApp.tsx b/packages/manager/apps/key-management-service/src/utils/tests/renderTestApp.tsx index 2d6041859635..4406a2abf03f 100644 --- a/packages/manager/apps/key-management-service/src/utils/tests/renderTestApp.tsx +++ b/packages/manager/apps/key-management-service/src/utils/tests/renderTestApp.tsx @@ -37,6 +37,10 @@ import { getCatalogKmsMocks, GetCatalogKmsMocksParams, } from '@/mocks/catalog/catalog.handler'; +import { + getReferenceMock, + GetReferenceMockParams, +} from '@/mocks/reference/reference.handler'; let context: ShellContextType; let i18nValue: i18n; @@ -49,6 +53,7 @@ export const renderTestApp = async ( GetServicesMocksParams & GetFeatureAvailabilituMocksParams & GetCatalogKmsMocksParams & + GetReferenceMockParams & GetIamAuthorizationMockParams = {}, ) => { global.server?.resetHandlers( @@ -61,6 +66,7 @@ export const renderTestApp = async ( ...getCredentialsMock(mockParams), ...getFeatureAvailabilityMocks(mockParams), ...getCatalogKmsMocks(mockParams), + ...getReferenceMock(mockParams), ]), ); From 2d0c66b86b6f3bbc681fbfbe0397f4ffd74fd1e2 Mon Sep 17 00:00:00 2001 From: Paul Dickerson Date: Wed, 13 Nov 2024 15:23:22 +0100 Subject: [PATCH 2/9] refactor(*): veeam and vcd refactor post ga ref: MANAGER-15700 Signed-off-by: Paul Dickerson Co-authored-by: Nicolas Pierre-charles Co-authored-by: Thibault Barske --- .github/workflows/run-bdd-tests.yml | 3 +- .../apps/hpc-vmware-managed-vcd/cucumber.js | 20 --- .../e2e/features/onboarding.feature | 7 -- .../e2e/step-definitions/onboarding.step.ts | 32 ----- .../e2e/utils/constants.ts | 7 -- .../e2e/utils/index.tsx | 2 - .../e2e/utils/network.ts | 21 ---- .../hpc-vmware-managed-vcd/mocks/index.ts | 5 - .../vcd-organization/vcd-organization.mock.ts | 60 --------- .../veeam-backup/veeam-backup.handler.ts | 38 ------ .../mocks/veeam-backup/veeam-backup.mock.ts | 49 -------- .../apps/hpc-vmware-managed-vcd/package.json | 20 ++- .../playwright.config.ts | 20 --- .../datacentres/Messages_de_DE.json | 0 .../datacentres/Messages_en_GB.json | 0 .../datacentres/Messages_es_ES.json | 0 .../datacentres/Messages_fr_CA.json | 0 .../datacentres/Messages_fr_FR.json | 1 - .../datacentres/Messages_it_IT.json | 0 .../datacentres/Messages_pl_PL.json | 0 .../datacentres/Messages_pt_PT.json | 0 .../datacentres/compute/Messages_de_DE.json | 0 .../datacentres/compute/Messages_en_GB.json | 0 .../datacentres/compute/Messages_es_ES.json | 0 .../datacentres/compute/Messages_fr_CA.json | 0 .../datacentres/compute/Messages_fr_FR.json | 2 - .../datacentres/compute/Messages_it_IT.json | 0 .../datacentres/compute/Messages_pl_PL.json | 0 .../datacentres/compute/Messages_pt_PT.json | 0 .../datacentres/order/Messages_de_DE.json | 0 .../datacentres/order/Messages_en_GB.json | 0 .../datacentres/order/Messages_es_ES.json | 0 .../datacentres/order/Messages_fr_CA.json | 0 .../datacentres/order/Messages_fr_FR.json | 3 +- .../datacentres/order/Messages_it_IT.json | 0 .../datacentres/order/Messages_pl_PL.json | 0 .../datacentres/order/Messages_pt_PT.json | 0 .../datacentres/storage/Messages_de_DE.json | 0 .../datacentres/storage/Messages_en_GB.json | 0 .../datacentres/storage/Messages_es_ES.json | 0 .../datacentres/storage/Messages_fr_CA.json | 0 .../datacentres/storage/Messages_fr_FR.json | 0 .../datacentres/storage/Messages_it_IT.json | 0 .../datacentres/storage/Messages_pl_PL.json | 0 .../datacentres/storage/Messages_pt_PT.json | 0 .../Messages_de_DE.json | 3 - .../Messages_en_GB.json | 3 - .../Messages_es_ES.json | 3 - .../Messages_fr_CA.json | 3 - .../Messages_fr_FR.json | 3 - .../Messages_it_IT.json | 3 - .../Messages_pl_PL.json | 3 - .../Messages_pt_PT.json | 3 - .../error/Messages_de_DE.json | 8 -- .../error/Messages_en_GB.json | 8 -- .../error/Messages_es_ES.json | 8 -- .../error/Messages_fr_CA.json | 8 -- .../error/Messages_fr_FR.json | 8 -- .../error/Messages_it_IT.json | 8 -- .../error/Messages_pl_PL.json | 8 -- .../error/Messages_pt_PT.json | 8 -- .../translations/listing/Messages_fr_FR.json | 2 - .../apps/hpc-vmware-managed-vcd/setupTests.ts | 35 ------ .../compute/ComputeOrderCells.component.tsx | 20 +-- .../container/DatagridContainer.component.tsx | 2 +- .../storage/StorageOrderCells.component.tsx | 10 +- .../form/DatacentreOrder.component.tsx | 20 +-- .../modal/UpdateDetailModalHandler.tsx | 13 +- ...centreGeneralInformationTile.component.tsx | 32 +---- .../DatacentreGeneralInformationTile.spec.tsx | 7 +- .../DatacentreUsageTile.component.tsx | 6 +- .../DatacentreUsageTile.spec.tsx | 2 +- ...ganizationDataProtectionTile.component.tsx | 14 +-- .../OrganizationDataProtectionTile.spec.tsx | 47 ++++--- .../BackupTileItem.component.tsx | 13 +- .../DatacentresCount.component.tsx | 11 +- ...zationGeneralInformationTile.component.tsx | 4 +- .../OrganizationOptionsTile.component.tsx | 2 +- ...izationServiceManagementTile.component.tsx | 55 ++------ .../data/api/hpc-vmware-managed-vcd-cart.ts | 9 -- .../api/hpc-vmware-managed-vcd-datacentre.ts | 58 --------- .../hpc-vmware-managed-vcd-reset-password.ts | 10 -- .../api/hpc-vmware-managed-vcd.constants.ts | 1 - .../src/data/api/hpc-vmware-managed-vcd.ts | 45 ------- .../data/hooks/useManagedVcdDatacentres.ts | 31 ----- .../data/hooks/useManagedVcdOrganization.ts | 51 -------- .../pages/dashboard/dashboard.constants.ts | 1 + .../DatacentreDashboard.constant.ts | 2 - .../datacentre/DatacentreDashboard.page.tsx | 20 +-- .../datacentre/DatacentreDashboard.spec.tsx | 13 +- .../DatacentreComputeOrder.page.tsx | 17 ++- .../DatacentreComputeOrder.spec.tsx | 23 ++-- ...ts => datacentreComputeOrder.constants.ts} | 0 .../compute/DatacentreCompute.constants.ts | 1 - .../compute/DatacentreCompute.page.tsx | 35 +++--- .../compute/DatacentreCompute.spec.tsx | 22 ++-- .../compute/datacentreCompute.constants.ts | 4 + .../datacentreDashboard.constants.ts | 2 + .../DatacentreGeneralInformation.page.tsx | 12 +- .../DatacentreGeneralInformation.spec.tsx | 47 ++++--- .../edit/EditVdcDescription.page.tsx | 13 +- .../DatacentreStorageOrder.page.tsx | 8 +- .../DatacentreStorageOrder.spec.tsx | 23 ++-- ...ts => datacentreStorageOrder.constants.ts} | 0 .../storage/DatacentreStorage.page.tsx | 38 +++--- .../storage/DatacentreStorage.spec.tsx | 20 +-- .../OrganizationDashboard.constants.ts | 3 - .../OrganizationDashboard.page.tsx | 5 +- .../OrganizationDashboard.spec.tsx | 23 ++-- .../OrganizationGeneralInformation.page.tsx | 5 +- .../OrganizationGeneralInformation.spec.tsx | 117 +++++++++++------ .../edit/EditPassword.page.tsx | 4 +- .../organizationDashboard.constants.ts | 4 + ...acentres.page.tsx => Datacentres.page.tsx} | 31 ++--- .../listing/datacentres/Datacentres.spec.tsx | 27 ++++ .../listing/datacentres/datacentres.spec.tsx | 40 ------ .../organizations/Organizations.page.tsx | 24 ++-- .../organizations/Organizations.spec.tsx | 16 +-- .../src/pages/onboarding/Onboarding.spec.tsx | 10 +- .../src/routes/routes.tsx | 17 ++- .../src/test-utils/index.ts | 11 +- .../src/test-utils/render-test.tsx | 18 +-- .../src/test-utils/test-i18n.ts | 78 +++--------- .../src/test-utils/uiTestHelpers.ts | 73 +---------- .../src/types/vcd-compute.interface.ts | 14 --- .../src/types/vcd-datacenter.interface.ts | 26 ---- .../vcd-organization-backup.interface.ts | 48 ------- .../src/types/vcd-organization.interface.ts | 25 ---- .../src/types/vcd-storage.interface.ts | 21 ---- .../vcd-vdc-orderable-resource.interface.ts | 26 ---- .../src/utils/getPricedOrderableResource.ts | 20 +-- .../src/utils/refetchConditions.ts | 8 +- .../src/utils/veeamBackupBadge.ts | 6 +- .../src/utils/veeamBackupId.ts | 9 -- .../hpc-vmware-managed-vcd/tsconfig.test.json | 6 - .../hpc-vmware-managed-vcd/vitest.config.js | 5 +- .../hycu/dashboard/Messages_de_DE.json | 2 +- .../hycu/dashboard/Messages_en_GB.json | 2 +- .../hycu/dashboard/Messages_es_ES.json | 2 +- .../hycu/dashboard/Messages_fr_CA.json | 2 +- .../hycu/dashboard/Messages_fr_FR.json | 2 +- .../hycu/dashboard/Messages_it_IT.json | 2 +- .../hycu/dashboard/Messages_pl_PL.json | 2 +- .../hycu/dashboard/Messages_pt_PT.json | 2 +- .../terminate/TerminateModal.component.tsx | 119 ------------------ .../terminate/TerminateModal.constants.ts | 1 - .../BillingInformationsTile.tsx | 43 +------ .../src/data/hooks/useTerminateOKms.ts | 28 +++-- .../dashboard/KmsDashboard.page.spec.tsx | 6 +- .../GeneralInformations.tsx | 5 +- .../pages/listing/terminate/TerminateKms.tsx | 51 ++++++-- .../src/routes/routes.constants.ts | 2 +- .../src/routes/routes.tsx | 12 ++ .../manager/apps/veeam-backup/cucumber.js | 20 --- .../e2e/features/onboarding.feature | 7 -- .../e2e/step-definitions/onboarding.step.ts | 32 ----- .../apps/veeam-backup/e2e/utils/constants.ts | 7 -- .../apps/veeam-backup/e2e/utils/index.tsx | 2 - .../apps/veeam-backup/e2e/utils/network.ts | 45 ------- .../apps/veeam-backup/mocks/iam.handler.ts | 2 +- .../apps/veeam-backup/mocks/iam.mock.ts | 2 +- .../manager/apps/veeam-backup/mocks/index.ts | 3 - .../mocks/vcd-organization.handler.ts | 43 ------- .../manager/apps/veeam-backup/package.json | 14 +-- .../apps/veeam-backup/playwright.config.ts | 20 --- .../order-veeam/Messages_es_ES.json | 2 +- .../manager/apps/veeam-backup/setup-test.tsx | 32 ----- .../BackupStatusBadge.component.tsx | 4 +- .../src/components/Breadcrumb/Breadcrumb.tsx | 5 +- .../Messages/SuccessMessage.component.tsx | 7 +- .../NoOrganizationMessage.component.tsx | 2 +- .../src/data/api/vcd-organization.ts | 9 -- .../apps/veeam-backup/src/data/hook/index.ts | 4 - .../apps/veeam-backup/src/data/index.ts | 4 - .../apps/veeam-backup/src/data/vcd.type.ts | 108 ---------------- .../src/pages/dashboard/Dashboard.page.tsx | 4 +- .../pages/dashboard/DisplayName.component.tsx | 11 +- .../dashboard/OfferProgress.component.tsx | 2 +- .../dashboard/SubscriptionTile.component.tsx | 4 +- .../src/pages/dashboard/dashboard.spec.tsx | 16 ++- .../pages/delete-veeam/DeleteVeeam.page.tsx | 5 +- .../pages/delete-veeam/delete-veeam.spec.tsx | 15 ++- .../EditVeeamBackupDisplayNameModal.page.tsx | 6 +- .../src/pages/edit-name/edit-name.spec.tsx | 17 ++- .../pages/listing/DatagridCell.component.tsx | 31 ++--- .../src/pages/listing/Listing.page.tsx | 7 +- .../src/pages/listing/listing.spec.tsx | 9 +- .../src/pages/onboarding/Onboarding.page.tsx | 2 +- .../src/pages/onboarding/onboarding.spec.tsx | 13 +- .../src/pages/order-veeam/OrderVeeam.page.tsx | 4 +- .../order-veeam/OrderVeeamStep2.component.tsx | 4 +- .../VCDOrganiationDatagridCell.component.tsx | 2 +- .../pages/order-veeam/order-veeam.spec.tsx | 25 ++-- .../veeam-backup/src/test-helpers/index.ts | 2 +- .../veeam-backup/src/test-helpers/labels.ts | 37 ++++++ .../src/test-helpers/render-test.tsx | 21 ++-- .../src/test-helpers/test-i18n.ts | 70 ----------- .../src/test-helpers/test-utils.ts | 97 +------------- .../apps/veeam-backup/tsconfig.test.json | 6 - .../apps/veeam-backup/vitest.config.js | 2 +- packages/manager/core/test-utils/package.json | 2 +- packages/manager/modules/vcd-api/.gitignore | 1 + packages/manager/modules/vcd-api/CHANGELOG.md | 0 packages/manager/modules/vcd-api/package.json | 46 +++++++ .../vcd-api/src}/api/catalog.ts | 10 +- .../data => modules/vcd-api/src}/api/index.ts | 6 +- .../modules/vcd-api/src/api/vcd-datacentre.ts | 43 +++++++ .../vcd-api/src/api/vcd-organization.ts | 21 ++++ .../vcd-api/src/api/vcd-reset-password.ts | 7 ++ .../vcd-api/src}/api/veeam-backup.ts | 4 +- .../manager/modules/vcd-api/src/hook/index.ts | 10 ++ .../vcd-api/src/hook}/useOrderableResource.ts | 8 +- .../vcd-api/src/hook/useResetVcdPassword.ts} | 6 +- .../src/hook}/useUpdateVcdDatacentre.ts | 11 +- .../src/hook}/useUpdateVcdOrganization.ts | 8 +- .../vcd-api/src/hook}/useVcdCatalog.ts | 8 +- .../vcd-api/src/hook/useVcdDatacentre.ts | 26 ++++ .../vcd-api/src/hook}/useVcdOrder.ts | 14 +-- .../src/hook/useVcdOrganization.spec.ts} | 8 +- .../vcd-api/src/hook/useVcdOrganization.ts} | 61 +++++++-- .../vcd-api/src}/hook/useVeeamBackup.spec.ts | 4 +- .../vcd-api/src}/hook/useVeeamBackup.ts | 17 +-- .../src}/hook/useVeeamBackupCatalog.ts | 5 +- packages/manager/modules/vcd-api/src/index.ts | 5 + .../modules/vcd-api/src/mocks/backup/index.ts | 4 + .../backup/veeam-backup-catalog.handler.ts} | 4 +- .../backup/veeam-backup-catalog.mock.ts} | 2 +- .../src/mocks/backup}/veeam-backup.handler.ts | 2 +- .../src/mocks/backup}/veeam-backup.mock.ts | 4 +- .../vcd-api/src}/mocks/iam/iam.handler.ts | 2 +- .../vcd-api/src}/mocks/iam/iam.mock.ts | 4 +- .../modules/vcd-api/src/mocks/iam/index.ts | 2 + .../modules/vcd-api/src/mocks/index.ts | 4 + .../vcd-api/src/mocks/vcd-datacentre/index.ts | 6 + .../vcd-datacentre-order.handler.ts | 8 +- .../vcd-datacentre}/vcd-datacentre.handler.ts | 2 +- .../vcd-datacentre}/vcd-datacentre.mock.ts | 4 +- .../mocks/vcd-datacentre}/vdc-compute.mock.ts | 4 +- .../vdc-orderable-resource.mock.ts | 4 +- .../mocks/vcd-datacentre}/vdc-storage.mock.ts | 4 +- .../src/mocks/vcd-organization/index.ts | 3 + .../vcd-organization/vcd-catalog.mock.ts | 4 +- .../vcd-organization.handler.ts | 2 +- .../vcd-organization.mock.ts | 4 +- .../modules/vcd-api/src/types/index.ts | 10 ++ .../vcd-api/src/types/vcd-catalog.type.ts} | 15 ++- .../vcd-api/src/types/vcd-compute.type.ts | 16 +++ .../vcd-api/src/types/vcd-datacentre.type.ts | 25 ++++ .../vcd-api/src/types/vcd-order.type.ts | 6 + .../src/types/vcd-orderable-resource.type.ts | 23 ++++ .../src/types/vcd-organization.type.ts | 44 +++++++ .../vcd-api/src/types/vcd-storage.type.ts | 16 +++ .../vcd-api/src/types/vcd-utility.type.ts | 22 ++++ .../src/types/veeam-backup-catalog.type.ts} | 0 .../vcd-api/src/types/veeam-backup.type.ts | 43 +++++++ .../modules/vcd-api/src/utils/apiRoutes.ts | 28 +++++ .../vcd-api/src/utils/iam.constants.ts | 6 + .../modules/vcd-api/src/utils/index.ts | 3 + .../vcd-api}/src/utils/queryKeys.ts | 19 ++- .../manager/modules/vcd-api/tsconfig.json | 25 ++++ .../manager/modules/vcd-api/vitest.config.js | 29 +++++ yarn.lock | 16 --- 262 files changed, 1376 insertions(+), 2342 deletions(-) delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/cucumber.js delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/e2e/features/onboarding.feature delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/e2e/step-definitions/onboarding.step.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/e2e/utils/constants.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/e2e/utils/index.tsx delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/e2e/utils/network.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/mocks/index.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-organization.mock.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/mocks/veeam-backup/veeam-backup.handler.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/mocks/veeam-backup/veeam-backup.mock.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/playwright.config.ts rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/Messages_de_DE.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/Messages_en_GB.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/Messages_es_ES.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/Messages_fr_CA.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/Messages_fr_FR.json (92%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/Messages_it_IT.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/Messages_pl_PL.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/Messages_pt_PT.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/compute/Messages_de_DE.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/compute/Messages_en_GB.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/compute/Messages_es_ES.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/compute/Messages_fr_CA.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/compute/Messages_fr_FR.json (64%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/compute/Messages_it_IT.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/compute/Messages_pl_PL.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/compute/Messages_pt_PT.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/order/Messages_de_DE.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/order/Messages_en_GB.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/order/Messages_es_ES.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/order/Messages_fr_CA.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/order/Messages_fr_FR.json (93%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/order/Messages_it_IT.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/order/Messages_pl_PL.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/order/Messages_pt_PT.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/storage/Messages_de_DE.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/storage/Messages_en_GB.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/storage/Messages_es_ES.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/storage/Messages_fr_CA.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/storage/Messages_fr_FR.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/storage/Messages_it_IT.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/storage/Messages_pl_PL.json (100%) rename packages/manager/apps/hpc-vmware-managed-vcd/public/translations/{hpc-vmware-managed-vcd => }/datacentres/storage/Messages_pt_PT.json (100%) delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_de_DE.json delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_en_GB.json delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_es_ES.json delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_fr_CA.json delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_fr_FR.json delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_it_IT.json delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_pl_PL.json delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_pt_PT.json delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_de_DE.json delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_en_GB.json delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_es_ES.json delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_fr_CA.json delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_fr_FR.json delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_it_IT.json delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_pl_PL.json delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_pt_PT.json delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/setupTests.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd-cart.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd-datacentre.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd-reset-password.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd.constants.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useManagedVcdDatacentres.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useManagedVcdOrganization.ts create mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/dashboard.constants.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/DatacentreDashboard.constant.ts rename packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute-order/{DatacentreComputeOrder.constants.ts => datacentreComputeOrder.constants.ts} (100%) delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute/DatacentreCompute.constants.ts create mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute/datacentreCompute.constants.ts create mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/datacentreDashboard.constants.ts rename packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage-order/{DatacentreStorageOrder.constants.ts => datacentreStorageOrder.constants.ts} (100%) delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/OrganizationDashboard.constants.ts create mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/organizationDashboard.constants.ts rename packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/datacentres/{datacentres.page.tsx => Datacentres.page.tsx} (74%) create mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/datacentres/Datacentres.spec.tsx delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/datacentres/datacentres.spec.tsx delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-compute.interface.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-datacenter.interface.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-organization-backup.interface.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-organization.interface.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-storage.interface.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-vdc-orderable-resource.interface.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/utils/veeamBackupId.ts delete mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/tsconfig.test.json delete mode 100644 packages/manager/apps/key-management-service/src/components/Modal/terminate/TerminateModal.component.tsx delete mode 100644 packages/manager/apps/key-management-service/src/components/Modal/terminate/TerminateModal.constants.ts delete mode 100644 packages/manager/apps/veeam-backup/cucumber.js delete mode 100644 packages/manager/apps/veeam-backup/e2e/features/onboarding.feature delete mode 100644 packages/manager/apps/veeam-backup/e2e/step-definitions/onboarding.step.ts delete mode 100644 packages/manager/apps/veeam-backup/e2e/utils/constants.ts delete mode 100644 packages/manager/apps/veeam-backup/e2e/utils/index.tsx delete mode 100644 packages/manager/apps/veeam-backup/e2e/utils/network.ts delete mode 100644 packages/manager/apps/veeam-backup/mocks/vcd-organization.handler.ts delete mode 100644 packages/manager/apps/veeam-backup/playwright.config.ts delete mode 100644 packages/manager/apps/veeam-backup/setup-test.tsx delete mode 100644 packages/manager/apps/veeam-backup/src/data/api/vcd-organization.ts delete mode 100644 packages/manager/apps/veeam-backup/src/data/hook/index.ts delete mode 100644 packages/manager/apps/veeam-backup/src/data/index.ts delete mode 100644 packages/manager/apps/veeam-backup/src/data/vcd.type.ts create mode 100644 packages/manager/apps/veeam-backup/src/test-helpers/labels.ts delete mode 100644 packages/manager/apps/veeam-backup/src/test-helpers/test-i18n.ts delete mode 100644 packages/manager/apps/veeam-backup/tsconfig.test.json create mode 100644 packages/manager/modules/vcd-api/.gitignore create mode 100644 packages/manager/modules/vcd-api/CHANGELOG.md create mode 100644 packages/manager/modules/vcd-api/package.json rename packages/manager/{apps/veeam-backup/src/data => modules/vcd-api/src}/api/catalog.ts (51%) rename packages/manager/{apps/veeam-backup/src/data => modules/vcd-api/src}/api/index.ts (56%) create mode 100644 packages/manager/modules/vcd-api/src/api/vcd-datacentre.ts create mode 100644 packages/manager/modules/vcd-api/src/api/vcd-organization.ts create mode 100644 packages/manager/modules/vcd-api/src/api/vcd-reset-password.ts rename packages/manager/{apps/veeam-backup/src/data => modules/vcd-api/src}/api/veeam-backup.ts (67%) create mode 100644 packages/manager/modules/vcd-api/src/hook/index.ts rename packages/manager/{apps/hpc-vmware-managed-vcd/src/data/hooks => modules/vcd-api/src/hook}/useOrderableResource.ts (53%) rename packages/manager/{apps/hpc-vmware-managed-vcd/src/data/hooks/useResetPassword.ts => modules/vcd-api/src/hook/useResetVcdPassword.ts} (67%) rename packages/manager/{apps/hpc-vmware-managed-vcd/src/data/hooks => modules/vcd-api/src/hook}/useUpdateVcdDatacentre.ts (79%) rename packages/manager/{apps/hpc-vmware-managed-vcd/src/data/hooks => modules/vcd-api/src/hook}/useUpdateVcdOrganization.ts (86%) rename packages/manager/{apps/hpc-vmware-managed-vcd/src/data/hooks => modules/vcd-api/src/hook}/useVcdCatalog.ts (57%) create mode 100644 packages/manager/modules/vcd-api/src/hook/useVcdDatacentre.ts rename packages/manager/{apps/hpc-vmware-managed-vcd/src/data/hooks => modules/vcd-api/src/hook}/useVcdOrder.ts (74%) rename packages/manager/{apps/veeam-backup/src/data/hook/useOrganization.spec.ts => modules/vcd-api/src/hook/useVcdOrganization.spec.ts} (86%) rename packages/manager/{apps/veeam-backup/src/data/hook/useOrganizations.ts => modules/vcd-api/src/hook/useVcdOrganization.ts} (67%) rename packages/manager/{apps/veeam-backup/src/data => modules/vcd-api/src}/hook/useVeeamBackup.spec.ts (89%) rename packages/manager/{apps/veeam-backup/src/data => modules/vcd-api/src}/hook/useVeeamBackup.ts (65%) rename packages/manager/{apps/veeam-backup/src/data => modules/vcd-api/src}/hook/useVeeamBackupCatalog.ts (89%) create mode 100644 packages/manager/modules/vcd-api/src/index.ts create mode 100644 packages/manager/modules/vcd-api/src/mocks/backup/index.ts rename packages/manager/{apps/veeam-backup/mocks/catalog.handler.ts => modules/vcd-api/src/mocks/backup/veeam-backup-catalog.handler.ts} (76%) rename packages/manager/{apps/veeam-backup/mocks/catalog.mock.ts => modules/vcd-api/src/mocks/backup/veeam-backup-catalog.mock.ts} (99%) rename packages/manager/{apps/veeam-backup/mocks => modules/vcd-api/src/mocks/backup}/veeam-backup.handler.ts (93%) rename packages/manager/{apps/veeam-backup/mocks => modules/vcd-api/src/mocks/backup}/veeam-backup.mock.ts (96%) rename packages/manager/{apps/hpc-vmware-managed-vcd => modules/vcd-api/src}/mocks/iam/iam.handler.ts (86%) rename packages/manager/{apps/hpc-vmware-managed-vcd => modules/vcd-api/src}/mocks/iam/iam.mock.ts (87%) create mode 100644 packages/manager/modules/vcd-api/src/mocks/iam/index.ts create mode 100644 packages/manager/modules/vcd-api/src/mocks/index.ts create mode 100644 packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/index.ts rename packages/manager/{apps/hpc-vmware-managed-vcd/mocks/vcd-organization => modules/vcd-api/src/mocks/vcd-datacentre}/vcd-datacentre-order.handler.ts (81%) rename packages/manager/{apps/hpc-vmware-managed-vcd/mocks/vcd-organization => modules/vcd-api/src/mocks/vcd-datacentre}/vcd-datacentre.handler.ts (97%) rename packages/manager/{apps/hpc-vmware-managed-vcd/mocks/vcd-organization => modules/vcd-api/src/mocks/vcd-datacentre}/vcd-datacentre.mock.ts (87%) rename packages/manager/{apps/hpc-vmware-managed-vcd/mocks/vcd-organization => modules/vcd-api/src/mocks/vcd-datacentre}/vdc-compute.mock.ts (82%) rename packages/manager/{apps/hpc-vmware-managed-vcd/mocks/vcd-organization => modules/vcd-api/src/mocks/vcd-datacentre}/vdc-orderable-resource.mock.ts (77%) rename packages/manager/{apps/hpc-vmware-managed-vcd/mocks/vcd-organization => modules/vcd-api/src/mocks/vcd-datacentre}/vdc-storage.mock.ts (83%) create mode 100644 packages/manager/modules/vcd-api/src/mocks/vcd-organization/index.ts rename packages/manager/{apps/hpc-vmware-managed-vcd => modules/vcd-api/src}/mocks/vcd-organization/vcd-catalog.mock.ts (97%) rename packages/manager/{apps/hpc-vmware-managed-vcd => modules/vcd-api/src}/mocks/vcd-organization/vcd-organization.handler.ts (96%) rename packages/manager/{apps/veeam-backup/mocks => modules/vcd-api/src/mocks/vcd-organization}/vcd-organization.mock.ts (95%) create mode 100644 packages/manager/modules/vcd-api/src/types/index.ts rename packages/manager/{apps/hpc-vmware-managed-vcd/src/types/vcd-catalog.interface.ts => modules/vcd-api/src/types/vcd-catalog.type.ts} (84%) create mode 100644 packages/manager/modules/vcd-api/src/types/vcd-compute.type.ts create mode 100644 packages/manager/modules/vcd-api/src/types/vcd-datacentre.type.ts create mode 100644 packages/manager/modules/vcd-api/src/types/vcd-order.type.ts create mode 100644 packages/manager/modules/vcd-api/src/types/vcd-orderable-resource.type.ts create mode 100644 packages/manager/modules/vcd-api/src/types/vcd-organization.type.ts create mode 100644 packages/manager/modules/vcd-api/src/types/vcd-storage.type.ts create mode 100644 packages/manager/modules/vcd-api/src/types/vcd-utility.type.ts rename packages/manager/{apps/veeam-backup/src/data/catalog.type.ts => modules/vcd-api/src/types/veeam-backup-catalog.type.ts} (100%) create mode 100644 packages/manager/modules/vcd-api/src/types/veeam-backup.type.ts create mode 100644 packages/manager/modules/vcd-api/src/utils/apiRoutes.ts create mode 100644 packages/manager/modules/vcd-api/src/utils/iam.constants.ts create mode 100644 packages/manager/modules/vcd-api/src/utils/index.ts rename packages/manager/{apps/hpc-vmware-managed-vcd => modules/vcd-api}/src/utils/queryKeys.ts (72%) create mode 100644 packages/manager/modules/vcd-api/tsconfig.json create mode 100644 packages/manager/modules/vcd-api/vitest.config.js diff --git a/.github/workflows/run-bdd-tests.yml b/.github/workflows/run-bdd-tests.yml index d0b98efb2269..e91af15175d2 100644 --- a/.github/workflows/run-bdd-tests.yml +++ b/.github/workflows/run-bdd-tests.yml @@ -23,7 +23,8 @@ jobs: yarn exec turbo -- run build --filter="./packages/manager/core/*" --concurrency=5 yarn exec turbo -- run build --filter="./packages/manager-react-components" yarn exec turbo -- run build --filter="./packages/manager/modules/order" - yarn exec turbo -- run build --filter="./packages/manager/modules/common-api" --concurrency=5 + yarn exec turbo -- run build --filter="./packages/manager/modules/common-api" + yarn exec turbo -- run build --filter="./packages/manager/modules/vcd-api" yarn exec turbo -- run build --filter="./packages/manager/modules/manager-pci-common" # This task is for running the jest tests outside microApps - name: Run tests Jest diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/cucumber.js b/packages/manager/apps/hpc-vmware-managed-vcd/cucumber.js deleted file mode 100644 index 8e6abbfbca8f..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/cucumber.js +++ /dev/null @@ -1,20 +0,0 @@ -const isCI = process.env.CI; - -module.exports = { - default: { - paths: ['e2e/features/**/*.feature'], - require: [ - '../../../../playwright-helpers/bdd-setup.ts', - 'e2e/**/*.step.ts', - ], - requireModule: ['ts-node/register'], - format: [ - 'summary', - isCI ? 'progress' : 'progress-bar', - !isCI && ['html', 'e2e/reports/cucumber-results-report.html'], - !isCI && ['usage-json', 'e2e/reports/cucumber-usage-report.json'], - ].filter(Boolean), - formatOptions: { snippetInterface: 'async-await' }, - retry: 1, - }, -}; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/e2e/features/onboarding.feature b/packages/manager/apps/hpc-vmware-managed-vcd/e2e/features/onboarding.feature deleted file mode 100644 index 3b64e213c20f..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/e2e/features/onboarding.feature +++ /dev/null @@ -1,7 +0,0 @@ -Feature: Onboarding page - - Scenario: User wants to find informations related to hpc-vmware-managed-vcd - Given User has 0 elements in the Listing page - When User navigates to Listing page - Then User gets redirected to Onboarding page - Then User sees 3 guides diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/e2e/step-definitions/onboarding.step.ts b/packages/manager/apps/hpc-vmware-managed-vcd/e2e/step-definitions/onboarding.step.ts deleted file mode 100644 index 67b20b6e52c8..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/e2e/step-definitions/onboarding.step.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Given, When, Then } from '@cucumber/cucumber'; -import { expect } from '@playwright/test'; -import { ICustomWorld } from '../../../../../../playwright-helpers'; -import { ConfigParams, getUrl, setupNetwork } from '../utils'; - -Given('User has {int} elements in the Listing page', function( - this: ICustomWorld, - nb: number, -) { - this.handlersConfig.nb = nb; -}); - -When('User navigates to Listing page', async function( - this: ICustomWorld, -) { - await setupNetwork(this); - await this.page.goto(getUrl('listing'), { waitUntil: 'load' }); -}); - -Then('User gets redirected to Onboarding page', async function( - this: ICustomWorld, -) { - await expect(this.page).toHaveURL(getUrl('onboarding')); -}); - -Then('User sees {int} guides', async function( - this: ICustomWorld, - nbGuides: number, -) { - const guides = await this.page.locator('osds-tile'); - await expect(guides).toHaveCount(nbGuides); -}); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/e2e/utils/constants.ts b/packages/manager/apps/hpc-vmware-managed-vcd/e2e/utils/constants.ts deleted file mode 100644 index 866e6dadabe9..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/e2e/utils/constants.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { urls } from '../../src/routes/routes.constant'; - -export const appUrl = 'http://localhost:9001/app'; - -export type AppRoute = keyof typeof urls; - -export const getUrl = (route: AppRoute) => `${appUrl}/#${urls[route]}`; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/e2e/utils/index.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/e2e/utils/index.tsx deleted file mode 100644 index 24a453c58aa9..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/e2e/utils/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -export * from './network'; -export * from './constants'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/e2e/utils/network.ts b/packages/manager/apps/hpc-vmware-managed-vcd/e2e/utils/network.ts deleted file mode 100644 index 97b9b13964ef..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/e2e/utils/network.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { BrowserContext } from '@playwright/test'; -import { - ICustomWorld, - toPlaywrightMockHandler, - Handler, -} from '../../../../../../playwright-helpers'; -import { GetAuthenticationMocks } from '../../../../../../playwright-helpers/mocks/auth'; - -export type ConfigParams = GetAuthenticationMocks; - -export const getConfig = (params: ConfigParams): Handler[] => []; - -export const setupNetwork = async (world: ICustomWorld) => - Promise.all( - getConfig({ - ...((world?.handlersConfig as ConfigParams) || ({} as ConfigParams)), - isAuthMocked: true, - }) - .reverse() - .map(toPlaywrightMockHandler(world.context as BrowserContext)), - ); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/index.ts b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/index.ts deleted file mode 100644 index 495b7f1ffc5c..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './iam/iam.handler'; -export * from './vcd-organization/vcd-organization.handler'; -export * from './vcd-organization/vcd-datacentre.handler'; -export * from './vcd-organization/vcd-datacentre-order.handler'; -export * from './veeam-backup/veeam-backup.handler'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-organization.mock.ts b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-organization.mock.ts deleted file mode 100644 index bb0f3dc62c8c..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-organization.mock.ts +++ /dev/null @@ -1,60 +0,0 @@ -import IVcdOrganization from '../../src/types/vcd-organization.interface'; - -export const organizationList: IVcdOrganization[] = [ - { - currentState: { - apiUrl: 'https://vcd.my.company', - billingType: 'MONTHLY', - description: 'Company VCD Organization', - fullName: 'Company VCD', - region: 'EU-WEST-GRA', - name: 'org-eu-west-gra-6cfa2c69-c62c-4853-80ee-c9682e6727f0', - spla: false, - webInterfaceUrl: 'https://vcd.my.company', - }, - currentTasks: [ - { - id: '1fda9001-a48b-4022-a656-ac295d363470', - link: - '/v2/vmwareCloudDirector/organization/6cfa2c69-c62c-4853-80ee-c9682e6727f0/task/1fda9001-a48b-4022-a656-ac295d363470', - status: 'PENDING', - type: 'VCD_UPDATE', - }, - ], - id: '6cfa2c69-c62c-4853-80ee-c9682e6727f0', - resourceStatus: 'UPDATING', - targetSpec: { - description: 'Company VCD Organization targetSpec', - fullName: 'Company VCD targetSpec', - }, - updatedAt: '2024-06-14T09:21:21.943Z', - iam: { - id: 'id1', - urn: 'urn:1', - }, - }, - { - currentState: { - apiUrl: 'https://vcd.my.demo.lab', - billingType: 'DEMO', - description: 'My demo VCD Organization', - fullName: 'Demo VCD', - region: 'CA-EAST-BHS', - name: 'org-ca-east-bhs-61ebdcec-0623-4a61-834f-a1719cd475b4', - spla: true, - webInterfaceUrl: 'https://vcd.my.second.lab', - }, - currentTasks: [], - id: '61ebdcec-0623-4a61-834f-a1719cd475b4', - resourceStatus: 'READY', - targetSpec: { - description: 'My demo VCD Organization targetSpec', - fullName: 'Demo VCD targetSpec', - }, - updatedAt: '2024-06-14T09:21:21.943Z', - iam: { - id: 'id2', - urn: 'urn:2', - }, - }, -]; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/veeam-backup/veeam-backup.handler.ts b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/veeam-backup/veeam-backup.handler.ts deleted file mode 100644 index f27b17cbeb17..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/veeam-backup/veeam-backup.handler.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { PathParams } from 'msw'; -import { Handler } from '../../../../../../playwright-helpers'; -import { backupList } from './veeam-backup.mock'; - -export type GetVeeamBackupMocksParams = { - isBackupKo?: boolean; - nbBackup?: number; -}; - -const findBackupById = (params: PathParams) => - backupList.find(({ id }) => id === params.id); - -export const getVeeamBackupMocks = ({ - isBackupKo, - nbBackup = Number.POSITIVE_INFINITY, -}: GetVeeamBackupMocksParams): Handler[] => [ - { - url: '/vmwareCloudDirector/backup/:id', - response: (_: unknown, params: PathParams) => - isBackupKo - ? { - message: 'Backup error', - } - : findBackupById(params), - status: isBackupKo ? 500 : 200, - api: 'v2', - }, - { - url: '/vmwareCloudDirector/backup', - response: isBackupKo - ? { - message: 'Backup error', - } - : backupList.slice(0, nbBackup), - status: isBackupKo ? 500 : 200, - api: 'v2', - }, -]; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/veeam-backup/veeam-backup.mock.ts b/packages/manager/apps/hpc-vmware-managed-vcd/mocks/veeam-backup/veeam-backup.mock.ts deleted file mode 100644 index c3d4cf19fc8b..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/veeam-backup/veeam-backup.mock.ts +++ /dev/null @@ -1,49 +0,0 @@ -import IVcdOrganizationBackup, { - BackupResourceStatus, -} from '../../src/types/vcd-organization-backup.interface'; -import { organizationList } from '../vcd-organization/vcd-organization.mock'; - -export const backupList: IVcdOrganizationBackup[] = [ - { - id: `${organizationList[0].id}-veeam-backup`, - iam: { - displayName: 'Company A backup service', - id: 'daf6f34e-4b19-11ef-97b7-0050568ce122', - urn: 'urn:v1:resource:vmwareCloudDirectorBackup:BackupA', - }, - currentState: { - offers: [ - { - name: 'BRONZE', - quotaInTB: 100, - usedSpaceInGB: 50, - status: 'READY', - }, - { - name: 'SILVER', - quotaInTB: 100, - usedSpaceInGB: 50, - status: 'READY', - }, - ], - region: 'CA-EAST-BHS', - }, - updatedAt: '2024-06-14T09:21:21.943Z', - createdAt: '2024-06-14T09:21:21.943Z', - resourceStatus: BackupResourceStatus.READY, - targetSpec: { - offers: [ - { - name: 'BRONZE', - quotaInTB: 100, - status: 'READY', - }, - { - name: 'SILVER', - quotaInTB: 100, - status: 'READY', - }, - ], - }, - }, -]; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/package.json b/packages/manager/apps/hpc-vmware-managed-vcd/package.json index faa6f3bd1341..dc936e555dde 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/package.json +++ b/packages/manager/apps/hpc-vmware-managed-vcd/package.json @@ -11,8 +11,6 @@ "license": "BSD-3-Clause", "author": "OVH SAS", "scripts": { - "beta-test:e2e": "tsc && node ../../../../scripts/run-playwright-bdd.js", - "beta-test:e2e:cii": "tsc && node ../../../../scripts/run-playwright-bdd.js --ci", "build": "tsc && vite build", "coverage": "vitest run --coverage", "dev": "tsc && vite", @@ -26,8 +24,10 @@ "@ovh-ux/manager-config": "^8.0.1", "@ovh-ux/manager-core-api": "^0.9.0", "@ovh-ux/manager-core-utils": "*", + "@ovh-ux/manager-module-common-api": "^0.2.0", "@ovh-ux/manager-module-order": "^0.9.1", - "@ovh-ux/manager-react-components": "^1.41.1", + "@ovh-ux/manager-module-vcd-api": "^0.1.0", + "@ovh-ux/manager-react-components": "^1.43.0", "@ovh-ux/manager-react-core-application": "^0.11.4", "@ovh-ux/manager-react-shell-client": "^0.8.3", "@ovh-ux/manager-tailwind-config": "^0.2.1", @@ -49,23 +49,21 @@ "tailwindcss": "^3.3.3" }, "devDependencies": { - "@cucumber/cucumber": "^10.3.1", + "@ovh-ux/manager-core-test-utils": "^0.2.0", "@ovh-ux/manager-vite-config": "^0.8.3", - "@playwright/test": "^1.41.2", "@testing-library/dom": "^10.1.0", "@testing-library/jest-dom": "^6.4.6", "@testing-library/react": "^16.0.0", - "@testing-library/user-event": "^13.2.1", + "@testing-library/user-event": "^14.5.2", "@types/react": "^18.2.55", "@types/react-dom": "^18.2.19", - "@vitejs/plugin-react": "^4.2.1", - "@vitest/coverage-v8": "^1.2.0", + "@vitejs/plugin-react": "^4.3.0", + "@vitest/coverage-v8": "^2.1.4", "autoprefixer": "^10.4.17", - "element-internals-polyfill": "^1.3.10", "msw": "2.1.7", "typescript": "^4.3.2", - "vite": "^4.5.0", - "vitest": "^1.2.0" + "vite": "^5.2.13", + "vitest": "^2.1.4" }, "regions": [ "CA", diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/playwright.config.ts b/packages/manager/apps/hpc-vmware-managed-vcd/playwright.config.ts deleted file mode 100644 index feb249bcbe3f..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/playwright.config.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { defineConfig } from '@playwright/test'; - -export default defineConfig({ - workers: 3, - fullyParallel: false, - timeout: 30 * 1000, - reporter: [['html', { open: 'on-failure' }]], - expect: { - timeout: 20000, - }, - use: { - // Collect trace when retrying the failed test. - trace: 'retain-on-failure', - }, - testMatch: '**/*.e2e.ts', - webServer: { - command: 'yarn run dev', - url: 'http://localhost:9000/', - }, -}); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/Messages_de_DE.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/Messages_de_DE.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/Messages_de_DE.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/Messages_de_DE.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/Messages_en_GB.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/Messages_en_GB.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/Messages_en_GB.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/Messages_en_GB.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/Messages_es_ES.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/Messages_es_ES.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/Messages_es_ES.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/Messages_es_ES.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/Messages_fr_CA.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/Messages_fr_CA.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/Messages_fr_CA.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/Messages_fr_CA.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/Messages_fr_FR.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/Messages_fr_FR.json similarity index 92% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/Messages_fr_FR.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/Messages_fr_FR.json index 125be52c9d1f..1af91569a733 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/Messages_fr_FR.json +++ b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/Messages_fr_FR.json @@ -6,6 +6,5 @@ "managed_vcd_vdc_quota_value": "{{quota}} Go", "managed_vcd_vdc_vcpu_speed": "Vitesse vCPU", "managed_vcd_vdc_vcpu_value": "{{speed}} GHz", - "managed_vcd_vdc_id": "ID", "managed_vcd_vdc_usage": "Usage" } diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/Messages_it_IT.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/Messages_it_IT.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/Messages_it_IT.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/Messages_it_IT.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/Messages_pl_PL.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/Messages_pl_PL.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/Messages_pl_PL.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/Messages_pl_PL.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/Messages_pt_PT.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/Messages_pt_PT.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/Messages_pt_PT.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/Messages_pt_PT.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/compute/Messages_de_DE.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/compute/Messages_de_DE.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/compute/Messages_de_DE.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/compute/Messages_de_DE.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/compute/Messages_en_GB.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/compute/Messages_en_GB.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/compute/Messages_en_GB.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/compute/Messages_en_GB.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/compute/Messages_es_ES.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/compute/Messages_es_ES.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/compute/Messages_es_ES.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/compute/Messages_es_ES.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/compute/Messages_fr_CA.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/compute/Messages_fr_CA.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/compute/Messages_fr_CA.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/compute/Messages_fr_CA.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/compute/Messages_fr_FR.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/compute/Messages_fr_FR.json similarity index 64% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/compute/Messages_fr_FR.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/compute/Messages_fr_FR.json index 1dd78b3da0d3..b5c017ac23ea 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/compute/Messages_fr_FR.json +++ b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/compute/Messages_fr_FR.json @@ -1,7 +1,5 @@ { - "managed_vcd_vdc_compute_vhost_profile": "Virtual Host", "managed_vcd_vdc_compute_billing": "Facturation", "managed_vcd_vdc_compute_billing_MONTHLY": "Au mois", - "managed_vcd_vdc_compute_id": "ID", "managed_vcd_vdc_compute_order_cta": "Commander un Virtual Host" } diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/compute/Messages_it_IT.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/compute/Messages_it_IT.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/compute/Messages_it_IT.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/compute/Messages_it_IT.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/compute/Messages_pl_PL.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/compute/Messages_pl_PL.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/compute/Messages_pl_PL.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/compute/Messages_pl_PL.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/compute/Messages_pt_PT.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/compute/Messages_pt_PT.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/compute/Messages_pt_PT.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/compute/Messages_pt_PT.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/order/Messages_de_DE.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/order/Messages_de_DE.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/order/Messages_de_DE.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/order/Messages_de_DE.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/order/Messages_en_GB.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/order/Messages_en_GB.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/order/Messages_en_GB.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/order/Messages_en_GB.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/order/Messages_es_ES.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/order/Messages_es_ES.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/order/Messages_es_ES.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/order/Messages_es_ES.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/order/Messages_fr_CA.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/order/Messages_fr_CA.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/order/Messages_fr_CA.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/order/Messages_fr_CA.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/order/Messages_fr_FR.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/order/Messages_fr_FR.json similarity index 93% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/order/Messages_fr_FR.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/order/Messages_fr_FR.json index ca03439fd8a8..0d75f37edcec 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/order/Messages_fr_FR.json +++ b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/order/Messages_fr_FR.json @@ -5,8 +5,7 @@ "managed_vcd_vdc_order_unavailable": "Veuillez contacter le support OVHcloud", "managed_vcd_vdc_order_vhost": "Virtual Host", "managed_vcd_vdc_order_cpu_speed": "CPU (GHz)", - "managed_vcd_vdc_order_ram": "RAM", - "managed_vcd_vdc_order_ram_value": "{{ram}} GB", + "managed_vcd_vdc_order_ram_value": "{{ram}} Go", "managed_vcd_vdc_order_vcpu_count": "Nombre de vCPU", "managed_vcd_vdc_order_type": "Type", "managed_vcd_vdc_order_price": "Prix", diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/order/Messages_it_IT.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/order/Messages_it_IT.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/order/Messages_it_IT.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/order/Messages_it_IT.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/order/Messages_pl_PL.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/order/Messages_pl_PL.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/order/Messages_pl_PL.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/order/Messages_pl_PL.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/order/Messages_pt_PT.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/order/Messages_pt_PT.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/order/Messages_pt_PT.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/order/Messages_pt_PT.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/storage/Messages_de_DE.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/storage/Messages_de_DE.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/storage/Messages_de_DE.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/storage/Messages_de_DE.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/storage/Messages_en_GB.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/storage/Messages_en_GB.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/storage/Messages_en_GB.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/storage/Messages_en_GB.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/storage/Messages_es_ES.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/storage/Messages_es_ES.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/storage/Messages_es_ES.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/storage/Messages_es_ES.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/storage/Messages_fr_CA.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/storage/Messages_fr_CA.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/storage/Messages_fr_CA.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/storage/Messages_fr_CA.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/storage/Messages_fr_FR.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/storage/Messages_fr_FR.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/storage/Messages_fr_FR.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/storage/Messages_fr_FR.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/storage/Messages_it_IT.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/storage/Messages_it_IT.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/storage/Messages_it_IT.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/storage/Messages_it_IT.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/storage/Messages_pl_PL.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/storage/Messages_pl_PL.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/storage/Messages_pl_PL.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/storage/Messages_pl_PL.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/storage/Messages_pt_PT.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/storage/Messages_pt_PT.json similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/datacentres/storage/Messages_pt_PT.json rename to packages/manager/apps/hpc-vmware-managed-vcd/public/translations/datacentres/storage/Messages_pt_PT.json diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_de_DE.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_de_DE.json deleted file mode 100644 index 91eac4ece1f7..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_de_DE.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "title": "Managed VCD" -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_en_GB.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_en_GB.json deleted file mode 100644 index 91eac4ece1f7..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_en_GB.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "title": "Managed VCD" -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_es_ES.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_es_ES.json deleted file mode 100644 index 91eac4ece1f7..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_es_ES.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "title": "Managed VCD" -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_fr_CA.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_fr_CA.json deleted file mode 100644 index 91eac4ece1f7..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_fr_CA.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "title": "Managed VCD" -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_fr_FR.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_fr_FR.json deleted file mode 100644 index 91eac4ece1f7..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_fr_FR.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "title": "Managed VCD" -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_it_IT.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_it_IT.json deleted file mode 100644 index 91eac4ece1f7..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_it_IT.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "title": "Managed VCD" -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_pl_PL.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_pl_PL.json deleted file mode 100644 index 91eac4ece1f7..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_pl_PL.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "title": "Managed VCD" -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_pt_PT.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_pt_PT.json deleted file mode 100644 index 91eac4ece1f7..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/Messages_pt_PT.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "title": "Managed VCD" -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_de_DE.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_de_DE.json deleted file mode 100644 index 8e10000b4500..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_de_DE.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "manager_error_page_title": "Hoppla!", - "manager_error_page_button_cancel": "Abbrechen", - "manager_error_page_detail_code": "Fehlercode: ", - "manager_error_page_action_reload_label": "Erneut versuchen", - "manager_error_page_action_home_label": "Zurück zur Startseite", - "manager_error_page_default": "Beim Laden der Seite ist ein Fehler aufgetreten." -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_en_GB.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_en_GB.json deleted file mode 100644 index b17691e2bc6d..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_en_GB.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "manager_error_page_title": "Oops!", - "manager_error_page_button_cancel": "Cancel", - "manager_error_page_detail_code": "Error code: ", - "manager_error_page_action_reload_label": "Try again", - "manager_error_page_action_home_label": "Back to homepage", - "manager_error_page_default": "An error has occurred loading the page." -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_es_ES.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_es_ES.json deleted file mode 100644 index 15fc5f79256d..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_es_ES.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "manager_error_page_title": "¡Vaya!", - "manager_error_page_button_cancel": "Cancelar", - "manager_error_page_detail_code": "Código de error: ", - "manager_error_page_action_reload_label": "Volver a intentarlo", - "manager_error_page_action_home_label": "Volver a la página de inicio", - "manager_error_page_default": "Se ha producido un error al cargar la página." -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_fr_CA.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_fr_CA.json deleted file mode 100644 index 2c575c63588e..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_fr_CA.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "manager_error_page_title": "Oops …!", - "manager_error_page_button_cancel": "Annuler", - "manager_error_page_detail_code": "Code d'erreur : ", - "manager_error_page_action_reload_label": "Réessayer", - "manager_error_page_action_home_label": "Retour à la page d'accueil", - "manager_error_page_default": "Une erreur est survenue lors du chargement de la page." -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_fr_FR.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_fr_FR.json deleted file mode 100644 index 2c575c63588e..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_fr_FR.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "manager_error_page_title": "Oops …!", - "manager_error_page_button_cancel": "Annuler", - "manager_error_page_detail_code": "Code d'erreur : ", - "manager_error_page_action_reload_label": "Réessayer", - "manager_error_page_action_home_label": "Retour à la page d'accueil", - "manager_error_page_default": "Une erreur est survenue lors du chargement de la page." -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_it_IT.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_it_IT.json deleted file mode 100644 index d56bf8c3ddce..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_it_IT.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "manager_error_page_title": "Ops!", - "manager_error_page_button_cancel": "Annullare", - "manager_error_page_detail_code": "Codice di errore: ", - "manager_error_page_action_reload_label": "Riprova", - "manager_error_page_action_home_label": "Tornare alla home page", - "manager_error_page_default": "Si è verificato un errore durante il caricamento della pagina." -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_pl_PL.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_pl_PL.json deleted file mode 100644 index eceb9bcca2ca..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_pl_PL.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "manager_error_page_title": "Ojej...", - "manager_error_page_button_cancel": "Anuluj", - "manager_error_page_detail_code": "Kod błędu: ", - "manager_error_page_action_reload_label": "Spróbuj ponownie", - "manager_error_page_action_home_label": "Powrót do strony głównej", - "manager_error_page_default": "Wystąpił błąd podczas ładowania strony." -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_pt_PT.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_pt_PT.json deleted file mode 100644 index 25fac9551c86..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/hpc-vmware-managed-vcd/error/Messages_pt_PT.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "manager_error_page_title": "Oops!", - "manager_error_page_button_cancel": "Anular", - "manager_error_page_detail_code": "Código de erro: ", - "manager_error_page_action_reload_label": "Tentar novamente", - "manager_error_page_action_home_label": "Voltar para a página inicial", - "manager_error_page_default": "Ocorreu um erro ao carregar a página." -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/listing/Messages_fr_FR.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/listing/Messages_fr_FR.json index 8f09b0519200..8928689d0343 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/listing/Messages_fr_FR.json +++ b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/listing/Messages_fr_FR.json @@ -1,6 +1,4 @@ { - "managed_vcd_listing_title": "Managed VCD", - "managed_vcd_listing_id": "Id", "managed_vcd_listing_name": "Nom", "managed_vcd_listing_location": "Localisation", "managed_vcd_listing_region": "Région", diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/setupTests.ts b/packages/manager/apps/hpc-vmware-managed-vcd/setupTests.ts deleted file mode 100644 index 35008dfde001..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/setupTests.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { beforeAll, afterAll } from 'vitest'; -import { odsSetup } from '@ovhcloud/ods-common-core'; -import { setupServer } from 'msw/node'; -import { toMswHandlers } from '../../../../playwright-helpers'; -import { getAuthenticationMocks } from '../../../../playwright-helpers/mocks/auth'; -import '@testing-library/jest-dom'; -// PATCH for ODS Component to fix Error: Uncaught [TypeError: _this.attachInternals is not a function] -import 'element-internals-polyfill'; - -odsSetup(); - -const server = setupServer( - ...toMswHandlers([ - ...getAuthenticationMocks({ isAuthMocked: true, region: 'EU' }), - ]), -); - -beforeAll(() => { - server.listen({ onUnhandledRequest: 'warn' }); - - delete global.server; - global.__VERSION__ = null; - global.server = server; -}); - -afterAll(() => { - server.close(); - - delete global.__VERSION__; - delete global.server; -}); - -afterEach(() => { - server.resetHandlers(); -}); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/datagrid/compute/ComputeOrderCells.component.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/datagrid/compute/ComputeOrderCells.component.tsx index 839fddb6f188..8c2ac9d7cc77 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/datagrid/compute/ComputeOrderCells.component.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/datagrid/compute/ComputeOrderCells.component.tsx @@ -7,11 +7,11 @@ import { import { OsdsRadio, OsdsRadioButton } from '@ovhcloud/ods-components/react'; import { ODS_RADIO_BUTTON_SIZE } from '@ovhcloud/ods-components'; import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; -import { IVdcOrderableVhostPriced } from '@/types/vcd-vdc-orderable-resource.interface'; +import { VCDOrderableVhostPriced } from '@ovh-ux/manager-module-vcd-api'; import { getVdcResourcePriceLabel } from '@/utils/getPricedOrderableResource'; import { useDatacentreOrderContext } from '@/context/DatacentreOrder.context'; -export const ComputeOrderSelectCell = (vHost: IVdcOrderableVhostPriced) => { +export const ComputeOrderSelectCell = (vHost: VCDOrderableVhostPriced) => { const { selectedResource, setSelectedResource } = useDatacentreOrderContext(); return ( @@ -30,12 +30,12 @@ export const ComputeOrderSelectCell = (vHost: IVdcOrderableVhostPriced) => { ); }; -export const ComputeOrderVhostCell = (vHost: IVdcOrderableVhostPriced) => ( +export const ComputeOrderVhostCell = (vHost: VCDOrderableVhostPriced) => ( {vHost.profile} ); -export const ComputeOrderCpuSpeedCell = (vHost: IVdcOrderableVhostPriced) => { - const { t } = useTranslation('hpc-vmware-managed-vcd/datacentres'); +export const ComputeOrderCpuSpeedCell = (vHost: VCDOrderableVhostPriced) => { + const { t } = useTranslation('datacentres'); return ( {t('managed_vcd_vdc_vcpu_value', { speed: vHost.vCPUSpeed })} @@ -43,8 +43,8 @@ export const ComputeOrderCpuSpeedCell = (vHost: IVdcOrderableVhostPriced) => { ); }; -export const ComputeOrderRamCell = (vHost: IVdcOrderableVhostPriced) => { - const { t } = useTranslation('hpc-vmware-managed-vcd/datacentres/order'); +export const ComputeOrderRamCell = (vHost: VCDOrderableVhostPriced) => { + const { t } = useTranslation('datacentres/order'); return ( {t('managed_vcd_vdc_order_ram_value', { @@ -54,12 +54,12 @@ export const ComputeOrderRamCell = (vHost: IVdcOrderableVhostPriced) => { ); }; -export const ComputeOrderCpuCountCell = (vHost: IVdcOrderableVhostPriced) => ( +export const ComputeOrderCpuCountCell = (vHost: VCDOrderableVhostPriced) => ( {vHost.vCPUCount} ); -export const ComputeOrderPriceCell = (vHost: IVdcOrderableVhostPriced) => { - const { t } = useTranslation('hpc-vmware-managed-vcd/datacentres/order'); +export const ComputeOrderPriceCell = (vHost: VCDOrderableVhostPriced) => { + const { t } = useTranslation('datacentres/order'); return ( diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/datagrid/container/DatagridContainer.component.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/datagrid/container/DatagridContainer.component.tsx index afd8f9567d90..f5c6ea3b3c32 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/datagrid/container/DatagridContainer.component.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/datagrid/container/DatagridContainer.component.tsx @@ -8,6 +8,7 @@ import { import { OsdsDivider } from '@ovhcloud/ods-components/react'; import React, { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; +import { icebergListingQueryKey } from '@ovh-ux/manager-module-vcd-api'; import Loading from '@/components/loading/Loading.component'; import TDatagridRoute from '@/types/datagrid-route.type'; import { useAutoRefetch } from '@/data/hooks/useAutoRefetch'; @@ -15,7 +16,6 @@ import { hasResourceUpdatingTargetSpec, UpdatableResource, } from '@/utils/refetchConditions'; -import { icebergListingQueryKey } from '@/utils/queryKeys'; export type TDatagridContainerProps = { route: TDatagridRoute; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/datagrid/storage/StorageOrderCells.component.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/datagrid/storage/StorageOrderCells.component.tsx index b94e76afee5b..0ee805d7f77f 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/datagrid/storage/StorageOrderCells.component.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/datagrid/storage/StorageOrderCells.component.tsx @@ -7,11 +7,11 @@ import { import { OsdsRadio, OsdsRadioButton } from '@ovhcloud/ods-components/react'; import { ODS_RADIO_BUTTON_SIZE } from '@ovhcloud/ods-components'; import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; -import { IVdcOrderableStoragePriced } from '@/types/vcd-vdc-orderable-resource.interface'; +import { VCDOrderableStoragePriced } from '@ovh-ux/manager-module-vcd-api'; import { getVdcResourcePriceLabel } from '@/utils/getPricedOrderableResource'; import { useDatacentreOrderContext } from '@/context/DatacentreOrder.context'; -export const StorageOrderSelectCell = (storage: IVdcOrderableStoragePriced) => { +export const StorageOrderSelectCell = (storage: VCDOrderableStoragePriced) => { const { selectedResource, setSelectedResource } = useDatacentreOrderContext(); return ( @@ -30,12 +30,12 @@ export const StorageOrderSelectCell = (storage: IVdcOrderableStoragePriced) => { ); }; -export const StorageOrderTypeCell = (storage: IVdcOrderableStoragePriced) => ( +export const StorageOrderTypeCell = (storage: VCDOrderableStoragePriced) => ( {storage.name} ); -export const StorageOrderPriceCell = (storage: IVdcOrderableStoragePriced) => { - const { t } = useTranslation('hpc-vmware-managed-vcd/datacentres/order'); +export const StorageOrderPriceCell = (storage: VCDOrderableStoragePriced) => { + const { t } = useTranslation('datacentres/order'); return ( diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/form/DatacentreOrder.component.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/form/DatacentreOrder.component.tsx index 31f6a5298b07..b15a7d9fc7d9 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/form/DatacentreOrder.component.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/form/DatacentreOrder.component.tsx @@ -11,23 +11,23 @@ import { import { OsdsButton } from '@ovhcloud/ods-components/react'; import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; import { ODS_BUTTON_SIZE, ODS_BUTTON_VARIANT } from '@ovhcloud/ods-components'; +import { + useVcdCatalog, + useVcdOrder, + useVdcOrderableResource, + VCDOrderableStoragePriced, + VCDOrderableVhostPriced, +} from '@ovh-ux/manager-module-vcd-api'; import { QuantitySelector } from './QuantitySelector.component'; import { useDatacentreOrderContext } from '@/context/DatacentreOrder.context'; -import { useVdcOrderableResource } from '@/data/hooks/useOrderableResource'; -import { useVcdCatalog } from '@/data/hooks/useVcdCatalog'; -import useVcdOrder from '@/data/hooks/useVcdOrder'; import { validateQuantity } from '@/utils/formValidation'; import { getPricedVdcResources } from '@/utils/getPricedOrderableResource'; import Loading from '../loading/Loading.component'; -import { - IVdcOrderableStoragePriced, - IVdcOrderableVhostPriced, -} from '@/types/vcd-vdc-orderable-resource.interface'; type OrderType = 'compute' | 'storage'; type OrderColumns = T extends 'compute' - ? DatagridColumn[] - : DatagridColumn[]; + ? DatagridColumn[] + : DatagridColumn[]; interface DatacentreOrderProps { orderType: T; @@ -48,7 +48,7 @@ export const DatacentreOrder = ({ minQuantity = 1, maxQuantity = 100, }: DatacentreOrderProps) => { - const { t } = useTranslation('hpc-vmware-managed-vcd/datacentres/order'); + const { t } = useTranslation('datacentres/order'); const navigate = useNavigate(); const { id, vdcId } = useParams(); const { diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/modal/UpdateDetailModalHandler.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/modal/UpdateDetailModalHandler.tsx index de8a6f62f73e..f0dd835002dd 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/modal/UpdateDetailModalHandler.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/modal/UpdateDetailModalHandler.tsx @@ -1,9 +1,11 @@ import React from 'react'; import { useNavigate, useParams } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; -import useManagedVcdOrganization from '@/data/hooks/useManagedVcdOrganization'; -import { useUpdateVcdOrganizationDetails } from '@/data/hooks/useUpdateVcdOrganization'; -import { IVcdOrganizationState } from '@/types/vcd-organization.interface'; +import { + useVcdOrganization, + useUpdateVcdOrganizationDetails, + VCDOrganizationTargetSpec, +} from '@ovh-ux/manager-module-vcd-api'; import { validateDescription, validateOrganizationName, @@ -30,7 +32,7 @@ export const UpdateDetailModalHandler = ({ const closeModal = () => navigate('..'); const { addSuccess } = useMessageContext(); const { id } = useParams(); - const { data: vcdOrganization } = useManagedVcdOrganization({ id }); + const { data: vcdOrganization } = useVcdOrganization({ id }); const { updateDetails, error, isError } = useUpdateVcdOrganizationDetails({ id, onSuccess: () => { @@ -42,7 +44,8 @@ export const UpdateDetailModalHandler = ({ closeModal(); }, }); - const currentDetails: IVcdOrganizationState = vcdOrganization.data.targetSpec; + const currentDetails: VCDOrganizationTargetSpec = + vcdOrganization.data.targetSpec; const getOrganizationDetailKey = (key: OrganizationDetailName) => { const detailKeys: TOrganizationDetails = { diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-general-information-tile/DatacentreGeneralInformationTile.component.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-general-information-tile/DatacentreGeneralInformationTile.component.tsx index 66edd14e1fb7..f0fb668d86cd 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-general-information-tile/DatacentreGeneralInformationTile.component.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-general-information-tile/DatacentreGeneralInformationTile.component.tsx @@ -9,16 +9,16 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; import { OdsHTMLAnchorElementTarget } from '@ovhcloud/ods-common-core'; -import IVcdDatacentre from '@/types/vcd-datacenter.interface'; -import IVcdOrganization from '@/types/vcd-organization.interface'; +import { VCDDatacentre, VCDOrganization } from '@ovh-ux/manager-module-vcd-api'; import { subRoutes } from '@/routes/routes.constant'; import { iamActions } from '@/utils/iam.constants'; import EditableTileItem from '../editable-tile-item/EditableTileItem.component'; import { capitalize } from '@/utils/capitalize'; +import { ID_LABEL } from '@/pages/dashboard/dashboard.constants'; type TTileProps = { - vcdDatacentre: IVcdDatacentre; - vcdOrganization: IVcdOrganization; + vcdDatacentre: VCDDatacentre; + vcdOrganization: VCDOrganization; }; export default function DatacentreGenerationInformationTile({ @@ -26,7 +26,7 @@ export default function DatacentreGenerationInformationTile({ vcdOrganization, }: TTileProps) { const { t } = useTranslation('dashboard'); - const { t: tVdc } = useTranslation('hpc-vmware-managed-vcd/datacentres'); + const { t: tVdc } = useTranslation('datacentres'); const navigate = useNavigate(); return ( @@ -56,15 +56,6 @@ export default function DatacentreGenerationInformationTile({ ), }, - { - id: 'cpuCount', - label: tVdc('managed_vcd_vdc_vcpu_count'), - value: ( - - {vcdDatacentre?.currentState?.vCPUCount?.toString()} - - ), - }, { id: 'ramCount', label: tVdc('managed_vcd_vdc_ram_count'), @@ -76,17 +67,6 @@ export default function DatacentreGenerationInformationTile({ ), }, - { - id: 'vcpuSpeed', - label: tVdc('managed_vcd_vdc_vcpu_speed'), - value: ( - - {tVdc('managed_vcd_vdc_vcpu_value', { - speed: vcdDatacentre?.currentState?.vCPUSpeed, - })} - - ), - }, { id: 'interface', label: t('managed_vcd_dashboard_management_interface'), @@ -106,7 +86,7 @@ export default function DatacentreGenerationInformationTile({ }, { id: 'vdcId', - label: tVdc('managed_vcd_vdc_id'), + label: ID_LABEL, value: , }, ]} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-general-information-tile/DatacentreGeneralInformationTile.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-general-information-tile/DatacentreGeneralInformationTile.spec.tsx index eef4a6e1616e..b7b71890451c 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-general-information-tile/DatacentreGeneralInformationTile.spec.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-general-information-tile/DatacentreGeneralInformationTile.spec.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import { render } from '@testing-library/react'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { describe, expect, it, vi } from 'vitest'; @@ -6,7 +7,7 @@ import { ODS_THEME_TYPOGRAPHY_LEVEL, ODS_THEME_TYPOGRAPHY_SIZE, } from '@ovhcloud/ods-common-theming'; -import React from 'react'; +import { VCDDatacentre, VCDOrganization } from '@ovh-ux/manager-module-vcd-api'; import DatacentreGeneralInformationTile from './DatacentreGeneralInformationTile.component'; const queryClient = new QueryClient({ @@ -78,8 +79,8 @@ describe.skip('DatacentreGeneralInformationTile component unit test suite', () = const { getByText } = render( , ); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-usage-tile/DatacentreUsageTile.component.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-usage-tile/DatacentreUsageTile.component.tsx index 9553b740cff3..065fffef6ab5 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-usage-tile/DatacentreUsageTile.component.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-usage-tile/DatacentreUsageTile.component.tsx @@ -6,16 +6,16 @@ import { Description, } from '@ovh-ux/manager-react-components'; import { ODS_ICON_NAME } from '@ovhcloud/ods-components'; -import IVcdDatacentre from '@/types/vcd-datacenter.interface'; +import { VCDDatacentre } from '@ovh-ux/manager-module-vcd-api'; type TTileProps = { - vcdDatacentre: IVcdDatacentre; + vcdDatacentre: VCDDatacentre; }; export default function DatacentreUsageTile({ vcdDatacentre, }: Readonly) { - const { t } = useTranslation('hpc-vmware-managed-vcd/datacentres'); + const { t } = useTranslation('datacentres'); return (
diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-usage-tile/DatacentreUsageTile.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-usage-tile/DatacentreUsageTile.spec.tsx index a6b36768edf7..4e841b2fc13c 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-usage-tile/DatacentreUsageTile.spec.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-usage-tile/DatacentreUsageTile.spec.tsx @@ -5,8 +5,8 @@ import { ODS_THEME_TYPOGRAPHY_LEVEL, ODS_THEME_TYPOGRAPHY_SIZE, } from '@ovhcloud/ods-common-theming'; +import { datacentreList } from '@ovh-ux/manager-module-vcd-api'; import DatacentreUsageTile from './DatacentreUsageTile.component'; -import { datacentreList } from '../../../../mocks/vcd-organization/vcd-datacentre.mock'; type TTileItem = { label: HTMLElement; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-data-tile/OrganizationDataProtectionTile.component.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-data-tile/OrganizationDataProtectionTile.component.tsx index 4d227fcd0a1e..f879650e6efe 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-data-tile/OrganizationDataProtectionTile.component.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-data-tile/OrganizationDataProtectionTile.component.tsx @@ -4,15 +4,15 @@ import { DashboardTile } from '@ovh-ux/manager-react-components'; import { OsdsChip } from '@ovhcloud/ods-components/react'; import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; import { ODS_CHIP_SIZE } from '@ovhcloud/ods-components'; +import { VCDOrganization } from '@ovh-ux/manager-module-vcd-api'; import { - DATA_PROTECTION_BACKUP_TITLE, - DATA_PROTECTION_RECOVERY_TITLE, -} from '@/pages/dashboard/organization/OrganizationDashboard.constants'; + DATA_PROTECTION_BACKUP_LABEL, + DATA_PROTECTION_RECOVERY_LABEL, +} from '@/pages/dashboard/organization/organizationDashboard.constants'; import BackupTileItem from './backup-tile-item/BackupTileItem.component'; -import IVcdOrganization from '@/types/vcd-organization.interface'; type TTileProps = { - vcdOrganization: IVcdOrganization; + vcdOrganization: VCDOrganization; }; export default function DataProtectionTile({ @@ -27,12 +27,12 @@ export default function DataProtectionTile({ items={[ { id: 'backup', - label: DATA_PROTECTION_BACKUP_TITLE, + label: DATA_PROTECTION_BACKUP_LABEL, value: , }, { id: 'recovery', - label: DATA_PROTECTION_RECOVERY_TITLE, + label: DATA_PROTECTION_RECOVERY_LABEL, value: ( ({ - useManagedVcdOrganizationBackup: vi.fn(), -})); -vi.mocked(useManagedVcdOrganizationBackup).mockReturnValue( - {} as UseQueryResult, ApiError>, + +vi.mock('@ovh-ux/manager-module-vcd-api', async (original) => { + const actual: any = await original(); + return { + ...actual, + useVeeamBackup: vi.fn(), + getBackupIdFromOrganization: vi.fn(), + }; +}); + +vi.mocked(useVeeamBackup).mockReturnValue( + {} as UseQueryResult, ApiError>, ); const shellContext = { @@ -88,9 +95,9 @@ describe('OrganizationDataProtectionTile component unit test suite', () => { describe('OrganizationDataProtectionTile query state-based behavior unit test suite', () => { it('should display backupLoading when query isLoading', async () => { - vi.mocked(useManagedVcdOrganizationBackup).mockReturnValue({ + vi.mocked(useVeeamBackup).mockReturnValue({ isLoading: true, - } as UseQueryResult, ApiError>); + } as UseQueryResult, ApiError>); // when await act(async () => renderComponent()); @@ -101,9 +108,9 @@ describe('OrganizationDataProtectionTile query state-based behavior unit test su }); it('should display backupError when query isError', async () => { - vi.mocked(useManagedVcdOrganizationBackup).mockReturnValue({ + vi.mocked(useVeeamBackup).mockReturnValue({ isError: true, - } as UseQueryResult, ApiError>); + } as UseQueryResult, ApiError>); // when await act(async () => renderComponent()); @@ -116,10 +123,10 @@ describe('OrganizationDataProtectionTile query state-based behavior unit test su }); it('should display noBackup when query isError 404', async () => { - vi.mocked(useManagedVcdOrganizationBackup).mockReturnValue({ + vi.mocked(useVeeamBackup).mockReturnValue({ isError: true, error: { response: { status: 404 } }, - } as UseQueryResult, ApiError>); + } as UseQueryResult, ApiError>); // when await act(async () => renderComponent()); @@ -130,11 +137,11 @@ describe('OrganizationDataProtectionTile query state-based behavior unit test su }); it('should display backupStatus when query isSuccess', async () => { - const testStatus = BackupResourceStatus.CREATING; - vi.mocked(useManagedVcdOrganizationBackup).mockReturnValue({ + const testStatus: ResourceStatus = 'READY'; + vi.mocked(useVeeamBackup).mockReturnValue({ isSuccess: true, data: { data: { resourceStatus: testStatus } }, - } as UseQueryResult, ApiError>); + } as UseQueryResult, ApiError>); // when await act(async () => renderComponent()); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-data-tile/backup-tile-item/BackupTileItem.component.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-data-tile/backup-tile-item/BackupTileItem.component.tsx index 5792d1630a58..44323c899931 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-data-tile/backup-tile-item/BackupTileItem.component.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-data-tile/backup-tile-item/BackupTileItem.component.tsx @@ -4,17 +4,20 @@ import { ShellContext } from '@ovh-ux/manager-react-shell-client'; import { Links, LinkType } from '@ovh-ux/manager-react-components'; import { ODS_CHIP_SIZE } from '@ovhcloud/ods-components'; import { OsdsChip, OsdsSkeleton } from '@ovhcloud/ods-components/react'; +import { + getBackupIdFromOrganization, + useVeeamBackup, + VCDOrganization, +} from '@ovh-ux/manager-module-vcd-api'; import { veeamBackupAppName } from '@/routes/routes.constant'; -import { useManagedVcdOrganizationBackup } from '@/data/hooks/useManagedVcdOrganization'; import { BackupBadgeParams, getBackupBadgeParams, getBackupBadgeStatus, } from '@/utils/veeamBackupBadge'; -import IVcdOrganization from '@/types/vcd-organization.interface'; type TTileProps = { - vcdOrganization: IVcdOrganization; + vcdOrganization: VCDOrganization; }; export default function BackupTileItem({ @@ -22,8 +25,8 @@ export default function BackupTileItem({ }: Readonly) { const { t } = useTranslation('dashboard'); const { shell } = React.useContext(ShellContext); - const { data: vcdBackup, isLoading, error } = useManagedVcdOrganizationBackup( - vcdOrganization, + const { data: vcdBackup, isLoading, error } = useVeeamBackup( + getBackupIdFromOrganization(vcdOrganization), ); const [veeamHref, setVeeamHref] = React.useState(''); const badgeParams: BackupBadgeParams = getBackupBadgeParams( diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-general-information-tile/DatacentresCount.component.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-general-information-tile/DatacentresCount.component.tsx index e40b52bcf946..d9accc6bcddb 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-general-information-tile/DatacentresCount.component.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-general-information-tile/DatacentresCount.component.tsx @@ -3,16 +3,13 @@ import { Description } from '@ovh-ux/manager-react-components'; import { useParams } from 'react-router-dom'; import { OsdsSkeleton, OsdsMessage } from '@ovhcloud/ods-components/react'; import { ODS_MESSAGE_TYPE, ODS_SKELETON_SIZE } from '@ovhcloud/ods-components'; -import useManagedVcdDatacentres from '@/data/hooks/useManagedVcdDatacentres'; +import { useVcdDatacentres } from '@ovh-ux/manager-module-vcd-api'; export const DatacentresCount: React.FC = () => { const { id } = useParams(); - const { - data: vDatacentres, - isError, - error, - isLoading, - } = useManagedVcdDatacentres(id); + const { data: vDatacentres, isError, error, isLoading } = useVcdDatacentres( + id, + ); if (isError) { return ( diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-general-information-tile/OrganizationGeneralInformationTile.component.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-general-information-tile/OrganizationGeneralInformationTile.component.tsx index d49cbadb4482..8a471b5f86eb 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-general-information-tile/OrganizationGeneralInformationTile.component.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-general-information-tile/OrganizationGeneralInformationTile.component.tsx @@ -17,14 +17,14 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; import { OdsHTMLAnchorElementTarget } from '@ovhcloud/ods-common-core'; -import IVcdOrganization from '@/types/vcd-organization.interface'; +import { VCDOrganization } from '@ovh-ux/manager-module-vcd-api'; import { subRoutes } from '@/routes/routes.constant'; import { iamActions } from '@/utils/iam.constants'; import EditableTileItem from '../editable-tile-item/EditableTileItem.component'; import DatacentresCount from './DatacentresCount.component'; type TTileProps = { - vcdOrganization: IVcdOrganization; + vcdOrganization: VCDOrganization; }; export default function OrganizationGenerationInformationTile({ diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-options-tile/OrganizationOptionsTile.component.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-options-tile/OrganizationOptionsTile.component.tsx index 2d60a54f917e..834004a12439 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-options-tile/OrganizationOptionsTile.component.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-options-tile/OrganizationOptionsTile.component.tsx @@ -7,7 +7,7 @@ import { import { useTranslation } from 'react-i18next'; import { ODS_ICON_NAME } from '@ovhcloud/ods-components'; import { useParams } from 'react-router-dom'; -import useVcdOrder from '@/data/hooks/useVcdOrder'; +import { useVcdOrder } from '@ovh-ux/manager-module-vcd-api'; import { WINDOWS_LICENSE_PLANCODE } from '@/utils/planCode.constants'; export default function OrganizationOptionsTile({ diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-service-tile/OrganizationServiceManagementTile.component.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-service-tile/OrganizationServiceManagementTile.component.tsx index 3de4d72d56b4..5c882e6f0158 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-service-tile/OrganizationServiceManagementTile.component.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-service-tile/OrganizationServiceManagementTile.component.tsx @@ -1,24 +1,18 @@ import React from 'react'; -import { DashboardTile } from '@ovh-ux/manager-react-components'; -import { - OsdsChip, - OsdsIcon, - OsdsLink, - OsdsTooltip, - OsdsTooltipContent, -} from '@ovhcloud/ods-components/react'; import { useTranslation } from 'react-i18next'; +import { useNavigate, useParams } from 'react-router-dom'; +import { DashboardTile, Links } from '@ovh-ux/manager-react-components'; +import { OsdsChip } from '@ovhcloud/ods-components/react'; import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; -import { - ODS_CHIP_SIZE, - ODS_ICON_NAME, - ODS_ICON_SIZE, -} from '@ovhcloud/ods-components'; +import { ODS_CHIP_SIZE } from '@ovhcloud/ods-components'; import ServiceRenewTileItem from './renew-tile-item/ServiceRenewTileItem'; import ServiceContactsTileItem from './contact-tile-item/ServiceContactsTileItem'; +import { subRoutes, urls } from '@/routes/routes.constant'; export default function OrganizationServiceManagementTile() { const { t } = useTranslation('dashboard'); + const { id } = useParams(); + const navigate = useNavigate(); return (
@@ -48,35 +42,12 @@ export default function OrganizationServiceManagementTile() { id: 'servicePassword', label: t('managed_vcd_dashboard_password'), value: ( -
-
- - {t('managed_vcd_dashboard_password_renew')} - - - - - {t('managed_vcd_dashboard_password_tooltip')} - - -
- - {t('managed_vcd_dashboard_coming_soon')} - -
+ + navigate(urls.resetPassword.replace(subRoutes.dashboard, id)) + } + /> ), }, { diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd-cart.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd-cart.ts deleted file mode 100644 index 9e8e6e190601..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd-cart.ts +++ /dev/null @@ -1,9 +0,0 @@ -import apiClient, { ApiResponse } from '@ovh-ux/manager-core-api'; -import { TVcdCatalog } from '@/types/vcd-catalog.interface'; - -export const getVcdCatalog = async ( - serviceName: string, -): Promise> => - apiClient.v6.get( - `/order/cartServiceOption/vmwareCloudDirector/${serviceName}`, - ); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd-datacentre.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd-datacentre.ts deleted file mode 100644 index e47ec1cb7918..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd-datacentre.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { ApiResponse, apiClient } from '@ovh-ux/manager-core-api'; -import IVcdDatacentre, { - IVcdDatacentreState, -} from '@/types/vcd-datacenter.interface'; -import { VCD_ORGANIZATION_ROUTE } from './hpc-vmware-managed-vcd.constants'; -import { IVdcOrderableResourceData } from '@/types/vcd-vdc-orderable-resource.interface'; - -export type UpdateVdcDetailsParams = { - id: string; - vdcId: string; - details: IVcdDatacentreState; -}; - -export const getVcdDatacentresRoute = (id: string) => { - return `${VCD_ORGANIZATION_ROUTE}/${id}/virtualDataCenter`; -}; - -export const getVcdDatacentreRoute = (id: string, vdcId: string) => { - return `${getVcdDatacentresRoute(id)}/${vdcId}`; -}; - -export const getVcdDatacentreComputeRoute = (id: string, vdcId: string) => { - return `${getVcdDatacentreRoute(id, vdcId)}/compute`; -}; - -export const getVcdDatacentreStorageRoute = (id: string, vdcId: string) => { - return `${getVcdDatacentreRoute(id, vdcId)}/storage`; -}; - -export const getVdcOrderableResourceRoute = (id: string, vdcId: string) => { - return `${getVcdDatacentreRoute(id, vdcId)}/orderableResource`; -}; - -export const getVcdDatacentre = async ( - id: string, - vdcId: string, -): Promise> => - apiClient.v2.get(getVcdDatacentreRoute(id, vdcId)); - -export const getVcdDatacentres = async ( - id: string, -): Promise> => - apiClient.v2.get(getVcdDatacentresRoute(id)); - -export const updateVdcDetails = async ({ - id, - vdcId, - details, -}: UpdateVdcDetailsParams) => - apiClient.v2.put(getVcdDatacentreRoute(id, vdcId), { - targetSpec: details, - }); - -export const getVdcOrderableResource = async ( - id: string, - vdcId: string, -): Promise> => - apiClient.v2.get(getVdcOrderableResourceRoute(id, vdcId)); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd-reset-password.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd-reset-password.ts deleted file mode 100644 index 724ad903b770..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd-reset-password.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { apiClient, ApiResponse } from '@ovh-ux/manager-core-api'; -import { VCD_ORGANIZATION_ROUTE } from './hpc-vmware-managed-vcd.constants'; - -const getResetPasswordRoute = (id: string) => - `${VCD_ORGANIZATION_ROUTE}/${id}/password`; - -export const resetOrganizationPassword = ( - id: string, -): Promise> => - apiClient.v2.post(getResetPasswordRoute(id)); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd.constants.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd.constants.ts deleted file mode 100644 index 52f99990905f..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd.constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const VCD_ORGANIZATION_ROUTE = '/vmwareCloudDirector/organization'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd.ts deleted file mode 100644 index 2f44ffc3466b..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/api/hpc-vmware-managed-vcd.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { ApiResponse, apiClient } from '@ovh-ux/manager-core-api'; -import IVcdOrganization, { - IVcdOrganizationState, -} from '@/types/vcd-organization.interface'; -import { VCD_ORGANIZATION_ROUTE } from './hpc-vmware-managed-vcd.constants'; -import IVcdOrganizationBackup from '@/types/vcd-organization-backup.interface'; - -export type GetVcdOrganizationListParams = { - /** Filter resources on IAM tags */ - iamTags: any; -}; - -export type UpdateVcdOrganizationDetailsParams = { - id: string; - details: IVcdOrganizationState; -}; - -/** - * VMware on OVHcloud : Get VMware on OVHcloud - */ -export const getVcdOrganization = async ( - id: string, -): Promise> => - apiClient.v2.get(`${VCD_ORGANIZATION_ROUTE}/${id}`); - -/** - * Get VCD Backup - */ -export const getVcdOrganizationBackup = async ( - backupId: string, -): Promise> => - apiClient.v2.get(`/vmwareCloudDirector/backup/${backupId}`); - -/** - * Edit VCD Organization - */ -export const updateVcdOrganizationDetails = async ({ - id, - details, -}: UpdateVcdOrganizationDetailsParams): Promise> => - apiClient.v2.put(`${VCD_ORGANIZATION_ROUTE}/${id}`, { - targetSpec: details, - }); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useManagedVcdDatacentres.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useManagedVcdDatacentres.ts deleted file mode 100644 index 731f91d80b79..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useManagedVcdDatacentres.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { ApiError, ApiResponse } from '@ovh-ux/manager-core-api'; -import { keepPreviousData, useQuery } from '@tanstack/react-query'; -import { - getVcdDatacentre, - getVcdDatacentres, -} from '../api/hpc-vmware-managed-vcd-datacentre'; -import IVcdDatacentre from '@/types/vcd-datacenter.interface'; -import { - getVcdDatacentresQueryKey, - getVcdDatacentreQueryKey, -} from '@/utils/queryKeys'; - -const useManagedVcdDatacentres = (id: string) => { - return useQuery, ApiError>({ - queryKey: getVcdDatacentresQueryKey(id), - queryFn: () => getVcdDatacentres(id), - retry: false, - placeholderData: keepPreviousData, - }); -}; - -export const useManagedVcdDatacentre = (id: string, vdcId: string) => { - return useQuery, ApiError>({ - queryKey: getVcdDatacentreQueryKey(id, vdcId), - queryFn: () => getVcdDatacentre(id, vdcId), - retry: false, - placeholderData: keepPreviousData, - }); -}; - -export default useManagedVcdDatacentres; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useManagedVcdOrganization.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useManagedVcdOrganization.ts deleted file mode 100644 index 4e12d4df9cbb..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useManagedVcdOrganization.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { ApiError, ApiResponse } from '@ovh-ux/manager-core-api'; -import { - keepPreviousData, - useQuery, - UseQueryOptions, -} from '@tanstack/react-query'; -import { - getVcdOrganization, - getVcdOrganizationBackup, -} from '../api/hpc-vmware-managed-vcd'; -import IVcdOrganization from '@/types/vcd-organization.interface'; -import IVcdOrganizationBackup from '@/types/vcd-organization-backup.interface'; -import { - getVcdOrganizationQueryKey, - getVcdOrganizationBackupQueryKey, -} from '@/utils/queryKeys'; -import { getBackupIdFromOrganization } from '@/utils/veeamBackupId'; - -interface IUseManagedVcdOrganization - extends Pick { - id: string; -} - -const useManagedVcdOrganization = ({ - id, - refetchInterval, - refetchOnWindowFocus, -}: IUseManagedVcdOrganization) => { - return useQuery, ApiError>({ - queryKey: getVcdOrganizationQueryKey(id), - queryFn: () => getVcdOrganization(id), - retry: false, - refetchInterval, - refetchOnWindowFocus, - placeholderData: keepPreviousData, - }); -}; - -export const useManagedVcdOrganizationBackup = ( - vcdOrganization: IVcdOrganization, -) => { - return useQuery, ApiError>({ - queryKey: getVcdOrganizationBackupQueryKey(vcdOrganization.id), - queryFn: () => - getVcdOrganizationBackup(getBackupIdFromOrganization(vcdOrganization)), - retry: false, - placeholderData: keepPreviousData, - }); -}; - -export default useManagedVcdOrganization; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/dashboard.constants.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/dashboard.constants.ts new file mode 100644 index 000000000000..239729703ea9 --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/dashboard.constants.ts @@ -0,0 +1 @@ +export const ID_LABEL = 'ID'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/DatacentreDashboard.constant.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/DatacentreDashboard.constant.ts deleted file mode 100644 index 2ff0183ba413..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/DatacentreDashboard.constant.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const COMPUTE_TITLE = 'Compute'; -export const STORAGE_TITLE = 'Storage'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/DatacentreDashboard.page.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/DatacentreDashboard.page.tsx index 33687d51b868..f9eab5a69eeb 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/DatacentreDashboard.page.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/DatacentreDashboard.page.tsx @@ -1,24 +1,26 @@ import React from 'react'; import { useNavigate, useParams, useResolvedPath } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; +import { + useVcdOrganization, + useVcdDatacentre, + getVcdDatacentreListQueryKey, +} from '@ovh-ux/manager-module-vcd-api'; import { BreadcrumbItem } from '@/hooks/breadcrumb/useBreadcrumb'; import VcdDashboardLayout from '@/components/dashboard/layout/VcdDashboardLayout.component'; -import { useManagedVcdDatacentre } from '@/data/hooks/useManagedVcdDatacentres'; -import useManagedVcdOrganization from '@/data/hooks/useManagedVcdOrganization'; -import { COMPUTE_TITLE, STORAGE_TITLE } from './DatacentreDashboard.constant'; +import { COMPUTE_LABEL, STORAGE_LABEL } from './datacentreDashboard.constants'; import { subRoutes, urls } from '@/routes/routes.constant'; import { useAutoRefetch } from '@/data/hooks/useAutoRefetch'; import { isUpdatingTargetSpec } from '@/utils/refetchConditions'; -import { getVcdDatacentresQueryKey } from '@/utils/queryKeys'; function DatacentreDashboardPage() { const { id, vdcId } = useParams(); const { t } = useTranslation('dashboard'); - const { data: vcdDatacentre } = useManagedVcdDatacentre(id, vdcId); - const { data: vcdOrganization } = useManagedVcdOrganization({ id }); + const { data: vcdDatacentre } = useVcdDatacentre(id, vdcId); + const { data: vcdOrganization } = useVcdOrganization({ id }); const navigate = useNavigate(); useAutoRefetch({ - queryKey: getVcdDatacentresQueryKey(id), + queryKey: getVcdDatacentreListQueryKey(id), enabled: isUpdatingTargetSpec(vcdDatacentre?.data), interval: 4000, }); @@ -31,12 +33,12 @@ function DatacentreDashboardPage() { }, { name: 'compute', - title: COMPUTE_TITLE, + title: COMPUTE_LABEL, to: useResolvedPath('compute').pathname, }, { name: 'storage', - title: STORAGE_TITLE, + title: STORAGE_LABEL, to: useResolvedPath('storage').pathname, }, ]; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/DatacentreDashboard.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/DatacentreDashboard.spec.tsx index d0fa0db2482e..0cdfc620ba25 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/DatacentreDashboard.spec.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/DatacentreDashboard.spec.tsx @@ -1,6 +1,9 @@ -import { checkTextVisibility, labels, renderTest } from '../../../test-utils'; -import { datacentreList } from '../../../../mocks/vcd-organization/vcd-datacentre.mock'; -import { organizationList } from '../../../../mocks/vcd-organization/vcd-organization.mock'; +import { + organizationList, + datacentreList, +} from '@ovh-ux/manager-module-vcd-api'; +import { assertTextVisibility } from '@ovh-ux/manager-core-test-utils'; +import { labels, renderTest } from '../../../test-utils'; describe('Datacentre Dashboard Page', () => { it('display the datacentre dashboard page', async () => { @@ -8,7 +11,7 @@ describe('Datacentre Dashboard Page', () => { initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}`, }); - await checkTextVisibility(labels.datacentres.managed_vcd_vdc_vcpu_count); + await assertTextVisibility(labels.datacentres.managed_vcd_vdc_vcpu_count); }); it('display an error', async () => { @@ -17,6 +20,6 @@ describe('Datacentre Dashboard Page', () => { isDatacentresKo: true, }); - await checkTextVisibility('Datacentre error'); + await assertTextVisibility('Datacentre error'); }); }); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute-order/DatacentreComputeOrder.page.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute-order/DatacentreComputeOrder.page.tsx index a49f82bcbe33..d6b68d0fd748 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute-order/DatacentreComputeOrder.page.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute-order/DatacentreComputeOrder.page.tsx @@ -1,8 +1,8 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { DatagridColumn } from '@ovh-ux/manager-react-components'; +import { VCDOrderableVhostPriced } from '@ovh-ux/manager-module-vcd-api'; import { DatacentreOrderProvider } from '@/context/DatacentreOrder.context'; -import { IVdcOrderableVhostPriced } from '@/types/vcd-vdc-orderable-resource.interface'; import { DatacentreOrder } from '@/components/form/DatacentreOrder.component'; import { ComputeOrderSelectCell, @@ -15,15 +15,14 @@ import { import { COMPUTE_ORDER_MAX_QUANTITY, COMPUTE_ORDER_MIN_QUANTITY, -} from './DatacentreComputeOrder.constants'; +} from './datacentreComputeOrder.constants'; import { subRoutes } from '@/routes/routes.constant'; +import { RAM_LABEL, VHOST_LABEL } from '../compute/datacentreCompute.constants'; export default function ComputeOrderPage() { - const { t } = useTranslation('hpc-vmware-managed-vcd/datacentres/order'); - const { t: tCompute } = useTranslation( - 'hpc-vmware-managed-vcd/datacentres/compute', - ); - const columns: DatagridColumn[] = [ + const { t } = useTranslation('datacentres/order'); + const { t: tCompute } = useTranslation('datacentres/compute'); + const columns: DatagridColumn[] = [ { id: 'select', cell: ComputeOrderSelectCell, @@ -33,7 +32,7 @@ export default function ComputeOrderPage() { { id: 'vhost', cell: ComputeOrderVhostCell, - label: t('managed_vcd_vdc_order_vhost'), + label: VHOST_LABEL, isSortable: false, }, { @@ -45,7 +44,7 @@ export default function ComputeOrderPage() { { id: 'ram', cell: ComputeOrderRamCell, - label: t('managed_vcd_vdc_order_ram'), + label: RAM_LABEL, isSortable: false, }, { diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute-order/DatacentreComputeOrder.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute-order/DatacentreComputeOrder.spec.tsx index 22e78b6a5ccc..7e3d669b100e 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute-order/DatacentreComputeOrder.spec.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute-order/DatacentreComputeOrder.spec.tsx @@ -1,12 +1,11 @@ import { screen, waitFor } from '@testing-library/dom'; import userEvent from '@testing-library/user-event'; import { - checkTextVisibility, - labels, - renderTest, -} from '../../../../test-utils'; -import { datacentreList } from '../../../../../mocks/vcd-organization/vcd-datacentre.mock'; -import { organizationList } from '../../../../../mocks/vcd-organization/vcd-organization.mock'; + organizationList, + datacentreList, +} from '@ovh-ux/manager-module-vcd-api'; +import { assertTextVisibility } from '@ovh-ux/manager-core-test-utils'; +import { labels, renderTest } from '../../../../test-utils'; const orderCTA = labels.datacentresCompute.managed_vcd_vdc_compute_order_cta; const orderTitle = orderCTA; @@ -18,11 +17,11 @@ describe('Datacentre Compute Order Page', () => { initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/compute`, }); - await checkTextVisibility(orderCTA); + await assertTextVisibility(orderCTA); const orderButton = screen.getByText(orderCTA); await waitFor(() => userEvent.click(orderButton)); - await checkTextVisibility(orderTitle); + await assertTextVisibility(orderTitle); }); it('display an error if orderableResource service is KO', async () => { @@ -30,7 +29,7 @@ describe('Datacentre Compute Order Page', () => { initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/compute/order`, isOrderableResourceKO: true, }); - await checkTextVisibility(orderError); + await assertTextVisibility(orderError); }); it('display an error if there is no orderableResource', async () => { @@ -38,7 +37,7 @@ describe('Datacentre Compute Order Page', () => { initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/compute/order`, nbOrderableResource: 0, }); - await checkTextVisibility(orderError); + await assertTextVisibility(orderError); }); it('display an error if catalog service is KO', async () => { @@ -46,7 +45,7 @@ describe('Datacentre Compute Order Page', () => { initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/compute/order`, isCatalogKO: true, }); - await checkTextVisibility(orderError); + await assertTextVisibility(orderError); }); it('display an error if there is no catalog products', async () => { @@ -54,6 +53,6 @@ describe('Datacentre Compute Order Page', () => { initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/compute/order`, nbCatalogProduct: 0, }); - await checkTextVisibility(orderError); + await assertTextVisibility(orderError); }); }); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute-order/DatacentreComputeOrder.constants.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute-order/datacentreComputeOrder.constants.ts similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute-order/DatacentreComputeOrder.constants.ts rename to packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute-order/datacentreComputeOrder.constants.ts diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute/DatacentreCompute.constants.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute/DatacentreCompute.constants.ts deleted file mode 100644 index 0b3bd61e466e..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute/DatacentreCompute.constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const VHOSTS_TITLE = 'Virtual Hosts'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute/DatacentreCompute.page.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute/DatacentreCompute.page.tsx index 83e34db61f45..7ea5d6602238 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute/DatacentreCompute.page.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute/DatacentreCompute.page.tsx @@ -5,25 +5,28 @@ import { DataGridTextCell } from '@ovh-ux/manager-react-components'; import { OsdsButton } from '@ovhcloud/ods-components/react'; import { ODS_BUTTON_SIZE, ODS_BUTTON_VARIANT } from '@ovhcloud/ods-components'; import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; -import { VHOSTS_TITLE } from './DatacentreCompute.constants'; +import { + getVcdDatacentreComputeRoute, + getVdcComputeQueryKey, + VCDCompute, +} from '@ovh-ux/manager-module-vcd-api'; import DatagridContainer from '@/components/datagrid/container/DatagridContainer.component'; -import IVcdCompute from '@/types/vcd-compute.interface'; -import { getVcdDatacentreComputeRoute } from '@/data/api/hpc-vmware-managed-vcd-datacentre'; import { subRoutes, urls } from '@/routes/routes.constant'; -import { getVdcComputeQueryKey } from '@/utils/queryKeys'; +import { VHOST_LABEL, VHOSTS_LABEL } from './datacentreCompute.constants'; +import { ID_LABEL } from '../../dashboard.constants'; -const DatagridIdCell = (vcdCompute: IVcdCompute) => ( +const DatagridIdCell = (vcdCompute: VCDCompute) => ( {vcdCompute?.id} ); -const DatagridVHostProfilCell = (vcdCompute: IVcdCompute) => ( +const DatagridVHostProfilCell = (vcdCompute: VCDCompute) => ( {vcdCompute?.currentState?.profile} ); -const DatagridCpuCountCell = (vcdCompute: IVcdCompute) => ( +const DatagridCpuCountCell = (vcdCompute: VCDCompute) => ( {vcdCompute.currentState?.vCPUCount} ); -const DatagridBillingCell = (vcdCompute: IVcdCompute) => { - const { t } = useTranslation('hpc-vmware-managed-vcd/datacentres/compute'); +const DatagridBillingCell = (vcdCompute: VCDCompute) => { + const { t } = useTranslation('datacentres/compute'); return ( {t( @@ -33,8 +36,8 @@ const DatagridBillingCell = (vcdCompute: IVcdCompute) => { ); }; -const DatagridRamCountCell = (vcdCompute: IVcdCompute) => { - const { t } = useTranslation('hpc-vmware-managed-vcd/datacentres'); +const DatagridRamCountCell = (vcdCompute: VCDCompute) => { + const { t } = useTranslation('datacentres'); return ( @@ -47,21 +50,21 @@ const DatagridRamCountCell = (vcdCompute: IVcdCompute) => { export default function ComputeListingPage() { const { id, vdcId } = useParams(); - const { t } = useTranslation('hpc-vmware-managed-vcd/datacentres/compute'); - const { t: tVdc } = useTranslation('hpc-vmware-managed-vcd/datacentres'); + const { t } = useTranslation('datacentres/compute'); + const { t: tVdc } = useTranslation('datacentres'); const navigate = useNavigate(); const columns = [ { id: 'id', cell: DatagridIdCell, - label: t('managed_vcd_vdc_compute_id'), + label: ID_LABEL, isSortable: false, }, { id: 'vHostProfile', cell: DatagridVHostProfilCell, - label: t('managed_vcd_vdc_compute_vhost_profile'), + label: VHOST_LABEL, isSortable: false, }, { @@ -86,7 +89,7 @@ export default function ComputeListingPage() { return ( { it('access and display compute listing page', async () => { @@ -18,13 +20,13 @@ describe('Datacentre Compute Listing Page', () => { }); // access compute tab - await checkTextVisibility(COMPUTE_TITLE); - const tab = screen.getByText(COMPUTE_TITLE); + await assertTextVisibility(COMPUTE_LABEL); + const tab = screen.getByText(COMPUTE_LABEL); await waitFor(() => userEvent.click(tab)); // check page title & CTA - await checkTextVisibility(VHOSTS_TITLE); - await checkTextVisibility( + await assertTextVisibility(VHOSTS_LABEL); + await assertTextVisibility( labels.datacentresCompute.managed_vcd_vdc_compute_order_cta, ); }); @@ -35,6 +37,6 @@ describe('Datacentre Compute Listing Page', () => { isComputeKO: true, }); - await checkTextVisibility(DEFAULT_LISTING_ERROR); + await assertTextVisibility(DEFAULT_LISTING_ERROR); }); }); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute/datacentreCompute.constants.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute/datacentreCompute.constants.ts new file mode 100644 index 000000000000..f64db05d4f5e --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/compute/datacentreCompute.constants.ts @@ -0,0 +1,4 @@ +export const VHOST_LABEL = 'Virtual Host'; +export const VHOSTS_LABEL = 'Virtual Hosts'; +export const RAM_LABEL = 'RAM'; +export const CPU_SPEED_LABEL = 'CPU (GHz)'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/datacentreDashboard.constants.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/datacentreDashboard.constants.ts new file mode 100644 index 000000000000..4cfb0de17ed2 --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/datacentreDashboard.constants.ts @@ -0,0 +1,2 @@ +export const COMPUTE_LABEL = 'Compute'; +export const STORAGE_LABEL = 'Storage'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.page.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.page.tsx index 2d7e32259e5b..925a0a937bf1 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.page.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.page.tsx @@ -1,10 +1,13 @@ import React from 'react'; import { Outlet, useParams } from 'react-router-dom'; +import { + useVcdDatacentre, + useVcdOrganization, +} from '@ovh-ux/manager-module-vcd-api'; import DatacentreGenerationInformationTile from '@/components/tiles/datacentre-general-information-tile/DatacentreGeneralInformationTile.component'; -import useManagedVcdOrganization from '@/data/hooks/useManagedVcdOrganization'; -import { useManagedVcdDatacentre } from '@/data/hooks/useManagedVcdDatacentres'; import Loading from '@/components/loading/Loading.component'; import Errors from '@/components/error/Error.component'; +import DatacentreUsageTile from '@/components/tiles/datacentre-usage-tile/DatacentreUsageTile.component'; export default function DatacentresGeneralInformationPage() { const { id, vdcId } = useParams(); @@ -12,14 +15,14 @@ export default function DatacentresGeneralInformationPage() { data: vcdOrganization, isLoading: isLoadingVcd, error: vcdError, - } = useManagedVcdOrganization({ + } = useVcdOrganization({ id, }); const { data: vcdDatacentre, isLoading: isLoadingDatacentre, error: datacentreError, - } = useManagedVcdDatacentre(id, vdcId); + } = useVcdDatacentre(id, vdcId); if (vcdError || datacentreError) { return ; @@ -40,6 +43,7 @@ export default function DatacentresGeneralInformationPage() { vcdDatacentre={vcdDatacentre?.data} vcdOrganization={vcdOrganization?.data} /> +
diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.spec.tsx index 7147041d1471..9a1b7ffcdd02 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.spec.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.spec.tsx @@ -1,18 +1,20 @@ import userEvent from '@testing-library/user-event'; import { screen, waitFor } from '@testing-library/react'; import { - checkModalError, - checkModalVisibility, + organizationList, + datacentreList, +} from '@ovh-ux/manager-module-vcd-api'; +import { + assertModalVisibility, + assertModalText, + WAIT_FOR_DEFAULT_OPTIONS, +} from '@ovh-ux/manager-core-test-utils'; +import { labels, mockEditInputValue, renderTest, -} from '../../../../test-utils'; -import { organizationList } from '../../../../../mocks/vcd-organization/vcd-organization.mock'; -import { datacentreList } from '../../../../../mocks/vcd-organization/vcd-datacentre.mock'; -import { - DEFAULT_TIMEOUT, mockSubmitNewValue, -} from '../../../../test-utils/uiTestHelpers'; +} from '@/test-utils'; const submitButtonLabel = labels.dashboard.managed_vcd_dashboard_edit_modal_cta_edit; @@ -28,23 +30,20 @@ describe('Datacentre General Information Page', () => { expect( screen.getByText(labels.datacentres.managed_vcd_vdc_vcpu_count), ).toBeVisible(), - { timeout: DEFAULT_TIMEOUT }, + WAIT_FOR_DEFAULT_OPTIONS, ); let editButton; - await waitFor( - () => { - editButton = screen.getByTestId('editIcon'); - return expect(editButton).toBeEnabled(); - }, - { timeout: DEFAULT_TIMEOUT }, - ); + await waitFor(() => { + editButton = screen.getByTestId('editIcon'); + return expect(editButton).toBeEnabled(); + }, WAIT_FOR_DEFAULT_OPTIONS); await waitFor(() => userEvent.click(editButton)); - await checkModalVisibility({ container, isVisible: true }); + await assertModalVisibility({ container, isVisible: true }); await mockSubmitNewValue({ submitButtonLabel }); - await checkModalVisibility({ container, isVisible: false }); + await assertModalVisibility({ container, isVisible: false }); expect( screen.queryByText( @@ -61,13 +60,13 @@ describe('Datacentre General Information Page', () => { labels.dashboard .managed_vcd_dashboard_edit_description_modal_helper_error; - await checkModalVisibility({ container, isVisible: true }); + await assertModalVisibility({ container, isVisible: true }); await mockEditInputValue(''); - await checkModalError({ container, error: expectedError }); + await assertModalText({ container, text: expectedError }); await mockEditInputValue('a'.repeat(256)); - await checkModalError({ container, error: expectedError }); + await assertModalText({ container, text: expectedError }); }); it('display an error if update datacentre service is KO', async () => { @@ -76,11 +75,11 @@ describe('Datacentre General Information Page', () => { isDatacentreUpdateKo: true, }); - await checkModalVisibility({ container, isVisible: true }); + await assertModalVisibility({ container, isVisible: true }); await mockSubmitNewValue({ submitButtonLabel }); - await checkModalVisibility({ container, isVisible: true }); - await checkModalError({ container, error: 'Datacentre update error' }); + await assertModalVisibility({ container, isVisible: true }); + await assertModalText({ container, text: 'Datacentre update error' }); }); }); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/edit/EditVdcDescription.page.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/edit/EditVdcDescription.page.tsx index 7bc9b462e3a9..3800ffccd683 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/edit/EditVdcDescription.page.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/edit/EditVdcDescription.page.tsx @@ -1,10 +1,12 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { useNavigate, useParams } from 'react-router-dom'; -import { useManagedVcdDatacentre } from '@/data/hooks/useManagedVcdDatacentres'; -import { useUpdateVdcDetails } from '@/data/hooks/useUpdateVcdDatacentre'; +import { + useUpdateVdcDetails, + useVcdDatacentre, + VCDDatacentreTargetSpec, +} from '@ovh-ux/manager-module-vcd-api'; import { validateDescription } from '@/utils/formValidation'; -import { IVcdDatacentreState } from '@/types/vcd-datacenter.interface'; import { EditDetailModal } from '@/components/modal/EditDetailModal'; import { useMessageContext } from '@/context/Message.context'; import { subRoutes } from '@/routes/routes.constant'; @@ -15,7 +17,7 @@ export default function EditVdcDescription() { const closeModal = () => navigate('..'); const { addSuccess } = useMessageContext(); const { id, vdcId } = useParams(); - const { data: vcdDatacentre } = useManagedVcdDatacentre(id, vdcId); + const { data: vcdDatacentre } = useVcdDatacentre(id, vdcId); const { updateDetails, error, isError } = useUpdateVdcDetails({ id, vdcId, @@ -29,7 +31,8 @@ export default function EditVdcDescription() { }, }); - const currentVdcDetails: IVcdDatacentreState = vcdDatacentre.data.targetSpec; + const currentVdcDetails: VCDDatacentreTargetSpec = + vcdDatacentre.data.targetSpec; return ( [] = [ + const columns: DatagridColumn[] = [ { id: 'select', cell: StorageOrderSelectCell, diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage-order/DatacentreStorageOrder.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage-order/DatacentreStorageOrder.spec.tsx index 6ea8f0606eb5..d40f5775feed 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage-order/DatacentreStorageOrder.spec.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage-order/DatacentreStorageOrder.spec.tsx @@ -1,12 +1,11 @@ import { screen, waitFor } from '@testing-library/dom'; import userEvent from '@testing-library/user-event'; import { - checkTextVisibility, - labels, - renderTest, -} from '../../../../test-utils'; -import { datacentreList } from '../../../../../mocks/vcd-organization/vcd-datacentre.mock'; -import { organizationList } from '../../../../../mocks/vcd-organization/vcd-organization.mock'; + organizationList, + datacentreList, +} from '@ovh-ux/manager-module-vcd-api'; +import { assertTextVisibility } from '@ovh-ux/manager-core-test-utils'; +import { labels, renderTest } from '../../../../test-utils'; const orderCTA = labels.datacentresStorage.managed_vcd_vdc_storage_order_cta; const orderTitle = labels.datacentresOrder.managed_vcd_vdc_order_storage_title; @@ -18,11 +17,11 @@ describe('Datacentre Storage Order Page', () => { initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/storage`, }); - await checkTextVisibility(orderCTA); + await assertTextVisibility(orderCTA); const orderButton = screen.getByText(orderCTA); await waitFor(() => userEvent.click(orderButton)); - await checkTextVisibility(orderTitle); + await assertTextVisibility(orderTitle); }); it('display an error if orderableResource service is KO', async () => { @@ -30,7 +29,7 @@ describe('Datacentre Storage Order Page', () => { initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/storage/order`, isOrderableResourceKO: true, }); - await checkTextVisibility(orderError); + await assertTextVisibility(orderError); }); it('display an error if there is no orderableResource', async () => { @@ -38,7 +37,7 @@ describe('Datacentre Storage Order Page', () => { initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/storage/order`, nbOrderableResource: 0, }); - await checkTextVisibility(orderError); + await assertTextVisibility(orderError); }); it('display an error if catalog service is KO', async () => { @@ -46,7 +45,7 @@ describe('Datacentre Storage Order Page', () => { initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/storage/order`, isCatalogKO: true, }); - await checkTextVisibility(orderError); + await assertTextVisibility(orderError); }); it('display an error if there is no catalog products', async () => { @@ -54,6 +53,6 @@ describe('Datacentre Storage Order Page', () => { initialRoute: `/${organizationList[0].id}/datacentres/${datacentreList[0].id}/storage/order`, nbCatalogProduct: 0, }); - await checkTextVisibility(orderError); + await assertTextVisibility(orderError); }); }); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage-order/DatacentreStorageOrder.constants.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage-order/datacentreStorageOrder.constants.ts similarity index 100% rename from packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage-order/DatacentreStorageOrder.constants.ts rename to packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage-order/datacentreStorageOrder.constants.ts diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage/DatacentreStorage.page.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage/DatacentreStorage.page.tsx index 98ebbbfebe12..8300bcc8aff7 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage/DatacentreStorage.page.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/storage/DatacentreStorage.page.tsx @@ -5,30 +5,33 @@ import { useTranslation } from 'react-i18next'; import { OsdsButton } from '@ovhcloud/ods-components/react'; import { ODS_BUTTON_SIZE, ODS_BUTTON_VARIANT } from '@ovhcloud/ods-components'; import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; -import IVcdStorage from '@/types/vcd-storage.interface'; +import { + getVcdDatacentreStorageRoute, + getVdcStorageQueryKey, + VCDStorage, +} from '@ovh-ux/manager-module-vcd-api'; import DatagridContainer from '@/components/datagrid/container/DatagridContainer.component'; -import { STORAGE_TITLE } from '../DatacentreDashboard.constant'; -import { getVcdDatacentreStorageRoute } from '@/data/api/hpc-vmware-managed-vcd-datacentre'; +import { STORAGE_LABEL } from '../datacentreDashboard.constants'; import { subRoutes, urls } from '@/routes/routes.constant'; -import { getVdcStorageQueryKey } from '@/utils/queryKeys'; import { capitalize } from '@/utils/capitalize'; +import { ID_LABEL } from '../../dashboard.constants'; -const DatagridIdCell = (vcdStorage: IVcdStorage) => ( +const DatagridIdCell = (vcdStorage: VCDStorage) => ( {vcdStorage?.id} ); -const DatagridNameCell = (vcdStorage: IVcdStorage) => ( +const DatagridNameCell = (vcdStorage: VCDStorage) => ( {vcdStorage?.currentState?.name} ); -const DatagridProfileCell = (vcdStorage: IVcdStorage) => ( +const DatagridProfileCell = (vcdStorage: VCDStorage) => ( {vcdStorage?.currentState?.profile} ); -const DatagridTypeCell = (vcdStorage: IVcdStorage) => ( +const DatagridTypeCell = (vcdStorage: VCDStorage) => ( {capitalize(vcdStorage?.currentState?.type)} ); -const DatagridCapacityCell = (vcdStorage: IVcdStorage) => { - const { t } = useTranslation('hpc-vmware-managed-vcd/datacentres'); +const DatagridCapacityCell = (vcdStorage: VCDStorage) => { + const { t } = useTranslation('datacentres'); return ( {t('managed_vcd_vdc_quota_value', { @@ -37,8 +40,8 @@ const DatagridCapacityCell = (vcdStorage: IVcdStorage) => { ); }; -const DatagridBillingCell = (vcdStorage: IVcdStorage) => { - const { t } = useTranslation('hpc-vmware-managed-vcd/datacentres/compute'); +const DatagridBillingCell = (vcdStorage: VCDStorage) => { + const { t } = useTranslation('datacentres/compute'); return ( {t( @@ -50,18 +53,15 @@ const DatagridBillingCell = (vcdStorage: IVcdStorage) => { export default function StorageListingPage() { const { id, vdcId } = useParams(); - const { t } = useTranslation('hpc-vmware-managed-vcd/datacentres/storage'); - const { t: tVdc } = useTranslation('hpc-vmware-managed-vcd/datacentres'); - const { t: tCompute } = useTranslation( - 'hpc-vmware-managed-vcd/datacentres/compute', - ); + const { t } = useTranslation('datacentres/storage'); + const { t: tCompute } = useTranslation('datacentres/compute'); const navigate = useNavigate(); const columns = [ { id: 'id', cell: DatagridIdCell, - label: tVdc('managed_vcd_vdc_id'), + label: ID_LABEL, isSortable: false, }, { @@ -98,7 +98,7 @@ export default function StorageListingPage() { return ( { it('access and display storage listing page', async () => { @@ -17,13 +19,13 @@ describe('Datacentre Storage Listing Page', () => { }); // access storage tab - await checkTextVisibility(STORAGE_TITLE); - const tab = screen.getByText(STORAGE_TITLE); + await assertTextVisibility(STORAGE_LABEL); + const tab = screen.getByText(STORAGE_LABEL); await waitFor(() => userEvent.click(tab)); // check page title & CTA - await checkTextVisibility(STORAGE_TITLE); - await checkTextVisibility( + await assertTextVisibility(STORAGE_LABEL); + await assertTextVisibility( labels.datacentresStorage.managed_vcd_vdc_storage_order_cta, ); }); @@ -34,6 +36,6 @@ describe('Datacentre Storage Listing Page', () => { isStorageKO: true, }); - await checkTextVisibility(DEFAULT_LISTING_ERROR); + await assertTextVisibility(DEFAULT_LISTING_ERROR); }); }); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/OrganizationDashboard.constants.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/OrganizationDashboard.constants.ts deleted file mode 100644 index c6d4b02d83a3..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/OrganizationDashboard.constants.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const DATA_PROTECTION_BACKUP_TITLE = 'Managed Backup'; -export const DATA_PROTECTION_RECOVERY_TITLE = - 'Managed Disaster Recovery Services'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/OrganizationDashboard.page.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/OrganizationDashboard.page.tsx index f0cafe3cb654..735b1c2bc94e 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/OrganizationDashboard.page.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/OrganizationDashboard.page.tsx @@ -1,16 +1,15 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { useNavigate, useParams, useResolvedPath } from 'react-router-dom'; - +import { useVcdOrganization } from '@ovh-ux/manager-module-vcd-api'; import VcdDashboardLayout from '@/components/dashboard/layout/VcdDashboardLayout.component'; -import useManagedVcdOrganization from '@/data/hooks/useManagedVcdOrganization'; import { BreadcrumbItem } from '@/hooks/breadcrumb/useBreadcrumb'; import { urls } from '@/routes/routes.constant'; export default function DashboardPage() { const { id } = useParams(); const { t } = useTranslation('dashboard'); - const { data: vcdOrganisation } = useManagedVcdOrganization({ id }); + const { data: vcdOrganisation } = useVcdOrganization({ id }); const navigate = useNavigate(); const tabsList = [ diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/OrganizationDashboard.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/OrganizationDashboard.spec.tsx index 1b8937e08a26..5d25a2247ed2 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/OrganizationDashboard.spec.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/OrganizationDashboard.spec.tsx @@ -1,7 +1,8 @@ import userEvents from '@testing-library/user-event'; import { screen, waitFor } from '@testing-library/react'; +import { organizationList } from '@ovh-ux/manager-module-vcd-api'; +import { assertTextVisibility } from '@ovh-ux/manager-core-test-utils'; import { renderTest, labels } from '../../../test-utils'; -import { organizationList } from '../../../../mocks/vcd-organization/vcd-organization.mock'; describe('Organization Dashboard Page', () => { it('display the dashboard page', async () => { @@ -9,19 +10,11 @@ describe('Organization Dashboard Page', () => { const link = screen.getByText(organizationList[0].currentState.fullName); await waitFor(() => userEvents.click(link)); - await waitFor( - () => - expect( - screen.getByText( - labels.dashboard.managed_vcd_dashboard_data_protection, - ), - ).toBeVisible(), - { timeout: 30000 }, + await assertTextVisibility( + labels.dashboard.managed_vcd_dashboard_data_protection, ); - expect( - screen.getByText(organizationList[0].currentState.description), - ).toBeVisible(); + await assertTextVisibility(organizationList[0].currentState.description); }); it('display an error', async () => { @@ -29,9 +22,7 @@ describe('Organization Dashboard Page', () => { initialRoute: `/${organizationList[0].id}`, isOrganizationKo: true, }); - await waitFor( - () => expect(screen.getByText('Organization error')).toBeVisible(), - { timeout: 30000 }, - ); + + await assertTextVisibility('Organization error'); }); }); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/OrganizationGeneralInformation.page.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/OrganizationGeneralInformation.page.tsx index 2ba67681d930..cd974cf6439b 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/OrganizationGeneralInformation.page.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/OrganizationGeneralInformation.page.tsx @@ -1,8 +1,8 @@ import React from 'react'; import { Outlet, useParams } from 'react-router-dom'; +import { useVcdOrganization } from '@ovh-ux/manager-module-vcd-api'; import Errors from '@/components/error/Error.component'; import Loading from '@/components/loading/Loading.component'; -import useManagedVcdOrganization from '@/data/hooks/useManagedVcdOrganization'; import OrganizationGenerationInformationTile from '@/components/tiles/organization-general-information-tile/OrganizationGeneralInformationTile.component'; import OrganizationOptionsTile from '@/components/tiles/organization-options-tile/OrganizationOptionsTile.component'; import OrganizationDataProtectionTile from '@/components/tiles/organization-data-tile/OrganizationDataProtectionTile.component'; @@ -16,9 +16,8 @@ export default function GeneralInformation() { isRefetchError, error, isLoading, - } = useManagedVcdOrganization({ + } = useVcdOrganization({ id, - refetchOnWindowFocus: true, refetchInterval: 60 * 1000, }); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/OrganizationGeneralInformation.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/OrganizationGeneralInformation.spec.tsx index c5314a0d14e8..f7d3b8425a1b 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/OrganizationGeneralInformation.spec.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/OrganizationGeneralInformation.spec.tsx @@ -1,15 +1,14 @@ import userEvents from '@testing-library/user-event'; import { screen, waitFor } from '@testing-library/react'; +import { organizationList } from '@ovh-ux/manager-module-vcd-api'; import { - renderTest, - labels, - checkModalVisibility, - mockSubmitNewValue, - checkModalError, - DEFAULT_TIMEOUT, - checkTextVisibility, -} from '../../../../test-utils'; -import { organizationList } from '../../../../../mocks/vcd-organization/vcd-organization.mock'; + getButtonByLabel, + assertModalVisibility, + assertModalText, + WAIT_FOR_DEFAULT_OPTIONS, + assertTextVisibility, +} from '@ovh-ux/manager-core-test-utils'; +import { renderTest, labels, mockSubmitNewValue } from '../../../../test-utils'; const submitButtonLabel = labels.dashboard.managed_vcd_dashboard_edit_modal_cta_edit; @@ -20,26 +19,23 @@ describe('Organization General Information Page', () => { initialRoute: `/${organizationList[1].id}`, }); - await checkTextVisibility( + await assertTextVisibility( labels.dashboard.managed_vcd_dashboard_data_protection, ); let editButton; - await waitFor( - () => { - editButton = screen.getAllByTestId('editIcon').at(0); - return expect(editButton).toBeEnabled(); - }, - { timeout: DEFAULT_TIMEOUT }, - ); + await waitFor(() => { + editButton = screen.getAllByTestId('editIcon').at(0); + return expect(editButton).toBeEnabled(); + }, WAIT_FOR_DEFAULT_OPTIONS); await waitFor(() => userEvents.click(editButton)); - await checkModalVisibility({ container, isVisible: true }); + await assertModalVisibility({ container, isVisible: true }); await mockSubmitNewValue({ submitButtonLabel }); - await checkModalVisibility({ container, isVisible: false }); - await checkTextVisibility( + await assertModalVisibility({ container, isVisible: false }); + await assertTextVisibility( labels.dashboard.managed_vcd_dashboard_edit_name_modal_success, ); }); @@ -50,12 +46,12 @@ describe('Organization General Information Page', () => { isOrganizationUpdateKo: true, }); - await checkModalVisibility({ container, isVisible: true }); + await assertModalVisibility({ container, isVisible: true }); await mockSubmitNewValue({ submitButtonLabel }); - await checkModalVisibility({ container, isVisible: true }); - await checkModalError({ container, error: 'Organization update error' }); + await assertModalVisibility({ container, isVisible: true }); + await assertModalText({ container, text: 'Organization update error' }); }); it('modify the description of the organization', async () => { @@ -63,26 +59,23 @@ describe('Organization General Information Page', () => { initialRoute: `/${organizationList[1].id}`, }); - await checkTextVisibility( + await assertTextVisibility( labels.dashboard.managed_vcd_dashboard_data_protection, ); let editButton; - await waitFor( - () => { - editButton = screen.getAllByTestId('editIcon').at(1); - return expect(editButton).toBeEnabled(); - }, - { timeout: DEFAULT_TIMEOUT }, - ); + await waitFor(() => { + editButton = screen.getAllByTestId('editIcon').at(1); + return expect(editButton).toBeEnabled(); + }, WAIT_FOR_DEFAULT_OPTIONS); await waitFor(() => userEvents.click(editButton)); - await checkModalVisibility({ container, isVisible: true }); + await assertModalVisibility({ container, isVisible: true }); await mockSubmitNewValue({ submitButtonLabel }); - await checkModalVisibility({ container, isVisible: false }); - await checkTextVisibility( + await assertModalVisibility({ container, isVisible: false }); + await assertTextVisibility( labels.dashboard.managed_vcd_dashboard_edit_description_modal_success, ); }); @@ -93,11 +86,61 @@ describe('Organization General Information Page', () => { isOrganizationUpdateKo: true, }); - await checkModalVisibility({ container, isVisible: true }); + await assertModalVisibility({ container, isVisible: true }); await mockSubmitNewValue({ submitButtonLabel }); - await checkModalVisibility({ container, isVisible: true }); - await checkModalError({ container, error: 'Organization update error' }); + await assertModalVisibility({ container, isVisible: true }); + await assertModalText({ container, text: 'Organization update error' }); + }); + + it('resets the password of the organization', async () => { + const { container } = await renderTest({ + initialRoute: `/${organizationList[1].id}`, + }); + + await assertTextVisibility( + labels.dashboard.managed_vcd_dashboard_password_renew, + ); + + const resetPasswordLink = await getButtonByLabel({ + container, + label: labels.dashboard.managed_vcd_dashboard_password_renew, + isLink: true, + }); + await waitFor(() => userEvents.click(resetPasswordLink)); + + await assertModalVisibility({ container, isVisible: true }); + + const validateButton = await getButtonByLabel({ + container, + label: labels.dashboard.managed_vcd_dashboard_edit_modal_cta_validate, + }); + await waitFor(() => userEvents.click(validateButton)); + + await assertModalVisibility({ container, isVisible: false }); + await assertTextVisibility( + labels.dashboard.managed_vcd_dashboard_password_renew_success, + ); + }); + + it('trying to reset password displays an error if reset password service is KO', async () => { + const { container } = await renderTest({ + initialRoute: `/${organizationList[0].id}/reset-password`, + isOrganizationResetPasswordKo: true, + }); + + await assertModalVisibility({ container, isVisible: true }); + + const validateButton = await getButtonByLabel({ + container, + label: labels.dashboard.managed_vcd_dashboard_edit_modal_cta_validate, + }); + await waitFor(() => userEvents.click(validateButton)); + + await assertModalVisibility({ container, isVisible: false }); + await assertTextVisibility( + labels.dashboard.managed_vcd_dashboard_password_renew_error, + ); }); }); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/edit/EditPassword.page.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/edit/EditPassword.page.tsx index 5426f12aa3b4..72b314303a72 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/edit/EditPassword.page.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/edit/EditPassword.page.tsx @@ -5,7 +5,7 @@ import { OsdsModal, OsdsButton } from '@ovhcloud/ods-components/react'; import { Description } from '@ovh-ux/manager-react-components'; import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; import { ODS_BUTTON_VARIANT } from '@ovhcloud/ods-components'; -import { useResetPassword } from '@/data/hooks/useResetPassword'; +import { useResetVcdPassword } from '@ovh-ux/manager-module-vcd-api'; import { useMessageContext } from '@/context/Message.context'; import { subRoutes } from '@/routes/routes.constant'; @@ -15,7 +15,7 @@ export default function EditPassword() { const closeModal = () => navigate('..'); const { id } = useParams(); const { addSuccess, addError } = useMessageContext(); - const { mutate: resetPassword } = useResetPassword( + const { mutate: resetPassword } = useResetVcdPassword( { id }, { onSettled: () => closeModal(), diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/organizationDashboard.constants.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/organizationDashboard.constants.ts new file mode 100644 index 000000000000..23beaa55a20e --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/organizationDashboard.constants.ts @@ -0,0 +1,4 @@ +export const MANAGED_VCD_LABEL = 'Managed VCD'; +export const DATA_PROTECTION_BACKUP_LABEL = 'Managed Backup'; +export const DATA_PROTECTION_RECOVERY_LABEL = + 'Managed Disaster Recovery Services'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/datacentres/datacentres.page.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/datacentres/Datacentres.page.tsx similarity index 74% rename from packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/datacentres/datacentres.page.tsx rename to packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/datacentres/Datacentres.page.tsx index fe2f8bb62a9d..36f92398ffea 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/datacentres/datacentres.page.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/datacentres/Datacentres.page.tsx @@ -2,17 +2,20 @@ import { DataGridTextCell, Links } from '@ovh-ux/manager-react-components'; import React from 'react'; import { useTranslation } from 'react-i18next'; import { useNavigate, useParams } from 'react-router-dom'; +import { + getVcdDatacentreListQueryKey, + getVcdDatacentresRoute, + VCDDatacentre, +} from '@ovh-ux/manager-module-vcd-api'; import DatagridContainer, { TDatagridContainerProps, } from '@/components/datagrid/container/DatagridContainer.component'; import { subRoutes, urls } from '@/routes/routes.constant'; -import IVcdDatacentre from '@/types/vcd-datacenter.interface'; -import { getVcdDatacentresRoute } from '@/data/api/hpc-vmware-managed-vcd-datacentre'; -import { getVcdDatacentresQueryKey } from '@/utils/queryKeys'; import { capitalize } from '@/utils/capitalize'; +import { ID_LABEL } from '@/pages/dashboard/dashboard.constants'; /* ========= datagrid cells ========= */ -const DatagridIdCell = (vcdDatacentre: IVcdDatacentre) => { +const DatagridIdCell = (vcdDatacentre: VCDDatacentre) => { const navigate = useNavigate(); const { id } = useParams(); @@ -32,16 +35,16 @@ const DatagridIdCell = (vcdDatacentre: IVcdDatacentre) => { ); }; -const DatagridDescriptionCell = (vcdDatacentre: IVcdDatacentre) => ( +const DatagridDescriptionCell = (vcdDatacentre: VCDDatacentre) => ( {vcdDatacentre.currentState?.description} ); -const DatagridCpuCountCell = (vcdDatacentre: IVcdDatacentre) => ( +const DatagridCpuCountCell = (vcdDatacentre: VCDDatacentre) => ( {vcdDatacentre.currentState?.vCPUCount} ); -const DatagridCpuSpeedCell = (vcdDatacentre: IVcdDatacentre) => { - const { t } = useTranslation('hpc-vmware-managed-vcd/datacentres'); +const DatagridCpuSpeedCell = (vcdDatacentre: VCDDatacentre) => { + const { t } = useTranslation('datacentres'); return ( @@ -52,8 +55,8 @@ const DatagridCpuSpeedCell = (vcdDatacentre: IVcdDatacentre) => { ); }; -const DatagridRamCountCell = (vcdDatacentre: IVcdDatacentre) => { - const { t } = useTranslation('hpc-vmware-managed-vcd/datacentres'); +const DatagridRamCountCell = (vcdDatacentre: VCDDatacentre) => { + const { t } = useTranslation('datacentres'); return ( @@ -64,7 +67,7 @@ const DatagridRamCountCell = (vcdDatacentre: IVcdDatacentre) => { ); }; -const DatagridCommercialRange = (vcdDatacentre: IVcdDatacentre) => ( +const DatagridCommercialRange = (vcdDatacentre: VCDDatacentre) => ( {capitalize(vcdDatacentre.currentState?.commercialRange)} @@ -73,14 +76,14 @@ const DatagridCommercialRange = (vcdDatacentre: IVcdDatacentre) => ( /* ======= listing page ======== */ export default function DatacentresListing() { const { t } = useTranslation('listing'); - const { t: tVdc } = useTranslation('hpc-vmware-managed-vcd/datacentres'); + const { t: tVdc } = useTranslation('datacentres'); const { id } = useParams(); const columns = [ { id: 'id', cell: DatagridIdCell, - label: t('managed_vcd_listing_id'), + label: ID_LABEL, }, { id: 'description', @@ -111,7 +114,7 @@ export default function DatacentresListing() { const datagridProps: TDatagridContainerProps = { title: tVdc('managed_vcd_vdc_title'), - queryKey: getVcdDatacentresQueryKey(id), + queryKey: getVcdDatacentreListQueryKey(id), isEmbedded: true, route: { api: getVcdDatacentresRoute(id), diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/datacentres/Datacentres.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/datacentres/Datacentres.spec.tsx new file mode 100644 index 000000000000..ce844743decb --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/datacentres/Datacentres.spec.tsx @@ -0,0 +1,27 @@ +import { + organizationList, + datacentreList, +} from '@ovh-ux/manager-module-vcd-api'; +import { assertTextVisibility } from '@ovh-ux/manager-core-test-utils'; +import { DEFAULT_LISTING_ERROR, labels, renderTest } from '../../../test-utils'; + +describe('Datacentres Listing Page', () => { + it('displays the virtual datacentres listing page', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres`, + }); + + await assertTextVisibility(labels.datacentres.managed_vcd_vdc_title); + + await assertTextVisibility(datacentreList[0].currentState.name); + }); + + it('display an error', async () => { + await renderTest({ + initialRoute: `/${organizationList[0].id}/datacentres`, + isDatacentresKo: true, + }); + + await assertTextVisibility(DEFAULT_LISTING_ERROR); + }); +}); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/datacentres/datacentres.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/datacentres/datacentres.spec.tsx deleted file mode 100644 index a18fcf9ee0ff..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/datacentres/datacentres.spec.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { screen, waitFor } from '@testing-library/react'; -import { - checkTextVisibility, - DEFAULT_LISTING_ERROR, - labels, - renderTest, -} from '../../../test-utils'; -import { datacentreList } from '../../../../mocks/vcd-organization/vcd-datacentre.mock'; -import { organizationList } from '../../../../mocks/vcd-organization/vcd-organization.mock'; - -describe('Datacentres Listing Page', () => { - it('displays the virtual datacentres listing page', async () => { - await renderTest({ - initialRoute: `/${organizationList[0].id}/datacentres`, - }); - - await waitFor( - () => - expect( - screen.getByText(labels.datacentres.managed_vcd_vdc_title), - ).toBeVisible(), - { timeout: 30_000 }, - ); - - await waitFor(() => - expect( - screen.getByText(datacentreList[0].currentState.name), - ).toBeVisible(), - ); - }); - - it('display an error', async () => { - await renderTest({ - initialRoute: `/${organizationList[0].id}/datacentres`, - isDatacentresKo: true, - }); - - await checkTextVisibility(DEFAULT_LISTING_ERROR); - }); -}); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/organizations/Organizations.page.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/organizations/Organizations.page.tsx index 3c120385cd19..f12605def27c 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/organizations/Organizations.page.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/listing/organizations/Organizations.page.tsx @@ -9,15 +9,17 @@ import { Region, } from '@ovh-ux/manager-react-components'; import { OdsHTMLAnchorElementTarget } from '@ovhcloud/ods-common-core'; - +import { + vcdOrganizationListQueryKey, + VCD_ORGANIZATION_ROUTE, + VCDOrganization, +} from '@ovh-ux/manager-module-vcd-api'; import DatagridContainer from '@/components/datagrid/container/DatagridContainer.component'; import { urls } from '@/routes/routes.constant'; -import IVcdOrganization from '@/types/vcd-organization.interface'; -import { VCD_ORGANIZATION_ROUTE } from '@/data/api/hpc-vmware-managed-vcd.constants'; -import { getVcdOrganizationsQueryKey } from '@/utils/queryKeys'; +import { MANAGED_VCD_LABEL } from '@/pages/dashboard/organization/organizationDashboard.constants'; /* ========= datagrid cells ========== */ -const DatagridIdCell = (vdcOrg: IVcdOrganization) => { +const DatagridIdCell = (vdcOrg: VCDOrganization) => { const navigate = useNavigate(); return ( @@ -29,23 +31,23 @@ const DatagridIdCell = (vdcOrg: IVcdOrganization) => { ); }; -const DatagridLocationCell = (vdcOrg: IVcdOrganization) => ( +const DatagridLocationCell = (vdcOrg: VCDOrganization) => ( ); -const DatagridRegionCell = (vdcOrg: IVcdOrganization) => ( +const DatagridRegionCell = (vdcOrg: VCDOrganization) => ( {vdcOrg.currentState?.region?.toLowerCase()} ); -const DatagridDescriptionCell = (vdcOrg: IVcdOrganization) => ( +const DatagridDescriptionCell = (vdcOrg: VCDOrganization) => ( {vdcOrg.currentState?.description} ); -const DatagridWebInterfaceCell = (vdcOrg: IVcdOrganization) => ( +const DatagridWebInterfaceCell = (vdcOrg: VCDOrganization) => ( { it('display the listing page if there is at least one organization', async () => { await renderTest({ nbOrganization: 1 }); - await waitFor(() => - expect( - screen.getByText(labels.listing.managed_vcd_listing_description), - ).toBeVisible(), - ); + await assertTextVisibility(labels.listing.managed_vcd_listing_description); - await waitFor(() => - expect( - screen.getByText(organizationList[0].currentState.fullName), - ).toBeVisible(), - ); + await assertTextVisibility(organizationList[0].currentState.fullName); }); }); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/onboarding/Onboarding.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/onboarding/Onboarding.spec.tsx index 74612cb296ea..55de4c811a27 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/onboarding/Onboarding.spec.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/onboarding/Onboarding.spec.tsx @@ -1,15 +1,11 @@ -import { screen, waitFor } from '@testing-library/react'; +import { assertTextVisibility } from '@ovh-ux/manager-core-test-utils'; import { renderTest, labels } from '../../test-utils'; describe('Onboarding Page', () => { it('display the onboarding page if there is no VCD Organization', async () => { await renderTest({ nbOrganization: 0 }); - await waitFor(() => - expect( - screen.getByText( - labels.onboarding.managed_vcd_onboarding_description_part1, - ), - ).toBeVisible(), + await assertTextVisibility( + labels.onboarding.managed_vcd_onboarding_description_part1, ); }); }); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/routes/routes.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/routes/routes.tsx index 6513397f02e7..d396d231eb92 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/routes/routes.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/routes/routes.tsx @@ -85,13 +85,28 @@ export const Routes: any = [ }, }, }, + { + id: 'reset-password', + path: urls.resetPassword, + ...lazyRouteConfig(() => + import( + '@/pages/dashboard/organization/general-information/edit/EditPassword.page' + ), + ), + handle: { + tracking: { + pageName: 'reset-password', + pageType: PageType.popup, + }, + }, + }, ], }, { id: 'datacentres', path: urls.datacentres, ...lazyRouteConfig(() => - import('@/pages/listing/datacentres/datacentres.page'), + import('@/pages/listing/datacentres/Datacentres.page'), ), handle: { tracking: { diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/index.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/index.ts index 27f202fe11ad..a0cde9effbd7 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/index.ts +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/index.ts @@ -1,12 +1,3 @@ export { renderTest } from './render-test'; export { labels } from './test-i18n'; -export { - DEFAULT_TIMEOUT, - DEFAULT_LISTING_ERROR, - checkTextVisibility, - waitForEnabledElement, - mockEditInputValue, - mockSubmitNewValue, - checkModalVisibility, - checkModalError, -} from './uiTestHelpers'; +export * from './uiTestHelpers'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/render-test.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/render-test.tsx index 1c85cc7ac150..4f344b739497 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/render-test.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/render-test.tsx @@ -12,9 +12,7 @@ import { render, waitFor, screen } from '@testing-library/react'; import { getServicesMocks, GetServicesMocksParams, -} from '@ovh-ux/manager-react-components'; -import { toMswHandlers } from '../../../../../../playwright-helpers'; -import { getAuthenticationMocks } from '../../../../../../playwright-helpers/mocks/auth'; +} from '@ovh-ux/manager-module-common-api'; import { getVeeamBackupMocks, getOrganizationMocks, @@ -25,10 +23,16 @@ import { GetDatacentreOrderMocksParams, GetVeeamBackupMocksParams, getIamMocks, -} from '../../mocks'; -import { initTestI18n, labels } from './test-i18n'; +} from '@ovh-ux/manager-module-vcd-api'; +import { + initTestI18n, + getAuthenticationMocks, + toMswHandlers, +} from '@ovh-ux/manager-core-test-utils'; +import { translations } from './test-i18n'; import { TestApp } from './TestApp'; import { APP_NAME } from '@/tracking.constant'; +import { MANAGED_VCD_LABEL } from '@/pages/dashboard/organization/organizationDashboard.constants'; let context: ShellContextType; let i18nState: i18n; @@ -60,7 +64,7 @@ export const renderTest = async ({ } if (!i18nState) { - i18nState = await initTestI18n(); + i18nState = await initTestI18n(APP_NAME, translations); } const result = render( @@ -75,7 +79,7 @@ export const renderTest = async ({ await waitFor( () => expect( - screen.getAllByText(labels.listing.managed_vcd_listing_title, { + screen.getAllByText(MANAGED_VCD_LABEL, { exact: false, }).length, ).toBeGreaterThan(0), diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/test-i18n.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/test-i18n.ts index 634f1f513805..09f1dc857325 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/test-i18n.ts +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/test-i18n.ts @@ -1,13 +1,10 @@ -import i18next, { i18n } from 'i18next'; import listing from '../../public/translations/listing/Messages_fr_FR.json'; import dashboard from '../../public/translations/dashboard/Messages_fr_FR.json'; import onboarding from '../../public/translations/onboarding/Messages_fr_FR.json'; -import common from '../../public/translations/hpc-vmware-managed-vcd/Messages_fr_FR.json'; -import datacentres from '../../public/translations/hpc-vmware-managed-vcd/datacentres/Messages_fr_FR.json'; -import datacentresCompute from '../../public/translations/hpc-vmware-managed-vcd/datacentres/compute/Messages_fr_FR.json'; -import datacentresOrder from '../../public/translations/hpc-vmware-managed-vcd/datacentres/order/Messages_fr_FR.json'; -import datacentresStorage from '../../public/translations/hpc-vmware-managed-vcd/datacentres/storage/Messages_fr_FR.json'; -import { APP_NAME } from '../tracking.constant'; +import datacentres from '../../public/translations/datacentres/Messages_fr_FR.json'; +import datacentresCompute from '../../public/translations/datacentres/compute/Messages_fr_FR.json'; +import datacentresOrder from '../../public/translations/datacentres/order/Messages_fr_FR.json'; +import datacentresStorage from '../../public/translations/datacentres/storage/Messages_fr_FR.json'; const error = { manager_error_page_title: 'Oops …!', @@ -19,65 +16,18 @@ const error = { 'Une erreur est survenue lors du chargement de la page.', }; -export const defaultLocale = 'fr_FR'; -export const defaultAvailableLocales = [defaultLocale]; - -function addTranslations() { - i18next - .addResources(defaultLocale, APP_NAME, common) - .addResources(defaultLocale, 'listing', listing) - .addResources(defaultLocale, 'dashboard', dashboard) - .addResources(defaultLocale, 'onboarding', onboarding) - .addResources(defaultLocale, `${APP_NAME}/datacentres`, datacentres) - .addResources( - defaultLocale, - `${APP_NAME}/datacentres/compute`, - datacentresCompute, - ) - .addResources( - defaultLocale, - `${APP_NAME}/datacentres/order`, - datacentresOrder, - ) - .addResources( - defaultLocale, - `${APP_NAME}/datacentres/storage`, - datacentresStorage, - ) - .addResources(defaultLocale, 'error', error) - .use({ - type: 'postProcessor', - name: 'normalize', - process: (value: string) => - value ? value.replace(/&/g, '&') : value, - }); -} - -export const initTestI18n = () => - new Promise((resolve) => { - i18next.init({ - lng: defaultLocale, - defaultNS: APP_NAME, - ns: [], - supportedLngs: defaultAvailableLocales, - postProcess: 'normalize', - interpolation: { - escapeValue: false, - }, - }); - - if (i18next.isInitialized) { - addTranslations(); - } else { - i18next.on('initialized', () => { - addTranslations(); - resolve(i18next); - }); - } - }); +export const translations = { + listing, + dashboard, + onboarding, + datacentres, + 'datacentres/compute': datacentresCompute, + 'datacentres/order': datacentresOrder, + 'datacentres/storage': datacentresStorage, + error, +}; export const labels = { - common, onboarding, dashboard, listing, diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/uiTestHelpers.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/uiTestHelpers.ts index 72b8d1c0a686..84d5a05484da 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/uiTestHelpers.ts +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/test-utils/uiTestHelpers.ts @@ -1,43 +1,9 @@ -import '@testing-library/jest-dom'; import userEvent from '@testing-library/user-event'; -import { - screen, - act, - waitFor, - fireEvent, - within, -} from '@testing-library/react'; -import { expect } from 'vitest'; +import { screen, act, waitFor, fireEvent } from '@testing-library/react'; +import '@testing-library/jest-dom'; -export const DEFAULT_TIMEOUT = 30_000; export const DEFAULT_LISTING_ERROR = 'An error occured while fetching data'; -// General helpers -/** - * @description Standard check: wait and expect some text to be visible on the screen - * @param text expected to be visible - * @param timeout time to wait for (default to 30sec) - * @returns - */ -export const checkTextVisibility = ( - text: string, - timeout = DEFAULT_TIMEOUT, -): Promise => - waitFor(() => expect(screen.getByText(text)).toBeVisible(), { - timeout, - }); - -export const waitForEnabledElement = async ( - elementLabel: string, -): Promise => { - let button; - await waitFor(() => { - button = screen.getByText(elementLabel); - return expect(button).toBeEnabled(); - }); - return button; -}; - // Form helpers export const mockEditInputValue = async (value: string) => { const input = screen.getByLabelText('edit-input'); @@ -57,38 +23,3 @@ export const mockSubmitNewValue = async ({ const submitButton = screen.getByText(submitButtonLabel, { exact: true }); return waitFor(() => userEvent.click(submitButton)); }; - -// Modal helpers -export const checkModalVisibility = ({ - container, - isVisible, -}: { - container: HTMLElement; - isVisible: boolean; -}): Promise => - waitFor( - () => { - const modal = container.querySelector('osds-modal'); - return isVisible - ? expect(modal).toBeInTheDocument() - : expect(modal).not.toBeInTheDocument(); - }, - { timeout: DEFAULT_TIMEOUT }, - ); - -export const checkModalError = ({ - container, - error, -}: { - container: HTMLElement; - error: string; -}): Promise => - waitFor( - () => - expect( - within(container.querySelector('osds-modal')).getByText(error, { - exact: false, - }), - ).toBeVisible(), - { timeout: DEFAULT_TIMEOUT }, - ); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-compute.interface.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-compute.interface.ts deleted file mode 100644 index d2749a60418a..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-compute.interface.ts +++ /dev/null @@ -1,14 +0,0 @@ -export interface IVcdComputeState { - vCPUCount: number; - billingType: string; - memoryQuota: number; - name: string; - profile: string; -} - -export default interface IVcdCompute { - id: string; - resourceStatus: string; - currentState: IVcdComputeState; - currentTasks?: any[]; -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-datacenter.interface.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-datacenter.interface.ts deleted file mode 100644 index f08cd1fdc29c..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-datacenter.interface.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { IamObject } from '@ovh-ux/manager-react-components'; - -export interface IVcdDatacentreState { - vCPUSpeed: number; - description: string; -} - -export interface IVcdDatacentreCurrentState extends IVcdDatacentreState { - commercialRange: string; - ipQuota: number; - storageQuota: number; - vCPUCount: number; - region: string; - memoryQuota: number; - name: string; -} - -export default interface IVcdDatacentre { - id: string; - resourceStatus: string; - currentState: IVcdDatacentreCurrentState; - targetSpec: IVcdDatacentreState; - currentTasks?: any[]; - iam: IamObject; - updatedAt: string; -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-organization-backup.interface.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-organization-backup.interface.ts deleted file mode 100644 index 238b835a4a10..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-organization-backup.interface.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { IamObject } from '@ovh-ux/manager-react-components'; - -export enum BackupResourceStatus { - CREATING = 'CREATING', - DISABLED = 'DISABLED', - DISABLING = 'DISABLING', - READY = 'READY', - REMOVED = 'REMOVED', - UPDATING = 'UPDATING', -} - -interface IBackupOffer { - name: string; - quotaInTB: number; - status: string; - usedSpaceInGB: number; -} - -interface IVcdOrganizationBackupState { - offers: IBackupOffer[]; - region: string; -} - -interface IVcdOrganizationBackupSpecs { - offers: { - name: string; - quotaInTB: number; - status: string; - }[]; -} - -interface IVcdOrganizationBackupTask { - id: string; - link: string; - status: string | null; - type: string; -} - -export default interface IVcdOrganizationBackup { - id: string; - resourceStatus: BackupResourceStatus; - currentState: IVcdOrganizationBackupState; - targetSpec: IVcdOrganizationBackupSpecs; - currentTasks?: IVcdOrganizationBackupTask[]; - createdAt?: string; - updatedAt?: string; - iam: IamObject; -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-organization.interface.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-organization.interface.ts deleted file mode 100644 index 0d470beaf099..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-organization.interface.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { IamObject } from '@ovh-ux/manager-react-components'; - -export interface IVcdOrganizationState { - fullName: string; - description: string; -} - -export interface IVcdOrganizationCurrentState extends IVcdOrganizationState { - apiUrl?: string; - region: string; - name: string; - spla: boolean; - billingType: 'DEMO' | 'MONTHLY'; - webInterfaceUrl: string; -} - -export default interface IVcdOrganization { - id: string; - resourceStatus: string; - currentState: IVcdOrganizationCurrentState; - targetSpec: IVcdOrganizationState; - currentTasks?: any[]; - iam: IamObject; - updatedAt: string; -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-storage.interface.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-storage.interface.ts deleted file mode 100644 index 60bd8f4b5727..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-storage.interface.ts +++ /dev/null @@ -1,21 +0,0 @@ -export interface IVcdStorageState { - billingType: string; - capacity: number; - name: string; - profile: string; - type: string; -} - -interface IVcdStorageTask { - id: string; - link: string; - status: string; - type: string; -} - -export default interface IVcdStorage { - id: string; - resourceStatus: string; - currentState: IVcdStorageState; - currentTasks?: IVcdStorageTask[]; -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-vdc-orderable-resource.interface.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-vdc-orderable-resource.interface.ts deleted file mode 100644 index 511a74134db3..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-vdc-orderable-resource.interface.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { IVcdCatalogProductPricing } from './vcd-catalog.interface'; -import { IVcdComputeState } from './vcd-compute.interface'; -import { IVcdStorageState } from './vcd-storage.interface'; - -export interface IVdcOrderableVHost - extends Omit { - vCPUSpeed: number; -} -export interface IVdcOrderableVhostPriced extends IVdcOrderableVHost { - pricing: IVcdCatalogProductPricing; -} - -export type IVdcOrderableStorage = Omit; -export interface IVdcOrderableStoragePriced extends IVdcOrderableStorage { - pricing: IVcdCatalogProductPricing; -} - -export type IVdcOrderableResource = IVdcOrderableVHost | IVdcOrderableStorage; -export type IVdcOrderableResourcePriced = - | IVdcOrderableVhostPriced - | IVdcOrderableStoragePriced; - -export interface IVdcOrderableResourceData { - compute: IVdcOrderableVHost[]; - storage: IVdcOrderableStorage[]; -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/getPricedOrderableResource.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/getPricedOrderableResource.ts index f2c35bd7b6fd..73eb5ea92998 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/getPricedOrderableResource.ts +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/getPricedOrderableResource.ts @@ -1,28 +1,28 @@ import { - IVdcOrderableResource, - IVdcOrderableResourcePriced, -} from '@/types/vcd-vdc-orderable-resource.interface'; -import { TVcdCatalog } from '@/types/vcd-catalog.interface'; + VCDCatalog, + VCDOrderableResource, + VCDOrderableResourcePriced, +} from '@ovh-ux/manager-module-vcd-api'; -export const getVdcResourcePrice = (resource: IVdcOrderableResourcePriced) => +export const getVdcResourcePrice = (resource: VCDOrderableResourcePriced) => resource.pricing?.priceInUcents; export const getVdcResourcePriceLabel = ( - resource: IVdcOrderableResourcePriced, + resource: VCDOrderableResourcePriced, ) => resource.pricing.price.text; export const getPricedVdcResources = ({ resources, catalog, }: { - resources: IVdcOrderableResource[]; - catalog: TVcdCatalog; -}): IVdcOrderableResourcePriced[] => { + resources: VCDOrderableResource[]; + catalog: VCDCatalog; +}): VCDOrderableResourcePriced[] => { if (!resources || !catalog) { return []; } return resources - .reduce((list: IVdcOrderableResourcePriced[], resource) => { + .reduce((list: VCDOrderableResourcePriced[], resource) => { const prices = catalog.find( ({ planCode }) => planCode === resource.profile, )?.prices; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/refetchConditions.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/refetchConditions.ts index a6accb3020c7..a606fa050f51 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/refetchConditions.ts +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/refetchConditions.ts @@ -1,12 +1,12 @@ -import IVcdDatacentre from '@/types/vcd-datacenter.interface'; -import IVcdOrganization from '@/types/vcd-organization.interface'; +import { VCDDatacentre, VCDOrganization } from '@ovh-ux/manager-module-vcd-api'; -export type UpdatableResource = IVcdOrganization | IVcdDatacentre; +export type UpdatableResource = VCDOrganization | VCDDatacentre; const targetSpecKey = 'configure-target-spec'; export const isUpdatingTargetSpec = (resource: UpdatableResource | undefined) => - resource?.currentTasks?.some((task) => task.type === targetSpecKey); + resource?.currentTasks?.some((task) => task.type === targetSpecKey) && + resource?.resourceStatus !== 'READY'; export const hasResourceUpdatingTargetSpec = ( resources: UpdatableResource[] | undefined, diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/veeamBackupBadge.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/veeamBackupBadge.ts index 4d0e03eca207..1dcd337ff1d5 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/veeamBackupBadge.ts +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/veeamBackupBadge.ts @@ -1,7 +1,7 @@ +import { ResourceStatus } from '@ovh-ux/manager-module-vcd-api'; import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; -import { BackupResourceStatus } from '@/types/vcd-organization-backup.interface'; -type BadgeStatus = BackupResourceStatus | 'none' | 'error'; +type BadgeStatus = ResourceStatus | 'none' | 'error'; export type BackupBadgeParams = { color: ODS_THEME_COLOR_INTENT; translationKey: string; @@ -58,7 +58,7 @@ export const getBackupBadgeStatus = ({ backupStatus, }: { errorStatus: number; - backupStatus: BackupResourceStatus; + backupStatus: ResourceStatus; }): BadgeStatus => { if (backupStatus) return backupStatus; return errorStatus === 404 ? 'none' : 'error'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/veeamBackupId.ts b/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/veeamBackupId.ts deleted file mode 100644 index 9de7359dd19f..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/veeamBackupId.ts +++ /dev/null @@ -1,9 +0,0 @@ -import IVcdOrganization from '@/types/vcd-organization.interface'; - -const getOrganizationUuid = (organization: IVcdOrganization) => - organization.id.split( - `${organization.currentState.region.toLowerCase()}-`, - )[1]; - -export const getBackupIdFromOrganization = (organization: IVcdOrganization) => - `${getOrganizationUuid(organization)}-veeam-backup`; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/tsconfig.test.json b/packages/manager/apps/hpc-vmware-managed-vcd/tsconfig.test.json deleted file mode 100644 index 7048c297c8f6..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/tsconfig.test.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "CommonJS" - } -} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/vitest.config.js b/packages/manager/apps/hpc-vmware-managed-vcd/vitest.config.js index a5e80ab7f4a3..f13836749312 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/vitest.config.js +++ b/packages/manager/apps/hpc-vmware-managed-vcd/vitest.config.js @@ -8,7 +8,7 @@ export default defineConfig({ test: { globals: true, environment: 'jsdom', - setupFiles: './setupTests.ts', + setupFiles: '@ovh-ux/manager-core-test-utils/setup-file-msw-ods17.tsx', coverage: { include: ['src'], exclude: [ @@ -18,6 +18,9 @@ export default defineConfig({ 'src/App.tsx', 'src/index.tsx', 'src/tracking.constant.ts', + '404.tsx', + 'src/**/*.spec.ts', + 'src/**/*.spec.tsx', ], }, testTimeout: 60000, diff --git a/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_de_DE.json b/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_de_DE.json index 52259e752e7d..2e258340cfb4 100644 --- a/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_de_DE.json +++ b/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_de_DE.json @@ -44,7 +44,7 @@ "hycu_dashboard_update_display_name_modal_headline": "Namen ändern", "hycu_dashboard_update_display_name_input_label": "Name", "hycu_dashboard_update_display_name_pattern_message": "Bitte verwenden Sie nur Buchstaben ohne Akzent und die folgenden Sonderzeichen:! @ # $ % ^ & * ( ) - _ + = [ ] { } ; : , . ? (auf 36 Zeichen begrenzt).", - "hycu_dashboard_update_display_name_success": "Die Beschreibung wurde erfolgreich geändert.", + "hycu_dashboard_update_display_name_success": "Der Name wurde erfolgreich geändert.", "hycu_dashboard_edit_modal_error": "Es ist ein Fehler aufgetreten: {{error}}.", "hycu_dashboard_error_license_message": "Bei der Aktivierung Ihrer Lizenz ist ein Fehler aufgetreten ({{error}}). Bitte überprüfen Sie Ihre Angaben und versuchen Sie es erneut. Sollte das Problem weiterhin bestehen, kontaktieren Sie bitte unseren Support.", "hycu_dashboard_warning_license_suspended_message": "Der Dienst wurde gekündigt." diff --git a/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_en_GB.json b/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_en_GB.json index 58efa2f434ad..8d261b1c3d89 100644 --- a/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_en_GB.json +++ b/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_en_GB.json @@ -44,7 +44,7 @@ "hycu_dashboard_update_display_name_modal_headline": "Change name", "hycu_dashboard_update_display_name_input_label": "Name", "hycu_dashboard_update_display_name_pattern_message": "Must contain unaccented letters and the following special characters: ! @ # $ % ^ & * ( ) - _ + = [ ] { } ; : , . ? (limited to 36 characters).", - "hycu_dashboard_update_display_name_success": "The description has been modified.", + "hycu_dashboard_update_display_name_success": "The name has been changed.", "hycu_dashboard_edit_modal_error": "An error has occurred: {{error}}.", "hycu_dashboard_error_license_message": "An error has occurred activating your licence ({{error}}). Please check the information provided and try again. If the problem persists, please contact our support team.", "hycu_dashboard_warning_license_suspended_message": "The service has been cancelled." diff --git a/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_es_ES.json b/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_es_ES.json index dc051b6152a6..34e5daa6f82d 100644 --- a/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_es_ES.json +++ b/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_es_ES.json @@ -44,7 +44,7 @@ "hycu_dashboard_update_display_name_modal_headline": "Editar el nombre", "hycu_dashboard_update_display_name_input_label": "Apellido", "hycu_dashboard_update_display_name_pattern_message": "Por favor, utilice solo letras sin acento y los siguientes caracteres especiales: ! @ # $ % ^ & * ( ) - _ + = [ ] { } ; : , . ? (máximo 36 caracteres).", - "hycu_dashboard_update_display_name_success": "La descripción se ha modificado correctamente.", + "hycu_dashboard_update_display_name_success": "El nombre se ha modificado correctamente.", "hycu_dashboard_edit_modal_error": "Se ha producido un error: {{error}}.", "hycu_dashboard_error_license_message": "Se ha producido un error al activar la licencia ({{error}}). Por favor, compruebe la información proporcionada y vuelva a intentarlo. Si el problema persiste, contacte con nuestro equipo de soporte.", "hycu_dashboard_warning_license_suspended_message": "El servicio se ha dado de baja." diff --git a/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_fr_CA.json b/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_fr_CA.json index c108de86a216..c05eea082e36 100644 --- a/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_fr_CA.json +++ b/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_fr_CA.json @@ -44,7 +44,7 @@ "hycu_dashboard_update_display_name_modal_headline": "Modifier le nom", "hycu_dashboard_update_display_name_input_label": "Nom", "hycu_dashboard_update_display_name_pattern_message": "Veuillez utiliser uniquement des lettres sans accent et les caractères spéciaux suivants : ! @ # $ % ^ & * ( ) - _ + = [ ] { } ; : , . ? (limité à 36 caractères).", - "hycu_dashboard_update_display_name_success": "La description a été modifiée avec succès.", + "hycu_dashboard_update_display_name_success": "Le nom a été modifié avec succès.", "hycu_dashboard_edit_modal_error": "Une erreur est survenue: {{error}}.", "hycu_dashboard_error_license_message": "Une erreur est survenue lors de l'activation de votre licence ({{error}}). Nous vous invitons à vérifier les informations fournies et à réaliser une nouvelle tentative. Si le problème persiste, veuillez contacter notre support.", "hycu_dashboard_warning_license_suspended_message": "Le service a été résilié." diff --git a/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_fr_FR.json b/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_fr_FR.json index c108de86a216..c05eea082e36 100644 --- a/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_fr_FR.json +++ b/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_fr_FR.json @@ -44,7 +44,7 @@ "hycu_dashboard_update_display_name_modal_headline": "Modifier le nom", "hycu_dashboard_update_display_name_input_label": "Nom", "hycu_dashboard_update_display_name_pattern_message": "Veuillez utiliser uniquement des lettres sans accent et les caractères spéciaux suivants : ! @ # $ % ^ & * ( ) - _ + = [ ] { } ; : , . ? (limité à 36 caractères).", - "hycu_dashboard_update_display_name_success": "La description a été modifiée avec succès.", + "hycu_dashboard_update_display_name_success": "Le nom a été modifié avec succès.", "hycu_dashboard_edit_modal_error": "Une erreur est survenue: {{error}}.", "hycu_dashboard_error_license_message": "Une erreur est survenue lors de l'activation de votre licence ({{error}}). Nous vous invitons à vérifier les informations fournies et à réaliser une nouvelle tentative. Si le problème persiste, veuillez contacter notre support.", "hycu_dashboard_warning_license_suspended_message": "Le service a été résilié." diff --git a/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_it_IT.json b/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_it_IT.json index a3645a8b0043..5dbe47a372c9 100644 --- a/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_it_IT.json +++ b/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_it_IT.json @@ -44,7 +44,7 @@ "hycu_dashboard_update_display_name_modal_headline": "Modifica il nome", "hycu_dashboard_update_display_name_input_label": "Cognome", "hycu_dashboard_update_display_name_pattern_message": "Utilizza esclusivamente lettere senza accento e i seguenti caratteri speciali:! @ # $ % ^ & * ( ) - _ + = [ ] { } ; : , . ? (limitato a 36 caratteri).", - "hycu_dashboard_update_display_name_success": "La descrizione è stata modificata correttamente.", + "hycu_dashboard_update_display_name_success": "Il nome è stato modificato correttamente.", "hycu_dashboard_edit_modal_error": "Si è verificato un errore: {{error}}.", "hycu_dashboard_error_license_message": "Si è verificato un errore durante l'attivazione della tua licenza ({{error}}). Ti invitiamo a verificare le informazioni fornite e a ripetere l’operazione. Se il problema persiste, contatta il nostro supporto.", "hycu_dashboard_warning_license_suspended_message": "Il servizio è stato disattivato." diff --git a/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_pl_PL.json b/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_pl_PL.json index 09f32436fcb1..70f2019e0ef2 100644 --- a/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_pl_PL.json +++ b/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_pl_PL.json @@ -44,7 +44,7 @@ "hycu_dashboard_update_display_name_modal_headline": "Zmień nazwę", "hycu_dashboard_update_display_name_input_label": "Nazwisko", "hycu_dashboard_update_display_name_pattern_message": "Należy używać tylko liter bez następujących znaków specjalnych: ! @ # $ % ^ & * ( ) - _ + = [ ] { } ; : , . ? (maksymalna liczba znaków: 36).", - "hycu_dashboard_update_display_name_success": "Opis został zmieniony.", + "hycu_dashboard_update_display_name_success": "Nazwa została zmodyfikowana.", "hycu_dashboard_edit_modal_error": "Wystąpił błąd: {{error}}", "hycu_dashboard_error_license_message": "Wystąpił błąd podczas aktywacji Twojej licencji ({{error}}). Sprawdź podane informacje i spróbuj ponownie. Jeśli problem się powtórzy, skontaktuj się z pomocą techniczną.", "hycu_dashboard_warning_license_suspended_message": "Usługa została zakończona." diff --git a/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_pt_PT.json b/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_pt_PT.json index 575663f1f249..ff45d8eb430c 100644 --- a/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_pt_PT.json +++ b/packages/manager/apps/hycu/public/translations/hycu/dashboard/Messages_pt_PT.json @@ -44,7 +44,7 @@ "hycu_dashboard_update_display_name_modal_headline": "Alterar o nome", "hycu_dashboard_update_display_name_input_label": "Nome", "hycu_dashboard_update_display_name_pattern_message": "Utilize apenas letras sem acento e os seguintes caracteres especiais: ! @ # $ % ^ & * ( ) - _ + = [ ] { } ; : , . ? (limitado a 36 caracteres).", - "hycu_dashboard_update_display_name_success": "A descrição foi modificada com sucesso.", + "hycu_dashboard_update_display_name_success": "O nome foi modificado com êxito.", "hycu_dashboard_edit_modal_error": "Ocorreu um erro: {{error}}.", "hycu_dashboard_error_license_message": "Ocorreu um erro ao ativar a sua licença {{error}}. Sugerimos que verifique as informações fornecidas e tente novamente. Se o problema persistir, queira contactar o nosso suporte.", "hycu_dashboard_warning_license_suspended_message": "O serviço foi rescindido." diff --git a/packages/manager/apps/key-management-service/src/components/Modal/terminate/TerminateModal.component.tsx b/packages/manager/apps/key-management-service/src/components/Modal/terminate/TerminateModal.component.tsx deleted file mode 100644 index 29df84dfd14b..000000000000 --- a/packages/manager/apps/key-management-service/src/components/Modal/terminate/TerminateModal.component.tsx +++ /dev/null @@ -1,119 +0,0 @@ -import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; -import { - ButtonType, - PageLocation, - useOvhTracking, -} from '@ovh-ux/manager-react-shell-client'; -import { - ODS_BUTTON_TYPE, - ODS_BUTTON_VARIANT, - ODS_INPUT_TYPE, - ODS_SPINNER_SIZE, - ODS_TEXT_LEVEL, - OdsInputValueChangeEvent, -} from '@ovhcloud/ods-components'; -import { - OsdsButton, - OsdsInput, - OsdsModal, - OsdsSpinner, - OsdsText, -} from '@ovhcloud/ods-components/react'; -import React, { useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { terminateValue } from './TerminateModal.constants'; - -export type TerminateModalProps = { - closeModal: () => void; - isLoading?: boolean; - onConfirmTerminate: () => void; -}; - -export const TerminateModal: React.FC = ({ - closeModal, - isLoading, - onConfirmTerminate, -}) => { - const { trackClick } = useOvhTracking(); - const { t } = useTranslation('key-management-service/terminate'); - const [terminateInput, setTerminateInput] = useState(''); - - const close = () => { - setTerminateInput(''); - closeModal(); - }; - - return ( - -
- {isLoading ? ( -
- -
- ) : ( - <> - - {t('key_management_service_terminate_description', { - terminateKeyword: terminateValue, - })} - - - setTerminateInput(e.detail.value) - } - /> - - )} -
- { - trackClick({ - location: PageLocation.popup, - buttonType: ButtonType.button, - actionType: 'navigation', - actions: ['delete_kms', 'cancel'], - }); - close(); - }} - > - {t('key_management_service_terminate_cancel')} - - { - trackClick({ - location: PageLocation.popup, - buttonType: ButtonType.button, - actionType: 'navigation', - actions: ['delete_kms', 'confirm'], - }); - setTerminateInput(''); - onConfirmTerminate(); - }} - > - {t('key_management_service_terminate_confirm')} - -
- ); -}; diff --git a/packages/manager/apps/key-management-service/src/components/Modal/terminate/TerminateModal.constants.ts b/packages/manager/apps/key-management-service/src/components/Modal/terminate/TerminateModal.constants.ts deleted file mode 100644 index b12864b664ed..000000000000 --- a/packages/manager/apps/key-management-service/src/components/Modal/terminate/TerminateModal.constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const terminateValue = 'TERMINATE'; diff --git a/packages/manager/apps/key-management-service/src/components/layout-helpers/Dashboard/GeneralInformationsTiles/BillingInformationsTile.tsx b/packages/manager/apps/key-management-service/src/components/layout-helpers/Dashboard/GeneralInformationsTiles/BillingInformationsTile.tsx index c0334ef1e19c..36b856b43fdc 100644 --- a/packages/manager/apps/key-management-service/src/components/layout-helpers/Dashboard/GeneralInformationsTiles/BillingInformationsTile.tsx +++ b/packages/manager/apps/key-management-service/src/components/layout-helpers/Dashboard/GeneralInformationsTiles/BillingInformationsTile.tsx @@ -10,19 +10,16 @@ import { ODS_ICON_SIZE, ODS_TEXT_COLOR_INTENT, } from '@ovhcloud/ods-components'; +import { Outlet, useNavigate } from 'react-router-dom'; import { OsdsChip, OsdsIcon, OsdsLink } from '@ovhcloud/ods-components/react'; import React, { useContext, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { ButtonType, PageLocation, - PageType, ShellContext, useOvhTracking, } from '@ovh-ux/manager-react-shell-client'; -import { OKMS } from '@/types/okms.type'; -import { useTerminateOKms } from '@/data/hooks/useTerminateOKms'; -import { TerminateModal } from '@/components/Modal/terminate/TerminateModal.component'; import { OkmsServiceState } from '../okmsServiceState/OkmsServiceState.component'; import { Tile } from '@/components/dashboard/tile/tile.component'; import { TileItem } from '@/components/dashboard/tile-item/tileItem.component'; @@ -30,47 +27,25 @@ import { TileValue } from '@/components/dashboard/tile-value/tileValue.component import { TileSeparator } from '@/components/dashboard/tile-separator/tileSeparator'; import { TileValueDate } from '@/components/dashboard/tile-value-date/tileValueDate.component'; import { DISPLAY_CONTACTS_MANAGEMENT_KEY } from './BillingInformationsTile.constants'; +import { ROUTES_URLS } from '@/routes/routes.constants'; type BillingInformationsTileProps = { - okmsData?: OKMS; okmsService?: ServiceDetails; }; const BillingInformationsTile = ({ - okmsData, okmsService, }: BillingInformationsTileProps) => { const { t } = useTranslation('key-management-service/dashboard'); - const { trackClick, trackPage } = useOvhTracking(); + const navigate = useNavigate(); + const { trackClick } = useOvhTracking(); const [contactUrl, setContactUrl] = useState(''); - const [showTerminationModal, setShowTerminationModal] = useState(false); const { data: availability } = useFeatureAvailability([ DISPLAY_CONTACTS_MANAGEMENT_KEY, ]); const { shell: { navigation }, } = useContext(ShellContext); - const closeTerminateModal = () => { - setShowTerminationModal(false); - }; - - const { terminateKms, isPending } = useTerminateOKms({ - okmsId: okmsData.id, - onSuccess: () => { - trackPage({ - pageType: PageType.bannerSuccess, - pageName: 'delete_kms_success', - }); - closeTerminateModal(); - }, - onError: () => { - trackPage({ - pageType: PageType.bannerError, - pageName: 'delete_kms_error', - }); - closeTerminateModal(); - }, - }); const dateFormat: Intl.DateTimeFormatOptions = { day: '2-digit', @@ -90,7 +65,7 @@ const BillingInformationsTile = ({ actionType: 'navigation', actions: ['delete_kms'], }); - setShowTerminationModal(true); + navigate(ROUTES_URLS.terminateOkms); }, }, ]; @@ -212,13 +187,7 @@ const BillingInformationsTile = ({ )} - {showTerminationModal && ( - - )} + ); }; diff --git a/packages/manager/apps/key-management-service/src/data/hooks/useTerminateOKms.ts b/packages/manager/apps/key-management-service/src/data/hooks/useTerminateOKms.ts index a862377f09d9..c3f4e751017b 100644 --- a/packages/manager/apps/key-management-service/src/data/hooks/useTerminateOKms.ts +++ b/packages/manager/apps/key-management-service/src/data/hooks/useTerminateOKms.ts @@ -1,6 +1,10 @@ import { ApiError, ApiResponse } from '@ovh-ux/manager-core-api'; import { useNotifications } from '@ovh-ux/manager-react-components'; -import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { + MutationOptions, + useMutation, + useQueryClient, +} from '@tanstack/react-query'; import { useTranslation } from 'react-i18next'; import { getOkmsServicesResourceListQueryKey } from '../api/okms'; import { @@ -10,15 +14,14 @@ import { terminateOKmsQueryKey, } from '../api/okmsService'; +export type UseTerminateOkmsParams = { + okmsId: string; +} & MutationOptions, ApiError>; + export const useTerminateOKms = ({ okmsId, - onSuccess, - onError, -}: { - okmsId: string; - onSuccess?: () => void; - onError?: () => void; -}) => { + ...options +}: UseTerminateOkmsParams) => { const queryClient = useQueryClient(); const { addError, addSuccess, clearNotifications } = useNotifications(); const { t } = useTranslation('key-management-service/terminate'); @@ -34,7 +37,7 @@ export const useTerminateOKms = ({ }); return terminateOKms({ serviceId: servicesId[0] }); }, - onSuccess: () => { + onSuccess: (...params) => { clearNotifications(); addSuccess( t('key_management_service_terminate_success_banner', { @@ -45,9 +48,9 @@ export const useTerminateOKms = ({ queryClient.invalidateQueries({ queryKey: getOkmsServicesResourceListQueryKey, }); - onSuccess?.(); + options?.onSuccess?.(...params); }, - onError: (result: ApiError) => { + onError: (result: ApiError, ...params) => { clearNotifications(); addError( t('key_management_service_terminate_error', { @@ -55,8 +58,9 @@ export const useTerminateOKms = ({ }), true, ); - onError?.(); + options?.onError?.(result, ...params); }, + ...options, }); return { diff --git a/packages/manager/apps/key-management-service/src/pages/dashboard/KmsDashboard.page.spec.tsx b/packages/manager/apps/key-management-service/src/pages/dashboard/KmsDashboard.page.spec.tsx index 5a8dfdaa55fe..698c515e6871 100644 --- a/packages/manager/apps/key-management-service/src/pages/dashboard/KmsDashboard.page.spec.tsx +++ b/packages/manager/apps/key-management-service/src/pages/dashboard/KmsDashboard.page.spec.tsx @@ -1,9 +1,9 @@ import { act, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { renderTestApp } from '@/utils/tests/renderTestApp'; -import '@testing-library/jest-dom'; import { labels } from '@/utils/tests/init.i18n'; import { okmsMock } from '@/mocks/kms/okms.mock'; +import '@testing-library/jest-dom'; describe('KMS dashboard test suite', () => { it('should display an error if the API is KO', async () => { @@ -134,12 +134,12 @@ describe('KMS dashboard test suite', () => { await waitFor( () => expect( - screen.getByText( + screen.getAllByText( labels.serviceKeys[ 'key_management_service_service-keys_dashboard_field_name' ], ), - ).toBeVisible(), + ).toHaveLength(2), { timeout: 30_000, }, diff --git a/packages/manager/apps/key-management-service/src/pages/dashboard/generalInformations/GeneralInformations.tsx b/packages/manager/apps/key-management-service/src/pages/dashboard/generalInformations/GeneralInformations.tsx index 64853d40c477..3f7e3329a5dd 100644 --- a/packages/manager/apps/key-management-service/src/pages/dashboard/generalInformations/GeneralInformations.tsx +++ b/packages/manager/apps/key-management-service/src/pages/dashboard/generalInformations/GeneralInformations.tsx @@ -36,10 +36,7 @@ function GeneralInformationsTab() { okmsData={okms.data} okmsServiceInfos={okmsService.data} /> - +
); } diff --git a/packages/manager/apps/key-management-service/src/pages/listing/terminate/TerminateKms.tsx b/packages/manager/apps/key-management-service/src/pages/listing/terminate/TerminateKms.tsx index d829aff8b300..89b6c6c7fcbf 100644 --- a/packages/manager/apps/key-management-service/src/pages/listing/terminate/TerminateKms.tsx +++ b/packages/manager/apps/key-management-service/src/pages/listing/terminate/TerminateKms.tsx @@ -1,17 +1,23 @@ import React from 'react'; -import { PageType, useOvhTracking } from '@ovh-ux/manager-react-shell-client'; +import { + ButtonType, + PageLocation, + PageType, + useOvhTracking, +} from '@ovh-ux/manager-react-shell-client'; import { useNavigate, useParams } from 'react-router-dom'; -import { TerminateModal } from '@/components/Modal/terminate/TerminateModal.component'; +import { useTranslation } from 'react-i18next'; +import { + DeleteModal, + defaultDeleteModalTerminateValue, +} from '@ovh-ux/manager-react-components'; import { useTerminateOKms } from '@/data/hooks/useTerminateOKms'; export default function TerminateKms() { const navigate = useNavigate(); - const { trackPage } = useOvhTracking(); + const { t } = useTranslation('key-management-service/terminate'); const { okmsId } = useParams(); - - const closeModal = () => { - navigate('..'); - }; + const { trackPage, trackClick } = useOvhTracking(); const { terminateKms, isPending } = useTerminateOKms({ okmsId, @@ -20,22 +26,43 @@ export default function TerminateKms() { pageType: PageType.bannerSuccess, pageName: 'delete_kms_success', }); - closeModal(); }, onError: () => { trackPage({ pageType: PageType.bannerError, pageName: 'delete_kms_error', }); - closeModal(); + }, + onSettled: () => { + navigate('..'); }, }); return ( - { + trackClick({ + location: PageLocation.popup, + buttonType: ButtonType.button, + actionType: 'navigation', + actions: ['delete_kms', 'cancel'], + }); + navigate('..'); + }} isLoading={isPending} + onConfirmDelete={() => { + trackClick({ + location: PageLocation.popup, + buttonType: ButtonType.button, + actionType: 'navigation', + actions: ['delete_kms', 'confirm'], + }); + terminateKms(); + }} + deleteInputLabel={t('key_management_service_terminate_description', { + terminateKeyword: defaultDeleteModalTerminateValue, + })} /> ); } diff --git a/packages/manager/apps/key-management-service/src/routes/routes.constants.ts b/packages/manager/apps/key-management-service/src/routes/routes.constants.ts index 0041c5ff8b1e..f9847cc3ec15 100644 --- a/packages/manager/apps/key-management-service/src/routes/routes.constants.ts +++ b/packages/manager/apps/key-management-service/src/routes/routes.constants.ts @@ -2,7 +2,7 @@ export const ROUTES_URLS = { root: '/', listing: '/', onboarding: '/onboarding', - terminateOkms: '/terminate', + terminateOkms: 'terminate', createKeyManagementService: 'create', okmsId: ':okmsId', okmsUpdateName: 'update-name', diff --git a/packages/manager/apps/key-management-service/src/routes/routes.tsx b/packages/manager/apps/key-management-service/src/routes/routes.tsx index fddde97f6f77..015abd04f327 100644 --- a/packages/manager/apps/key-management-service/src/routes/routes.tsx +++ b/packages/manager/apps/key-management-service/src/routes/routes.tsx @@ -99,6 +99,18 @@ export default [ }, }, }, + { + path: ROUTES_URLS.terminateOkms, + ...lazyRouteConfig(() => + import('@/pages/listing/terminate/TerminateKms'), + ), + handle: { + tracking: { + pageName: 'terminate', + pageType: PageType.popup, + }, + }, + }, ], }, { diff --git a/packages/manager/apps/veeam-backup/cucumber.js b/packages/manager/apps/veeam-backup/cucumber.js deleted file mode 100644 index 8e6abbfbca8f..000000000000 --- a/packages/manager/apps/veeam-backup/cucumber.js +++ /dev/null @@ -1,20 +0,0 @@ -const isCI = process.env.CI; - -module.exports = { - default: { - paths: ['e2e/features/**/*.feature'], - require: [ - '../../../../playwright-helpers/bdd-setup.ts', - 'e2e/**/*.step.ts', - ], - requireModule: ['ts-node/register'], - format: [ - 'summary', - isCI ? 'progress' : 'progress-bar', - !isCI && ['html', 'e2e/reports/cucumber-results-report.html'], - !isCI && ['usage-json', 'e2e/reports/cucumber-usage-report.json'], - ].filter(Boolean), - formatOptions: { snippetInterface: 'async-await' }, - retry: 1, - }, -}; diff --git a/packages/manager/apps/veeam-backup/e2e/features/onboarding.feature b/packages/manager/apps/veeam-backup/e2e/features/onboarding.feature deleted file mode 100644 index 3bdeb5b52a68..000000000000 --- a/packages/manager/apps/veeam-backup/e2e/features/onboarding.feature +++ /dev/null @@ -1,7 +0,0 @@ -Feature: Onboarding page - - Scenario: User wants to find informations related to veeam-backup - Given User has 0 elements in the Listing page - When User navigates to Listing page - Then User gets redirected to Onboarding page - Then User sees 3 guides diff --git a/packages/manager/apps/veeam-backup/e2e/step-definitions/onboarding.step.ts b/packages/manager/apps/veeam-backup/e2e/step-definitions/onboarding.step.ts deleted file mode 100644 index 88b37bf1d57f..000000000000 --- a/packages/manager/apps/veeam-backup/e2e/step-definitions/onboarding.step.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Given, When, Then } from '@cucumber/cucumber'; -import { expect } from '@playwright/test'; -import { ICustomWorld } from '../../../../../../playwright-helpers'; -import { ConfigParams, getUrl, setupNetwork } from '../utils'; - -Given('User has {int} elements in the Listing page', function( - this: ICustomWorld, - nb: number, -) { - this.handlersConfig.nbBackup = nb; -}); - -When('User navigates to Listing page', async function( - this: ICustomWorld, -) { - await setupNetwork(this); - await this.page.goto(getUrl('listing'), { waitUntil: 'load' }); -}); - -Then('User gets redirected to Onboarding page', async function( - this: ICustomWorld, -) { - await expect(this.page).toHaveURL(getUrl('onboarding')); -}); - -Then('User sees {int} guides', async function( - this: ICustomWorld, - nbGuides: number, -) { - const guides = await this.page.locator('osds-tile'); - await expect(guides).toHaveCount(nbGuides); -}); diff --git a/packages/manager/apps/veeam-backup/e2e/utils/constants.ts b/packages/manager/apps/veeam-backup/e2e/utils/constants.ts deleted file mode 100644 index 866e6dadabe9..000000000000 --- a/packages/manager/apps/veeam-backup/e2e/utils/constants.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { urls } from '../../src/routes/routes.constant'; - -export const appUrl = 'http://localhost:9001/app'; - -export type AppRoute = keyof typeof urls; - -export const getUrl = (route: AppRoute) => `${appUrl}/#${urls[route]}`; diff --git a/packages/manager/apps/veeam-backup/e2e/utils/index.tsx b/packages/manager/apps/veeam-backup/e2e/utils/index.tsx deleted file mode 100644 index 24a453c58aa9..000000000000 --- a/packages/manager/apps/veeam-backup/e2e/utils/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -export * from './network'; -export * from './constants'; diff --git a/packages/manager/apps/veeam-backup/e2e/utils/network.ts b/packages/manager/apps/veeam-backup/e2e/utils/network.ts deleted file mode 100644 index 00b7220c2f06..000000000000 --- a/packages/manager/apps/veeam-backup/e2e/utils/network.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { BrowserContext } from '@playwright/test'; -import { - getServicesMocks, - GetServicesMocksParams, -} from '@ovh-ux/manager-react-components'; -import { - ICustomWorld, - toPlaywrightMockHandler, - Handler, -} from '../../../../../../playwright-helpers'; -import { - GetAuthenticationMocks, - getAuthenticationMocks, -} from '../../../../../../playwright-helpers/mocks/auth'; -import { - getIamMocks, - getOrganizationMocks, - GetOrganizationMocksParams, - getVeeamBackupMocks, - GetVeeamBackupMocksParams, -} from '../../mocks'; - -export type ConfigParams = GetAuthenticationMocks & - GetVeeamBackupMocksParams & - GetOrganizationMocksParams & - GetServicesMocksParams; - -export const getConfig = (params: ConfigParams): Handler[] => - [ - getAuthenticationMocks, - getIamMocks, - getOrganizationMocks, - getVeeamBackupMocks, - getServicesMocks, - ].flatMap((getMocks) => getMocks(params)); - -export const setupNetwork = async (world: ICustomWorld) => - Promise.all( - getConfig({ - ...((world?.handlersConfig as ConfigParams) || ({} as ConfigParams)), - isAuthMocked: true, - }) - .reverse() - .map(toPlaywrightMockHandler(world.context as BrowserContext)), - ); diff --git a/packages/manager/apps/veeam-backup/mocks/iam.handler.ts b/packages/manager/apps/veeam-backup/mocks/iam.handler.ts index 7f49fabbf8ce..3ddfdf17e093 100644 --- a/packages/manager/apps/veeam-backup/mocks/iam.handler.ts +++ b/packages/manager/apps/veeam-backup/mocks/iam.handler.ts @@ -1,5 +1,5 @@ import { PathParams } from 'msw'; -import { Handler } from '../../../../../playwright-helpers'; +import { Handler } from '@ovh-ux/manager-core-test-utils'; import { iamResponse } from './iam.mock'; const findResourceByUrn = (params: PathParams) => diff --git a/packages/manager/apps/veeam-backup/mocks/iam.mock.ts b/packages/manager/apps/veeam-backup/mocks/iam.mock.ts index bc39d0e0526d..b7cfee3a8b53 100644 --- a/packages/manager/apps/veeam-backup/mocks/iam.mock.ts +++ b/packages/manager/apps/veeam-backup/mocks/iam.mock.ts @@ -1,5 +1,5 @@ import { IamCheckResponse } from '@ovh-ux/manager-react-components'; -import { backupList } from './veeam-backup.mock'; +import { backupList } from '@ovh-ux/manager-module-vcd-api'; import { iamActions } from '../src/veeam-backup.config'; export const iamResponse: IamCheckResponse[] = [ diff --git a/packages/manager/apps/veeam-backup/mocks/index.ts b/packages/manager/apps/veeam-backup/mocks/index.ts index e4fad3ec0f43..9c690a4017f5 100644 --- a/packages/manager/apps/veeam-backup/mocks/index.ts +++ b/packages/manager/apps/veeam-backup/mocks/index.ts @@ -1,4 +1 @@ -export * from './vcd-organization.handler'; -export * from './veeam-backup.handler'; export * from './iam.handler'; -export * from './catalog.handler'; diff --git a/packages/manager/apps/veeam-backup/mocks/vcd-organization.handler.ts b/packages/manager/apps/veeam-backup/mocks/vcd-organization.handler.ts deleted file mode 100644 index 827328d65e8b..000000000000 --- a/packages/manager/apps/veeam-backup/mocks/vcd-organization.handler.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { PathParams } from 'msw'; -import { Handler } from '../../../../../playwright-helpers'; -import { organizationList } from './vcd-organization.mock'; - -export type GetOrganizationMocksParams = { - isOrganizationKo?: boolean; - nbOrganization?: number; - allOrgsBackedUp?: boolean; -}; - -const findOrganiationById = (params: PathParams) => - organizationList.find(({ id }) => id === params.id); - -export const getOrganizationMocks = ({ - isOrganizationKo, - nbOrganization = Number.POSITIVE_INFINITY, - allOrgsBackedUp, -}: GetOrganizationMocksParams): Handler[] => { - const nb = allOrgsBackedUp ? 1 : nbOrganization; - return [ - { - url: '/vmwareCloudDirector/organization/:id', - response: (_: unknown, params: PathParams) => - isOrganizationKo - ? { - message: 'Organization error', - } - : findOrganiationById(params), - status: isOrganizationKo ? 500 : 200, - api: 'v2', - }, - { - url: '/vmwareCloudDirector/organization', - response: isOrganizationKo - ? { - message: 'Organization error', - } - : organizationList.slice(0, nb), - status: isOrganizationKo ? 500 : 200, - api: 'v2', - }, - ]; -}; diff --git a/packages/manager/apps/veeam-backup/package.json b/packages/manager/apps/veeam-backup/package.json index 445020d3cdd2..729856cb596c 100644 --- a/packages/manager/apps/veeam-backup/package.json +++ b/packages/manager/apps/veeam-backup/package.json @@ -11,8 +11,6 @@ "license": "BSD-3-Clause", "author": "OVH SAS", "scripts": { - "beta-test:e2e": "tsc && node ../../../../scripts/run-playwright-bdd.js", - "beta-test:e2e:ci": "tsc && node ../../../../scripts/run-playwright-bdd.js --ci", "build": "tsc && vite build", "dev": "tsc && vite", "start": "lerna exec --stream --scope='@ovh-ux/manager-veeam-backup-app' --include-dependencies -- npm run build --if-present", @@ -25,8 +23,10 @@ "@ovh-ux/manager-config": "^8.0.1", "@ovh-ux/manager-core-api": "^0.9.0", "@ovh-ux/manager-core-utils": "*", + "@ovh-ux/manager-module-common-api": "^0.2.0", "@ovh-ux/manager-module-order": "^0.9.1", - "@ovh-ux/manager-react-components": "^1.41.1", + "@ovh-ux/manager-module-vcd-api": "^0.1.0", + "@ovh-ux/manager-react-components": "^1.43.0", "@ovh-ux/manager-react-core-application": "^0.11.4", "@ovh-ux/manager-react-shell-client": "^0.8.3", "@ovh-ux/manager-tailwind-config": "^0.2.1", @@ -48,19 +48,17 @@ "tailwindcss": "^3.4.4" }, "devDependencies": { - "@cucumber/cucumber": "^10.3.1", + "@ovh-ux/manager-core-test-utils": "^0.2.0", "@ovh-ux/manager-vite-config": "^0.8.3", - "@playwright/test": "^1.41.2", "@testing-library/jest-dom": "^6.5.0", "@testing-library/react": "^16.0.1", "@testing-library/user-event": "^14.5.2", "@vitejs/plugin-react": "^4.3.0", - "@vitest/coverage-v8": "^1.6.0", - "element-internals-polyfill": "^1.3.11", + "@vitest/coverage-v8": "^2.1.4", "msw": "2.1.7", "typescript": "^4.3.2", "vite": "^5.2.13", - "vitest": "^1.2.0" + "vitest": "^2.1.4" }, "regions": [ "CA", diff --git a/packages/manager/apps/veeam-backup/playwright.config.ts b/packages/manager/apps/veeam-backup/playwright.config.ts deleted file mode 100644 index feb249bcbe3f..000000000000 --- a/packages/manager/apps/veeam-backup/playwright.config.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { defineConfig } from '@playwright/test'; - -export default defineConfig({ - workers: 3, - fullyParallel: false, - timeout: 30 * 1000, - reporter: [['html', { open: 'on-failure' }]], - expect: { - timeout: 20000, - }, - use: { - // Collect trace when retrying the failed test. - trace: 'retain-on-failure', - }, - testMatch: '**/*.e2e.ts', - webServer: { - command: 'yarn run dev', - url: 'http://localhost:9000/', - }, -}); diff --git a/packages/manager/apps/veeam-backup/public/translations/order-veeam/Messages_es_ES.json b/packages/manager/apps/veeam-backup/public/translations/order-veeam/Messages_es_ES.json index 69201761e25a..7aa84a45d96a 100644 --- a/packages/manager/apps/veeam-backup/public/translations/order-veeam/Messages_es_ES.json +++ b/packages/manager/apps/veeam-backup/public/translations/order-veeam/Messages_es_ES.json @@ -5,7 +5,7 @@ "offer_title": "Activar {{productName}}", "offer_content_part1": "El servicio Veeam Data Platform dispone de un plugin VCD para guardar las MV y las vApps desde cualquier Virtual Data Center (VDC) de la organización.", "offer_content_part2": "Está disponible a nivel de organización para cualquier usuario de VMware Cloud Director que tenga el rol de administrador de la organización.", - "offer_price": "por MV + consumo de Object Storage de OVHcloud", + "offer_price": "/MV/mes + consumo de OVHcloud Object Storage", "next_step": "Siguiente", "choose_org_title": "Elija una organización VMware Cloud Director", "all_organization_backed_up_message_fetch_next_page": "Todas las organizaciones de VCD ya están asociadas al servicio Managed Veeam for VCD. Por favor, cargue más organizaciones.", diff --git a/packages/manager/apps/veeam-backup/setup-test.tsx b/packages/manager/apps/veeam-backup/setup-test.tsx deleted file mode 100644 index 5350df9d6abb..000000000000 --- a/packages/manager/apps/veeam-backup/setup-test.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { beforeAll, afterAll } from 'vitest'; -import { odsSetup } from '@ovhcloud/ods-common-core'; -import { setupServer } from 'msw/node'; -import { toMswHandlers } from '../../../../playwright-helpers'; -import { getAuthenticationMocks } from '../../../../playwright-helpers/mocks/auth'; -import 'element-internals-polyfill'; - -odsSetup(); - -const server = setupServer( - ...toMswHandlers([ - ...getAuthenticationMocks({ isAuthMocked: true, region: 'EU' }), - ]), -); - -beforeAll(() => { - server.listen({ onUnhandledRequest: 'warn' }); - - delete global.server; - global.__VERSION__ = null; - global.server = server; -}); - -afterAll(() => { - server.close(); - - delete global.__VERSION__; -}); - -afterEach(() => { - server.resetHandlers(); -}); diff --git a/packages/manager/apps/veeam-backup/src/components/BackupStatus/BackupStatusBadge.component.tsx b/packages/manager/apps/veeam-backup/src/components/BackupStatus/BackupStatusBadge.component.tsx index caaeff05b656..a2a62874b016 100644 --- a/packages/manager/apps/veeam-backup/src/components/BackupStatus/BackupStatusBadge.component.tsx +++ b/packages/manager/apps/veeam-backup/src/components/BackupStatus/BackupStatusBadge.component.tsx @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'; import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; import { OsdsChip } from '@ovhcloud/ods-components/react'; import { ODS_CHIP_SIZE } from '@ovhcloud/ods-components'; -import { ResourceStatus, VeeamBackupWithIam } from '@/data'; +import { ResourceStatus, VeeamBackup } from '@ovh-ux/manager-module-vcd-api'; export type BackupStatusBadgeProps = { resourceStatus: ResourceStatus; @@ -21,7 +21,7 @@ const colorByStatus: { [s in ResourceStatus]: ODS_THEME_COLOR_INTENT } = { export const BackupStatusBadge = ({ resourceStatus, className, -}: VeeamBackupWithIam & { className?: string }): JSX.Element => { +}: VeeamBackup & { className?: string }): JSX.Element => { const { t } = useTranslation('veeam-backup'); const color = colorByStatus[resourceStatus]; diff --git a/packages/manager/apps/veeam-backup/src/components/Breadcrumb/Breadcrumb.tsx b/packages/manager/apps/veeam-backup/src/components/Breadcrumb/Breadcrumb.tsx index 2506af48dd5b..e590491c1de8 100644 --- a/packages/manager/apps/veeam-backup/src/components/Breadcrumb/Breadcrumb.tsx +++ b/packages/manager/apps/veeam-backup/src/components/Breadcrumb/Breadcrumb.tsx @@ -7,9 +7,12 @@ import { OdsBreadcrumbAttributeItem, } from '@ovhcloud/ods-components'; import { ShellContext } from '@ovh-ux/manager-react-shell-client'; +import { + getVeeamBackupDisplayName, + useVeeamBackup, +} from '@ovh-ux/manager-module-vcd-api'; import { urls } from '@/routes/routes.constant'; import { appName, productName } from '@/veeam-backup.config'; -import { getVeeamBackupDisplayName, useVeeamBackup } from '@/data'; export type BreadcrumbItem = { label: string | undefined; diff --git a/packages/manager/apps/veeam-backup/src/components/Messages/SuccessMessage.component.tsx b/packages/manager/apps/veeam-backup/src/components/Messages/SuccessMessage.component.tsx index a9cc2f136206..f2866cffdc1e 100644 --- a/packages/manager/apps/veeam-backup/src/components/Messages/SuccessMessage.component.tsx +++ b/packages/manager/apps/veeam-backup/src/components/Messages/SuccessMessage.component.tsx @@ -12,8 +12,11 @@ import { import { OdsHTMLAnchorElementTarget } from '@ovhcloud/ods-common-core'; import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; import { useQueryClient } from '@tanstack/react-query'; +import { + VeeamBackup, + veeamBackupListQueryKey, +} from '@ovh-ux/manager-module-vcd-api'; import { MessageData, MessagesContext } from './Messages.context'; -import { VeeamBackupWithIam, veeamBackupListQueryKey } from '@/data'; export const SuccessMessage: React.FC> = ({ id, @@ -54,7 +57,7 @@ export const SuccessMessages: React.FC<{ id?: string }> = ({ id }) => { const { successMessages, hiddenMessages } = React.useContext(MessagesContext); const queryClient = useQueryClient(); const veeamBackupList = queryClient.getQueryData<{ - data: VeeamBackupWithIam[]; + data: VeeamBackup[]; }>(veeamBackupListQueryKey); if (veeamBackupList?.data?.length === 0) { diff --git a/packages/manager/apps/veeam-backup/src/components/NoOrganizationMessage/NoOrganizationMessage.component.tsx b/packages/manager/apps/veeam-backup/src/components/NoOrganizationMessage/NoOrganizationMessage.component.tsx index baca3f3d813c..2814ac4b313b 100644 --- a/packages/manager/apps/veeam-backup/src/components/NoOrganizationMessage/NoOrganizationMessage.component.tsx +++ b/packages/manager/apps/veeam-backup/src/components/NoOrganizationMessage/NoOrganizationMessage.component.tsx @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'; import { OsdsMessage } from '@ovhcloud/ods-components/react'; import { ODS_MESSAGE_TYPE } from '@ovhcloud/ods-components'; import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; -import { VCDOrganization } from '@/data'; +import { VCDOrganization } from '@ovh-ux/manager-module-vcd-api'; import { VCDOrgInfoLink } from '../Links/VCDOrgInfoLink.component'; export type NoOrganizationMessageProps = { diff --git a/packages/manager/apps/veeam-backup/src/data/api/vcd-organization.ts b/packages/manager/apps/veeam-backup/src/data/api/vcd-organization.ts deleted file mode 100644 index 9ec97c754d66..000000000000 --- a/packages/manager/apps/veeam-backup/src/data/api/vcd-organization.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ApiResponse, apiClient } from '@ovh-ux/manager-core-api'; -import { VCDOrganization } from '../vcd.type'; - -export const organizationApiRoute = '/vmwareCloudDirector/organization'; - -export const getVcdOrganization = async ( - organizationId: string, -): Promise> => - apiClient.v2.get(`${organizationApiRoute}/${organizationId}`); diff --git a/packages/manager/apps/veeam-backup/src/data/hook/index.ts b/packages/manager/apps/veeam-backup/src/data/hook/index.ts deleted file mode 100644 index 3a0037cdde53..000000000000 --- a/packages/manager/apps/veeam-backup/src/data/hook/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './useOrganizations'; -export * from './useVeeamBackup'; -export * from './useOrganizations'; -export * from './useVeeamBackupCatalog'; diff --git a/packages/manager/apps/veeam-backup/src/data/index.ts b/packages/manager/apps/veeam-backup/src/data/index.ts deleted file mode 100644 index 8854381ef8e8..000000000000 --- a/packages/manager/apps/veeam-backup/src/data/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './hook'; -export * from './api'; -export * from './vcd.type'; -export * from './catalog.type'; diff --git a/packages/manager/apps/veeam-backup/src/data/vcd.type.ts b/packages/manager/apps/veeam-backup/src/data/vcd.type.ts deleted file mode 100644 index ae3b1fe5bedc..000000000000 --- a/packages/manager/apps/veeam-backup/src/data/vcd.type.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { CurrencyCode, OvhSubsidiary } from '@ovh-ux/manager-react-components'; - -export type IamData = { - displayName?: string; - id: string; - urn: string; -}; - -export type AvailabilityZone = - | 'ca-east-bhs-a' - | 'eu-central-waw-a' - | 'eu-west-eri-a' - | 'eu-west-lim-a' - | 'eu-west-rbx-a' - | 'eu-west-sbg-a'; - -export type VCDRegion = - | 'AP-SOUTH-MUM' - | 'AP-SOUTHEAST-SGP' - | 'AP-SOUTHEAST-SYD' - | 'CA-EAST-BHS' - | 'EU-CENTRAL-WAW' - | 'EU-WEST-ERI' - | 'EU-WEST-GRA' - | 'EU-WEST-LIM' - | 'EU-WEST-PAR' - | 'EU-WEST-RBX' - | 'EU-WEST-SBG' - | 'US-EAST-VIN' - | 'US-WEST-HIL'; - -export type VeeamBackupOffer = { - name: 'BRONZE' | 'SILVER' | 'GOLD'; - quotaInTB: number; - usedSpaceInGB: number; - status: - | 'READY' - | 'CREATING' - | 'DISABLED' - | 'DISABLING' - | 'REMOVED' - | 'UPDATING'; -}; - -export type ResourceStatus = - | 'READY' - | 'CREATING' - | 'DISABLED' - | 'DISABLING' - | 'REMOVED' - | 'UPDATING'; - -export type Task = { - id: string; - link: string; - status: 'ERROR' | 'PENDING' | 'RUNNING' | 'SCHEDULED' | null; - type: string; -}; - -export type VeeamBackup = { - id: string; - currentState: { - vms?: number; - offers: VeeamBackupOffer[]; - azName: AvailabilityZone; - }; - updatedAt: string; - createdAt: string; - resourceStatus: ResourceStatus; - targetSpec: { - offers: Omit[]; - }; -}; - -export type VeeamBackupWithIam = VeeamBackup & { iam: IamData }; - -export enum BackupStatus { - active = 'active', - none = 'none', - error = 'error', -} - -export type VCDOrganization = { - id: string; - resourceStatus: ResourceStatus; - updatedAt: string; - currentState: { - apiUrl: string; - billingType: 'DEMO' | 'MONTHLY'; - description: string; - fullName: string; - name: string; - region: VCDRegion; - spla: boolean; - webInterfaceUrl: string; - }; - targetSpec: { - description: string; - fullName: string; - }; - currentTasks: Task[]; -}; - -export type VCDOrganizationWithBackupStatus = VCDOrganization & { - backupStatus?: BackupStatus; -}; - -export type VCDOrganizationWithIam = VCDOrganization & { iam: IamData }; diff --git a/packages/manager/apps/veeam-backup/src/pages/dashboard/Dashboard.page.tsx b/packages/manager/apps/veeam-backup/src/pages/dashboard/Dashboard.page.tsx index f9f327930a29..452fea9552ea 100644 --- a/packages/manager/apps/veeam-backup/src/pages/dashboard/Dashboard.page.tsx +++ b/packages/manager/apps/veeam-backup/src/pages/dashboard/Dashboard.page.tsx @@ -16,12 +16,12 @@ import { Region, } from '@ovh-ux/manager-react-components'; import { ODS_MESSAGE_TYPE, ODS_TEXT_SIZE } from '@ovhcloud/ods-components'; -import { Breadcrumb } from '@/components/Breadcrumb/Breadcrumb'; import { getRegionNameFromAzName, getVeeamBackupDisplayName, useVeeamBackup, -} from '@/data'; +} from '@ovh-ux/manager-module-vcd-api'; +import { Breadcrumb } from '@/components/Breadcrumb/Breadcrumb'; import { urls } from '@/routes/routes.constant'; import { SuccessMessages } from '@/components/Messages/SuccessMessage.component'; import { OrganizationCell } from '../listing/DatagridCell.component'; diff --git a/packages/manager/apps/veeam-backup/src/pages/dashboard/DisplayName.component.tsx b/packages/manager/apps/veeam-backup/src/pages/dashboard/DisplayName.component.tsx index 5fda7d92d26e..2edf1c95b612 100644 --- a/packages/manager/apps/veeam-backup/src/pages/dashboard/DisplayName.component.tsx +++ b/packages/manager/apps/veeam-backup/src/pages/dashboard/DisplayName.component.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { OsdsButton, OsdsIcon } from '@ovhcloud/ods-components/react'; import { useNavigate } from 'react-router-dom'; -import { Description, ManagerButton } from '@ovh-ux/manager-react-components'; +import { Description } from '@ovh-ux/manager-react-components'; import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; import { ODS_ICON_NAME, @@ -10,12 +10,13 @@ import { ODS_BUTTON_VARIANT, ODS_BUTTON_TYPE, } from '@ovhcloud/ods-components'; -import { VeeamBackupWithIam, getVeeamBackupDisplayName } from '@/data'; +import { + VeeamBackup, + getVeeamBackupDisplayName, +} from '@ovh-ux/manager-module-vcd-api'; import { urls } from '@/routes/routes.constant'; -export const DisplayNameWithEditButton = ( - backup: VeeamBackupWithIam, -): JSX.Element => { +export const DisplayNameWithEditButton = (backup: VeeamBackup): JSX.Element => { const navigate = useNavigate(); return (
diff --git a/packages/manager/apps/veeam-backup/src/pages/dashboard/OfferProgress.component.tsx b/packages/manager/apps/veeam-backup/src/pages/dashboard/OfferProgress.component.tsx index 4810ac5720c6..1eaafae6323e 100644 --- a/packages/manager/apps/veeam-backup/src/pages/dashboard/OfferProgress.component.tsx +++ b/packages/manager/apps/veeam-backup/src/pages/dashboard/OfferProgress.component.tsx @@ -15,7 +15,7 @@ import { ODS_TEXT_LEVEL, } from '@ovhcloud/ods-components'; import { useTranslation } from 'react-i18next'; -import { VeeamBackupOffer } from '@/data'; +import { VeeamBackupOffer } from '@ovh-ux/manager-module-vcd-api'; export const OfferProgress: React.FC = ({ name, diff --git a/packages/manager/apps/veeam-backup/src/pages/dashboard/SubscriptionTile.component.tsx b/packages/manager/apps/veeam-backup/src/pages/dashboard/SubscriptionTile.component.tsx index 03c29b517854..cf22492d3c6a 100644 --- a/packages/manager/apps/veeam-backup/src/pages/dashboard/SubscriptionTile.component.tsx +++ b/packages/manager/apps/veeam-backup/src/pages/dashboard/SubscriptionTile.component.tsx @@ -23,11 +23,11 @@ import { useFormattedDate, DateFormat, } from '@ovh-ux/manager-react-components'; -import { VeeamBackupWithIam } from '@/data'; +import { VeeamBackup } from '@ovh-ux/manager-module-vcd-api'; import { urls } from '@/routes/routes.constant'; import { LoadingChip } from '@/components/Loading/Loading'; -export const SubscriptionTile: React.FC = ({ +export const SubscriptionTile: React.FC = ({ id, createdAt, resourceStatus, diff --git a/packages/manager/apps/veeam-backup/src/pages/dashboard/dashboard.spec.tsx b/packages/manager/apps/veeam-backup/src/pages/dashboard/dashboard.spec.tsx index e6b746e66e85..27e802cb72dc 100644 --- a/packages/manager/apps/veeam-backup/src/pages/dashboard/dashboard.spec.tsx +++ b/packages/manager/apps/veeam-backup/src/pages/dashboard/dashboard.spec.tsx @@ -1,16 +1,14 @@ import { screen, waitFor } from '@testing-library/react'; import { ODS_ICON_NAME } from '@ovhcloud/ods-components'; import { - renderTest, - labels, - waitForOptions, - goToDashboard, + WAIT_FOR_DEFAULT_OPTIONS, getButtonByIcon, getButtonByLabel, -} from '@/test-helpers'; -import { backupList } from '@/../mocks/veeam-backup.mock'; -import '@testing-library/jest-dom'; +} from '@ovh-ux/manager-core-test-utils'; +import { backupList } from '@ovh-ux/manager-module-vcd-api'; +import { renderTest, labels, goToDashboard } from '@/test-helpers'; import { urls } from '@/routes/routes.constant'; +import '@testing-library/jest-dom'; describe('dashboard', () => { it('displays the dashboard page when clicking on the link', async () => { @@ -26,7 +24,7 @@ describe('dashboard', () => { ), ), ), - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, ); }); @@ -44,7 +42,7 @@ describe('dashboard', () => { ), ), ), - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, ); await getButtonByIcon({ diff --git a/packages/manager/apps/veeam-backup/src/pages/delete-veeam/DeleteVeeam.page.tsx b/packages/manager/apps/veeam-backup/src/pages/delete-veeam/DeleteVeeam.page.tsx index d1bbeb357b09..fcfcfd033833 100644 --- a/packages/manager/apps/veeam-backup/src/pages/delete-veeam/DeleteVeeam.page.tsx +++ b/packages/manager/apps/veeam-backup/src/pages/delete-veeam/DeleteVeeam.page.tsx @@ -9,8 +9,11 @@ import { useOvhTracking, } from '@ovh-ux/manager-react-shell-client'; import { DeleteServiceModal } from '@ovh-ux/manager-react-components'; +import { + getVeeamBackupDisplayName, + useVeeamBackup, +} from '@ovh-ux/manager-module-vcd-api'; import { MessagesContext } from '@/components/Messages/Messages.context'; -import { getVeeamBackupDisplayName, useVeeamBackup } from '@/data'; import { PageName } from '@/tracking.constant'; export const sharedTrackingParams: TrackingClickParams = { diff --git a/packages/manager/apps/veeam-backup/src/pages/delete-veeam/delete-veeam.spec.tsx b/packages/manager/apps/veeam-backup/src/pages/delete-veeam/delete-veeam.spec.tsx index 378a0d2ec375..13eb17ff38d4 100644 --- a/packages/manager/apps/veeam-backup/src/pages/delete-veeam/delete-veeam.spec.tsx +++ b/packages/manager/apps/veeam-backup/src/pages/delete-veeam/delete-veeam.spec.tsx @@ -1,13 +1,12 @@ import userEvents from '@testing-library/user-event'; import { screen, waitFor } from '@testing-library/react'; import { - renderTest, - labels, - checkModal, + assertModalVisibility, changeInputValue, getButtonByLabel, -} from '@/test-helpers'; -import { backupList } from '@/../mocks/veeam-backup.mock'; +} from '@ovh-ux/manager-core-test-utils'; +import { backupList } from '@ovh-ux/manager-module-vcd-api'; +import { renderTest, labels } from '@/test-helpers'; import { urls } from '@/routes/routes.constant'; import '@testing-library/jest-dom'; @@ -23,7 +22,7 @@ describe('Delete veeam-backup', () => { }); await waitFor(() => userEvents.click(deleteButton)); - await checkModal({ container, isVisible: true }); + await assertModalVisibility({ container, isVisible: true }); await changeInputValue({ inputLabel: 'delete-input', @@ -33,12 +32,12 @@ describe('Delete veeam-backup', () => { const confirmButton = await getButtonByLabel({ container, label: 'deleteModalDeleteButton', - altLabel: 'Supprimer', + altLabel: 'Résilier', }); await waitFor(() => userEvents.click(confirmButton)); - await checkModal({ container, isVisible: false }); + await assertModalVisibility({ container, isVisible: false }); expect( screen.getByText(labels.deleteVeeam.terminate_veeam_backup_success), diff --git a/packages/manager/apps/veeam-backup/src/pages/edit-name/EditVeeamBackupDisplayNameModal.page.tsx b/packages/manager/apps/veeam-backup/src/pages/edit-name/EditVeeamBackupDisplayNameModal.page.tsx index 0403c3a44abe..1aaccb8065bd 100644 --- a/packages/manager/apps/veeam-backup/src/pages/edit-name/EditVeeamBackupDisplayNameModal.page.tsx +++ b/packages/manager/apps/veeam-backup/src/pages/edit-name/EditVeeamBackupDisplayNameModal.page.tsx @@ -12,9 +12,9 @@ import { UpdateIamNameModal } from '@ovh-ux/manager-react-components'; import { useQueryClient } from '@tanstack/react-query'; import { veeamBackupListQueryKey, - veeamBackupQueryKey, + getVeeamBackupQueryKey, useVeeamBackup, -} from '@/data'; +} from '@ovh-ux/manager-module-vcd-api'; import { PageName } from '@/tracking.constant'; import { MessagesContext } from '@/components/Messages/Messages.context'; @@ -66,7 +66,7 @@ export default function EditVeeamBackupDisplayNameModal() { queryKey: veeamBackupListQueryKey, }); queryClient.invalidateQueries({ - queryKey: veeamBackupQueryKey(id), + queryKey: getVeeamBackupQueryKey(id), }); }, 2000); }} diff --git a/packages/manager/apps/veeam-backup/src/pages/edit-name/edit-name.spec.tsx b/packages/manager/apps/veeam-backup/src/pages/edit-name/edit-name.spec.tsx index 0cd5674f711e..5987af4e0b4a 100644 --- a/packages/manager/apps/veeam-backup/src/pages/edit-name/edit-name.spec.tsx +++ b/packages/manager/apps/veeam-backup/src/pages/edit-name/edit-name.spec.tsx @@ -2,14 +2,13 @@ import { ODS_ICON_NAME } from '@ovhcloud/ods-components'; import userEvents from '@testing-library/user-event'; import { screen, waitFor } from '@testing-library/react'; import { - renderTest, - labels, - checkModal, - waitForOptions, + assertModalVisibility, + WAIT_FOR_DEFAULT_OPTIONS, changeInputValue, getButtonByIcon, -} from '@/test-helpers'; -import { backupList } from '@/../mocks/veeam-backup.mock'; +} from '@ovh-ux/manager-core-test-utils'; +import { backupList } from '@ovh-ux/manager-module-vcd-api'; +import { renderTest, labels } from '@/test-helpers'; import { urls } from '@/routes/routes.constant'; import '@testing-library/jest-dom'; @@ -22,7 +21,7 @@ describe('Edit name', () => { await waitFor( () => expect(screen.getByText(labels.dashboard.delete_service)).toBeVisible(), - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, ); const editButton = await getButtonByIcon({ @@ -31,7 +30,7 @@ describe('Edit name', () => { }); await waitFor(() => userEvents.click(editButton)); - await checkModal({ container, isVisible: true }); + await assertModalVisibility({ container, isVisible: true }); await changeInputValue({ inputLabel: 'update-input', value: 'new name' }); @@ -42,7 +41,7 @@ describe('Edit name', () => { await waitFor(() => userEvents.click(modifyButton)); - await checkModal({ container, isVisible: false }); + await assertModalVisibility({ container, isVisible: false }); expect( screen.getByText(labels.common.update_veeam_backup_display_name_success), diff --git a/packages/manager/apps/veeam-backup/src/pages/listing/DatagridCell.component.tsx b/packages/manager/apps/veeam-backup/src/pages/listing/DatagridCell.component.tsx index 7212ccf38b12..e872c125f9ac 100644 --- a/packages/manager/apps/veeam-backup/src/pages/listing/DatagridCell.component.tsx +++ b/packages/manager/apps/veeam-backup/src/pages/listing/DatagridCell.component.tsx @@ -1,9 +1,5 @@ import React from 'react'; -import { - OsdsChip, - OsdsLink, - OsdsSkeleton, -} from '@ovhcloud/ods-components/react'; +import { OsdsLink, OsdsSkeleton } from '@ovhcloud/ods-components/react'; import { useNavigate } from 'react-router-dom'; import { ActionMenu, @@ -19,18 +15,17 @@ import { ShellContext } from '@ovh-ux/manager-react-shell-client'; import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; import { ODS_BUTTON_VARIANT, ODS_ICON_NAME } from '@ovhcloud/ods-components'; import { - VeeamBackupWithIam, + VeeamBackup, getOrganizationDisplayName, getOrganizationIdFromBackup, useOrganization, - ResourceStatus, getVeeamBackupDisplayName, getRegionNameFromAzName, -} from '@/data'; +} from '@ovh-ux/manager-module-vcd-api'; import { vcdOrganizationAppName } from '@/veeam-backup.config'; import { urls } from '@/routes/routes.constant'; -export const DisplayNameCell = (backup: VeeamBackupWithIam): JSX.Element => { +export const DisplayNameCell = (backup: VeeamBackup): JSX.Element => { const navigate = useNavigate(); return ( @@ -44,7 +39,7 @@ export const DisplayNameCell = (backup: VeeamBackupWithIam): JSX.Element => { ); }; -export const OvhRefCell = ({ id }: VeeamBackupWithIam) => ( +export const OvhRefCell = ({ id }: VeeamBackup) => ( {id} ); @@ -52,7 +47,7 @@ export const OrganizationCell = ({ withLink, className, ...backup -}: VeeamBackupWithIam & { +}: VeeamBackup & { className?: string; withLink?: boolean; }): JSX.Element => { @@ -86,25 +81,19 @@ export const OrganizationCell = ({ ); }; -export const RegionCell = ({ - currentState, -}: VeeamBackupWithIam): JSX.Element => ( +export const RegionCell = ({ currentState }: VeeamBackup): JSX.Element => ( {getRegionNameFromAzName(currentState.azName)} ); -export const LocationCell = ({ - currentState, -}: VeeamBackupWithIam): JSX.Element => ( +export const LocationCell = ({ currentState }: VeeamBackup): JSX.Element => ( ); -export const CreatedAtCell = ({ - createdAt, -}: VeeamBackupWithIam): JSX.Element => { +export const CreatedAtCell = ({ createdAt }: VeeamBackup): JSX.Element => { const date = useFormattedDate({ dateString: createdAt, format: DateFormat.compact, @@ -112,7 +101,7 @@ export const CreatedAtCell = ({ return {date}; }; -export const ActionCell = (backup: VeeamBackupWithIam): JSX.Element => { +export const ActionCell = (backup: VeeamBackup): JSX.Element => { const { t } = useTranslation('listing'); const navigate = useNavigate(); diff --git a/packages/manager/apps/veeam-backup/src/pages/listing/Listing.page.tsx b/packages/manager/apps/veeam-backup/src/pages/listing/Listing.page.tsx index bb50c1e9d3e1..bbabe16c542d 100644 --- a/packages/manager/apps/veeam-backup/src/pages/listing/Listing.page.tsx +++ b/packages/manager/apps/veeam-backup/src/pages/listing/Listing.page.tsx @@ -10,11 +10,14 @@ import { DatagridColumn, RedirectionGuard, } from '@ovh-ux/manager-react-components'; +import { + VeeamBackup, + useVeeamBackupList, +} from '@ovh-ux/manager-module-vcd-api'; import ErrorBanner from '@/components/Error/Error'; import { Breadcrumb } from '@/components/Breadcrumb/Breadcrumb'; import { urls } from '@/routes/routes.constant'; import { SuccessMessages } from '@/components/Messages/SuccessMessage.component'; -import { VeeamBackupWithIam, useVeeamBackupList } from '@/data'; import { DisplayNameCell, ActionCell, @@ -42,7 +45,7 @@ export default function Listing() { status, } = useVeeamBackupList({ pageSize: 10 }); - const columns: DatagridColumn[] = [ + const columns: DatagridColumn[] = [ { id: 'name', label: t('name_cell'), diff --git a/packages/manager/apps/veeam-backup/src/pages/listing/listing.spec.tsx b/packages/manager/apps/veeam-backup/src/pages/listing/listing.spec.tsx index e1c764233238..848abe8751cc 100644 --- a/packages/manager/apps/veeam-backup/src/pages/listing/listing.spec.tsx +++ b/packages/manager/apps/veeam-backup/src/pages/listing/listing.spec.tsx @@ -1,10 +1,9 @@ import { screen, waitFor } from '@testing-library/react'; import { - renderTest, - labels, - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, getButtonByLabel, -} from '@/test-helpers'; +} from '@ovh-ux/manager-core-test-utils'; +import { renderTest, labels } from '@/test-helpers'; import '@testing-library/jest-dom'; describe('listing', () => { @@ -12,7 +11,7 @@ describe('listing', () => { await renderTest(); await waitFor( () => expect(screen.getByText(labels.listing.description)).toBeVisible(), - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, ); }); diff --git a/packages/manager/apps/veeam-backup/src/pages/onboarding/Onboarding.page.tsx b/packages/manager/apps/veeam-backup/src/pages/onboarding/Onboarding.page.tsx index 6723667529b1..9d7d1aea784c 100644 --- a/packages/manager/apps/veeam-backup/src/pages/onboarding/Onboarding.page.tsx +++ b/packages/manager/apps/veeam-backup/src/pages/onboarding/Onboarding.page.tsx @@ -9,12 +9,12 @@ import { useNavigate } from 'react-router-dom'; import { OsdsMessage } from '@ovhcloud/ods-components/react'; import { ODS_MESSAGE_TYPE } from '@ovhcloud/ods-components'; import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; +import { useOrganizationList } from '@ovh-ux/manager-module-vcd-api'; import { useGuideUtils } from './useGuideUtils'; import onboardingImgSrc from '@/assets/veeamxOVHcloud.svg'; import { urls } from '@/routes/routes.constant'; import { useBillingUrl } from '@/components/Links/BillingLink.component'; import { productFullName } from '@/veeam-backup.config'; -import { useOrganizationList } from '@/data'; import { NoOrganizationMessage } from '@/components/NoOrganizationMessage/NoOrganizationMessage.component'; import { Loading } from '@/components/Loading/Loading'; diff --git a/packages/manager/apps/veeam-backup/src/pages/onboarding/onboarding.spec.tsx b/packages/manager/apps/veeam-backup/src/pages/onboarding/onboarding.spec.tsx index 5d4540194bd9..f99b54733228 100644 --- a/packages/manager/apps/veeam-backup/src/pages/onboarding/onboarding.spec.tsx +++ b/packages/manager/apps/veeam-backup/src/pages/onboarding/onboarding.spec.tsx @@ -1,5 +1,6 @@ import { screen, waitFor } from '@testing-library/react'; -import { renderTest, labels, waitForOptions } from '../../test-helpers'; +import { WAIT_FOR_DEFAULT_OPTIONS } from '@ovh-ux/manager-core-test-utils'; +import { renderTest, labels } from '@/test-helpers'; import '@testing-library/jest-dom'; describe('onboarding', () => { @@ -8,7 +9,7 @@ describe('onboarding', () => { await waitFor( () => expect(screen.getByText(labels.onboarding.description)).toBeVisible(), - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, ); expect( @@ -19,7 +20,7 @@ describe('onboarding', () => { expect( screen.getByText(labels.onboarding.order_button_label), ).toBeEnabled(), - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, ); }); @@ -27,7 +28,7 @@ describe('onboarding', () => { await renderTest({ nbBackup: 1 }); await waitFor( () => expect(screen.getByText(labels.listing.description)).toBeVisible(), - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, ); expect( screen.queryByText(labels.onboarding.description), @@ -41,7 +42,7 @@ describe('onboarding', () => { expect( screen.getByText(labels.onboarding.order_button_label), ).toBeDisabled(), - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, ); await waitFor( () => @@ -50,7 +51,7 @@ describe('onboarding', () => { exact: false, }), ).toBeVisible(), - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, ); }); }); diff --git a/packages/manager/apps/veeam-backup/src/pages/order-veeam/OrderVeeam.page.tsx b/packages/manager/apps/veeam-backup/src/pages/order-veeam/OrderVeeam.page.tsx index 47b649cd5df6..51a04c91ac97 100644 --- a/packages/manager/apps/veeam-backup/src/pages/order-veeam/OrderVeeam.page.tsx +++ b/packages/manager/apps/veeam-backup/src/pages/order-veeam/OrderVeeam.page.tsx @@ -29,11 +29,11 @@ import { ODS_TEXT_SIZE, ODS_MESSAGE_TYPE, } from '@ovhcloud/ods-components'; +import { useVeeamBackupVmConsumptionPricing } from '@ovh-ux/manager-module-vcd-api'; import { BillingLink } from '@/components/Links/BillingLink.component'; import { Breadcrumb } from '@/components/Breadcrumb/Breadcrumb'; import { OrderVeeamStep2 } from './OrderVeeamStep2.component'; import { productName } from '@/veeam-backup.config'; -import { useVeeamBackupVmConsumptionPricing } from '@/data'; import { Loading } from '@/components/Loading/Loading'; export default function OrderVeeamPage() { @@ -96,7 +96,7 @@ export default function OrderVeeamPage() { value={pricing?.price || 0} tax={pricing?.tax} intervalUnit={ - (pricing?.intervalUnit as any) as IntervalUnitType + (pricing?.intervalUnit as unknown) as IntervalUnitType } locale={i18nextLocaleToOvh(i18n.language)} ovhSubsidiary={ diff --git a/packages/manager/apps/veeam-backup/src/pages/order-veeam/OrderVeeamStep2.component.tsx b/packages/manager/apps/veeam-backup/src/pages/order-veeam/OrderVeeamStep2.component.tsx index e9dd04e8122d..deb0de663a33 100644 --- a/packages/manager/apps/veeam-backup/src/pages/order-veeam/OrderVeeamStep2.component.tsx +++ b/packages/manager/apps/veeam-backup/src/pages/order-veeam/OrderVeeamStep2.component.tsx @@ -22,7 +22,6 @@ import { getVeeamBackupProductSettings, useOrderURL, } from '@ovh-ux/manager-module-order'; -import { urls } from '@/routes/routes.constant'; import { BackupStatus, VCDOrganization, @@ -30,7 +29,8 @@ import { getAvailabilityZone, getOrganizationUuid, useOrganizationWithBackupStatusList, -} from '@/data'; +} from '@ovh-ux/manager-module-vcd-api'; +import { urls } from '@/routes/routes.constant'; import { Loading } from '@/components/Loading/Loading'; import { BackupStatusCell, diff --git a/packages/manager/apps/veeam-backup/src/pages/order-veeam/VCDOrganiationDatagridCell.component.tsx b/packages/manager/apps/veeam-backup/src/pages/order-veeam/VCDOrganiationDatagridCell.component.tsx index 3ca6b8079567..e5c88d202ff2 100644 --- a/packages/manager/apps/veeam-backup/src/pages/order-veeam/VCDOrganiationDatagridCell.component.tsx +++ b/packages/manager/apps/veeam-backup/src/pages/order-veeam/VCDOrganiationDatagridCell.component.tsx @@ -7,7 +7,7 @@ import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; import { VCDOrganizationWithBackupStatus, getOrganizationDisplayName, -} from '@/data'; +} from '@ovh-ux/manager-module-vcd-api'; const colorByStatus = { active: ODS_THEME_COLOR_INTENT.success, diff --git a/packages/manager/apps/veeam-backup/src/pages/order-veeam/order-veeam.spec.tsx b/packages/manager/apps/veeam-backup/src/pages/order-veeam/order-veeam.spec.tsx index 9de16a7a3679..c75eec11fbc5 100644 --- a/packages/manager/apps/veeam-backup/src/pages/order-veeam/order-veeam.spec.tsx +++ b/packages/manager/apps/veeam-backup/src/pages/order-veeam/order-veeam.spec.tsx @@ -1,11 +1,10 @@ import userEvent from '@testing-library/user-event'; import { screen, waitFor } from '@testing-library/react'; import { - renderTest, - labels, - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, getButtonByLabel, -} from '@/test-helpers'; +} from '@ovh-ux/manager-core-test-utils'; +import { renderTest, labels } from '@/test-helpers'; import { urls } from '@/routes/routes.constant'; import '@testing-library/jest-dom'; @@ -18,7 +17,7 @@ describe('order', () => { await waitFor(() => { orderButton = screen.getByText(labels.listing.order_button); return expect(orderButton).toBeEnabled(); - }, waitForOptions); + }, WAIT_FOR_DEFAULT_OPTIONS); await waitFor(() => userEvent.click(orderButton)); @@ -27,7 +26,7 @@ describe('order', () => { expect( screen.getByText(labels.orderVeeam.description), ).toBeInTheDocument(), - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, ); }); @@ -51,7 +50,7 @@ describe('order', () => { { exact: false }, ), ).toBeInTheDocument(), - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, ); }); @@ -63,7 +62,7 @@ describe('order', () => { expect( screen.getByText(labels.orderVeeam.description), ).toBeInTheDocument(), - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, ); const nextButton = await getButtonByLabel({ @@ -77,7 +76,7 @@ describe('order', () => { expect( screen.getByText(labels.orderVeeam.choose_org_title), ).toBeInTheDocument(), - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, ); }); @@ -92,7 +91,7 @@ describe('order', () => { expect( screen.getByText(labels.orderVeeam.description), ).toBeInTheDocument(), - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, ); const nextButton = await getButtonByLabel({ @@ -108,7 +107,7 @@ describe('order', () => { labels.orderVeeam.all_organization_backed_up_message, ), ).toBeInTheDocument(), - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, ); }); @@ -123,7 +122,7 @@ describe('order', () => { expect( screen.getByText(labels.orderVeeam.description), ).toBeInTheDocument(), - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, ); const nextButton = await getButtonByLabel({ @@ -139,7 +138,7 @@ describe('order', () => { exact: false, }), ).toBeInTheDocument(), - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, ); }); }); diff --git a/packages/manager/apps/veeam-backup/src/test-helpers/index.ts b/packages/manager/apps/veeam-backup/src/test-helpers/index.ts index cb0d47c9672c..c3ed98560ff7 100644 --- a/packages/manager/apps/veeam-backup/src/test-helpers/index.ts +++ b/packages/manager/apps/veeam-backup/src/test-helpers/index.ts @@ -1,3 +1,3 @@ export { renderTest } from './render-test'; -export { labels } from './test-i18n'; +export { labels } from './labels'; export * from './test-utils'; diff --git a/packages/manager/apps/veeam-backup/src/test-helpers/labels.ts b/packages/manager/apps/veeam-backup/src/test-helpers/labels.ts new file mode 100644 index 000000000000..7580b1f06d72 --- /dev/null +++ b/packages/manager/apps/veeam-backup/src/test-helpers/labels.ts @@ -0,0 +1,37 @@ +import common from '../../public/translations/veeam-backup/Messages_fr_FR.json'; +import orderVeeam from '../../public/translations/order-veeam/Messages_fr_FR.json'; +import listing from '../../public/translations/listing/Messages_fr_FR.json'; +import dashboard from '../../public/translations/dashboard/Messages_fr_FR.json'; +import deleteVeeam from '../../public/translations/delete-veeam/Messages_fr_FR.json'; +import onboarding from '../../public/translations/onboarding/Messages_fr_FR.json'; +import { appName } from '../veeam-backup.config'; + +const error = { + manager_error_page_title: 'Oops …!', + manager_error_page_button_cancel: 'Annuler', + manager_error_page_detail_code: "Code d'erreur : ", + manager_error_page_action_reload_label: 'Réessayer', + manager_error_page_action_home_label: "Retour à la page d'accueil", + manager_error_page_default: + 'Une erreur est survenue lors du chargement de la page.', +}; + +export const translations = { + [appName]: common, + 'order-veeam': orderVeeam, + listing, + dashboard, + onboarding, + 'delete-veeam': deleteVeeam, + error, +}; + +export const labels = { + common, + onboarding, + orderVeeam, + dashboard, + deleteVeeam, + listing, + error, +}; diff --git a/packages/manager/apps/veeam-backup/src/test-helpers/render-test.tsx b/packages/manager/apps/veeam-backup/src/test-helpers/render-test.tsx index c8cdbe7f5aea..aa346f41d5a1 100644 --- a/packages/manager/apps/veeam-backup/src/test-helpers/render-test.tsx +++ b/packages/manager/apps/veeam-backup/src/test-helpers/render-test.tsx @@ -11,20 +11,23 @@ import { render, waitFor, screen } from '@testing-library/react'; import { getServicesMocks, GetServicesMocksParams, -} from '@ovh-ux/manager-react-components'; -import { toMswHandlers } from '../../../../../../playwright-helpers'; -import { getAuthenticationMocks } from '../../../../../../playwright-helpers/mocks/auth'; +} from '@ovh-ux/manager-module-common-api'; import { - getVeeamBackupMocks, getOrganizationMocks, GetOrganizationMocksParams, + getVeeamBackupMocks, GetVeeamBackupMocksParams, - getIamMocks, getCatalogMocks, GetCatalogMocksParams, -} from '../../mocks'; -import { productName } from '../veeam-backup.config'; -import { initTestI18n } from './test-i18n'; +} from '@ovh-ux/manager-module-vcd-api'; +import { + initTestI18n, + toMswHandlers, + getAuthenticationMocks, +} from '@ovh-ux/manager-core-test-utils'; +import { getIamMocks } from '../../mocks'; +import { appName, productName } from '../veeam-backup.config'; +import { translations } from './labels'; import { TestApp } from './TestApp'; let context: ShellContextType; @@ -53,7 +56,7 @@ export const renderTest = async ({ } if (!i18n) { - i18n = await initTestI18n(); + i18n = await initTestI18n(appName, translations); } const result = render( diff --git a/packages/manager/apps/veeam-backup/src/test-helpers/test-i18n.ts b/packages/manager/apps/veeam-backup/src/test-helpers/test-i18n.ts deleted file mode 100644 index 2039f7406bff..000000000000 --- a/packages/manager/apps/veeam-backup/src/test-helpers/test-i18n.ts +++ /dev/null @@ -1,70 +0,0 @@ -import i18next, { i18n } from 'i18next'; -import common from '../../public/translations/veeam-backup/Messages_fr_FR.json'; -import orderVeeam from '../../public/translations/order-veeam/Messages_fr_FR.json'; -import listing from '../../public/translations/listing/Messages_fr_FR.json'; -import dashboard from '../../public/translations/dashboard/Messages_fr_FR.json'; -import deleteVeeam from '../../public/translations/delete-veeam/Messages_fr_FR.json'; -import onboarding from '../../public/translations/onboarding/Messages_fr_FR.json'; -import { appName } from '../../src/veeam-backup.config'; - -export const defaultLocale = 'fr_FR'; -export const defaultAvailableLocales = [defaultLocale]; -const error = { - manager_error_page_title: 'Oops …!', - manager_error_page_button_cancel: 'Annuler', - manager_error_page_detail_code: "Code d'erreur : ", - manager_error_page_action_reload_label: 'Réessayer', - manager_error_page_action_home_label: "Retour à la page d'accueil", - manager_error_page_default: - 'Une erreur est survenue lors du chargement de la page.', -}; - -function addTranslations() { - i18next - .addResources(defaultLocale, appName, common) - .addResources(defaultLocale, 'order-veeam', orderVeeam) - .addResources(defaultLocale, 'listing', listing) - .addResources(defaultLocale, 'dashboard', dashboard) - .addResources(defaultLocale, 'onboarding', onboarding) - .addResources(defaultLocale, 'delete-veeam', deleteVeeam) - .addResources(defaultLocale, 'error', error) - .use({ - type: 'postProcessor', - name: 'normalize', - process: (value: string) => - value ? value.replace(/&/g, '&') : value, - }); -} - -export const initTestI18n = () => - new Promise((resolve) => { - i18next.init({ - lng: defaultLocale, - defaultNS: appName, - ns: [], - supportedLngs: defaultAvailableLocales, - postProcess: 'normalize', - interpolation: { - escapeValue: false, - }, - }); - - if (i18next.isInitialized) { - addTranslations(); - } else { - i18next.on('initialized', () => { - addTranslations(); - resolve(i18next); - }); - } - }); - -export const labels = { - common, - onboarding, - orderVeeam, - dashboard, - deleteVeeam, - listing, - error, -}; diff --git a/packages/manager/apps/veeam-backup/src/test-helpers/test-utils.ts b/packages/manager/apps/veeam-backup/src/test-helpers/test-utils.ts index 5458016f2f40..3e92025c1c04 100644 --- a/packages/manager/apps/veeam-backup/src/test-helpers/test-utils.ts +++ b/packages/manager/apps/veeam-backup/src/test-helpers/test-utils.ts @@ -1,96 +1,7 @@ -import { ODS_ICON_NAME } from '@ovhcloud/ods-components'; -import { screen, waitFor, fireEvent } from '@testing-library/react'; +import { screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { labels } from './test-i18n'; - -export const waitForOptions = { - timeout: 30_000, -}; - -export const checkModal = async ({ - container, - isVisible, -}: { - container: HTMLElement; - isVisible: boolean; -}) => - waitFor(() => { - const modal = container.querySelector('osds-modal'); - return isVisible - ? expect(modal).toBeInTheDocument() - : expect(modal).not.toBeInTheDocument(); - }, waitForOptions); - -export const getButtonByLabel = async ({ - container, - label, - altLabel, - disabled, -}: { - container: HTMLElement; - label: string; - altLabel?: string; - disabled?: boolean; -}) => { - let button: HTMLElement; - await waitFor(() => { - const buttonList = container.querySelectorAll('osds-button'); - buttonList.forEach((btn) => { - if ([label, altLabel].includes(btn.textContent)) { - button = btn; - } - }); - return disabled - ? expect(button).toHaveAttribute('disabled') - : expect(button).not.toHaveAttribute('disabled'); - }, waitForOptions); - return button; -}; - -export const getButtonByIcon = async ({ - container, - iconName, - disabled, -}: { - container: HTMLElement; - iconName: ODS_ICON_NAME; - disabled?: boolean; -}) => { - let button: HTMLElement; - await waitFor(() => { - button = container.querySelector(`osds-icon[name="${iconName}"]`) - ?.parentElement; - return disabled - ? expect(button).toHaveAttribute('disabled') - : expect(button).not.toHaveAttribute('disabled'); - }, waitForOptions); - return button; -}; - -export const getButtonByTestId = async (testId: string, disabled?: boolean) => { - let button: HTMLElement; - await waitFor(() => { - button = screen.getByTestId(testId); - return disabled - ? expect(button).toHaveAttribute('disabled') - : expect(button).not.toHaveAttribute('disabled'); - }, waitForOptions); - return button; -}; - -export const changeInputValue = async ({ - inputLabel, - value, -}: { - inputLabel: string; - value: string; -}) => { - const input = screen.getByLabelText(inputLabel); - const event = new CustomEvent('odsValueChange', { - detail: { value }, - }); - return waitFor(() => fireEvent(input, event)); -}; +import { WAIT_FOR_DEFAULT_OPTIONS } from '@ovh-ux/manager-core-test-utils'; +import { labels } from './labels'; export const goToDashboard = async (name: string) => { await waitFor(() => { @@ -99,6 +10,6 @@ export const goToDashboard = async (name: string) => { await waitFor( () => expect(screen.getByText(labels.dashboard.general_informations)), - waitForOptions, + WAIT_FOR_DEFAULT_OPTIONS, ); }; diff --git a/packages/manager/apps/veeam-backup/tsconfig.test.json b/packages/manager/apps/veeam-backup/tsconfig.test.json deleted file mode 100644 index 7048c297c8f6..000000000000 --- a/packages/manager/apps/veeam-backup/tsconfig.test.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "CommonJS" - } -} diff --git a/packages/manager/apps/veeam-backup/vitest.config.js b/packages/manager/apps/veeam-backup/vitest.config.js index c4fe9a0e465c..5bc8c725e9b5 100644 --- a/packages/manager/apps/veeam-backup/vitest.config.js +++ b/packages/manager/apps/veeam-backup/vitest.config.js @@ -8,7 +8,7 @@ export default defineConfig({ test: { globals: true, environment: 'jsdom', - setupFiles: ['./setup-test.tsx'], + setupFiles: ['@ovh-ux/manager-core-test-utils/setup-file-msw-ods17.tsx'], coverage: { include: ['src'], exclude: [ diff --git a/packages/manager/core/test-utils/package.json b/packages/manager/core/test-utils/package.json index 2c8447145cf3..ec67fb265961 100644 --- a/packages/manager/core/test-utils/package.json +++ b/packages/manager/core/test-utils/package.json @@ -30,7 +30,7 @@ "vitest": "^2.1.4" }, "peerDependencies": { - "@ovh-ux/manager-core-api": "^0.9.0", + "@ovh-ux/manager-core-api": "^0.10.0", "@ovhcloud/ods-common-core": "17.x", "@ovhcloud/ods-components": "17.x", "@tanstack/react-query": "5.x", diff --git a/packages/manager/modules/vcd-api/.gitignore b/packages/manager/modules/vcd-api/.gitignore new file mode 100644 index 000000000000..4ebc8aea50e0 --- /dev/null +++ b/packages/manager/modules/vcd-api/.gitignore @@ -0,0 +1 @@ +coverage diff --git a/packages/manager/modules/vcd-api/CHANGELOG.md b/packages/manager/modules/vcd-api/CHANGELOG.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/manager/modules/vcd-api/package.json b/packages/manager/modules/vcd-api/package.json new file mode 100644 index 000000000000..0e7ddc204ce6 --- /dev/null +++ b/packages/manager/modules/vcd-api/package.json @@ -0,0 +1,46 @@ +{ + "name": "@ovh-ux/manager-module-vcd-api", + "version": "0.1.0", + "private": true, + "description": "OVHcloud manager module VCD API.", + "repository": { + "type": "git", + "url": "git+https://github.com/ovh/manager.git", + "directory": "packages/manager/modules/vcd-api" + }, + "license": "BSD-3-Clause", + "author": "OVH SAS", + "sideEffects": false, + "main": "./dist/index.js", + "module": "./dist/index.js", + "types": "./dist/types/index.d.ts", + "files": [ + "dist" + ], + "scripts": { + "build": "tsc", + "dev": "tsc", + "start:watch": "tsc -w", + "test": "vitest run", + "test:coverage": "vitest run --coverage" + }, + "dependencies": { + "@ovh-ux/manager-core-api": "^0.9.0", + "@ovh-ux/manager-module-order": "^0.9.1", + "@ovh-ux/manager-react-components": "^1.43.0", + "@ovh-ux/manager-react-shell-client": "^0.8.3" + }, + "devDependencies": { + "@ovh-ux/manager-core-test-utils": "^0.2.0", + "@vitejs/plugin-react": "^4.3.3", + "@vitest/coverage-v8": "^2.1.4", + "msw": "2.1.7", + "typescript": "^5.1.6", + "vite": "^5.2.13", + "vitest": "^2.1.4" + }, + "peerDependencies": { + "@tanstack/react-query": "5.x", + "react": "18.x" + } +} diff --git a/packages/manager/apps/veeam-backup/src/data/api/catalog.ts b/packages/manager/modules/vcd-api/src/api/catalog.ts similarity index 51% rename from packages/manager/apps/veeam-backup/src/data/api/catalog.ts rename to packages/manager/modules/vcd-api/src/api/catalog.ts index e5253ceef31d..68cb0d96a7dc 100644 --- a/packages/manager/apps/veeam-backup/src/data/api/catalog.ts +++ b/packages/manager/modules/vcd-api/src/api/catalog.ts @@ -1,5 +1,6 @@ import { ApiResponse, apiClient } from '@ovh-ux/manager-core-api'; -import { order } from '../catalog.type'; +import { order } from '../types/veeam-backup-catalog.type'; +import { VCDCatalog } from '../types'; export const getVeeamBackupCatalog = async ( ovhSubsidiray: string, @@ -7,3 +8,10 @@ export const getVeeamBackupCatalog = async ( apiClient.v6.get( `/order/catalog/public/vmwareCloudDirectorBackup?ovhSubsidiary=${ovhSubsidiray}`, ); + +export const getVcdCatalog = async ( + serviceName: string, +): Promise> => + apiClient.v6.get( + `/order/cartServiceOption/vmwareCloudDirector/${serviceName}`, + ); diff --git a/packages/manager/apps/veeam-backup/src/data/api/index.ts b/packages/manager/modules/vcd-api/src/api/index.ts similarity index 56% rename from packages/manager/apps/veeam-backup/src/data/api/index.ts rename to packages/manager/modules/vcd-api/src/api/index.ts index 341a02e548a5..45d99ad8b914 100644 --- a/packages/manager/apps/veeam-backup/src/data/api/index.ts +++ b/packages/manager/modules/vcd-api/src/api/index.ts @@ -1,3 +1,5 @@ -export * from './veeam-backup'; -export * from './vcd-organization'; export * from './catalog'; +export * from './vcd-datacentre'; +export * from './vcd-organization'; +export * from './vcd-reset-password'; +export * from './veeam-backup'; diff --git a/packages/manager/modules/vcd-api/src/api/vcd-datacentre.ts b/packages/manager/modules/vcd-api/src/api/vcd-datacentre.ts new file mode 100644 index 000000000000..cd317a14f536 --- /dev/null +++ b/packages/manager/modules/vcd-api/src/api/vcd-datacentre.ts @@ -0,0 +1,43 @@ +import { ApiResponse, apiClient } from '@ovh-ux/manager-core-api'; +import { + VCDDatacentre, + VCDDatacentreTargetSpec, + VCDOrderableResourceData, +} from '../types'; +import { + getVcdDatacentreRoute, + getVcdDatacentresRoute, + getVdcOrderableResourceRoute, +} from '../utils/apiRoutes'; + +export type UpdateVdcDetailsParams = { + id: string; + vdcId: string; + details: VCDDatacentreTargetSpec; +}; + +export const getVcdDatacentre = async ( + id: string, + vdcId: string, +): Promise> => + apiClient.v2.get(getVcdDatacentreRoute(id, vdcId)); + +export const getVcdDatacentres = async ( + id: string, +): Promise> => + apiClient.v2.get(getVcdDatacentresRoute(id)); + +export const updateVdcDetails = async ({ + id, + vdcId, + details, +}: UpdateVdcDetailsParams) => + apiClient.v2.put(getVcdDatacentreRoute(id, vdcId), { + targetSpec: details, + }); + +export const getVdcOrderableResource = async ( + id: string, + vdcId: string, +): Promise> => + apiClient.v2.get(getVdcOrderableResourceRoute(id, vdcId)); diff --git a/packages/manager/modules/vcd-api/src/api/vcd-organization.ts b/packages/manager/modules/vcd-api/src/api/vcd-organization.ts new file mode 100644 index 000000000000..f89cae480988 --- /dev/null +++ b/packages/manager/modules/vcd-api/src/api/vcd-organization.ts @@ -0,0 +1,21 @@ +import { ApiResponse, apiClient } from '@ovh-ux/manager-core-api'; +import { VCDOrganization, VCDOrganizationTargetSpec } from '../types'; +import { getVcdOrganizationRoute } from '../utils/apiRoutes'; + +export type UpdateVcdOrganizationDetailsParams = { + id: string; + details: VCDOrganizationTargetSpec; +}; + +export const getVcdOrganization = async ( + organizationId: string, +): Promise> => + apiClient.v2.get(getVcdOrganizationRoute(organizationId)); + +export const updateVcdOrganizationDetails = async ({ + id, + details, +}: UpdateVcdOrganizationDetailsParams): Promise> => + apiClient.v2.put(getVcdOrganizationRoute(id), { + targetSpec: details, + }); diff --git a/packages/manager/modules/vcd-api/src/api/vcd-reset-password.ts b/packages/manager/modules/vcd-api/src/api/vcd-reset-password.ts new file mode 100644 index 000000000000..84d236a4d59a --- /dev/null +++ b/packages/manager/modules/vcd-api/src/api/vcd-reset-password.ts @@ -0,0 +1,7 @@ +import { apiClient, ApiResponse } from '@ovh-ux/manager-core-api'; +import { getVcdResetPasswordRoute } from '../utils/apiRoutes'; + +export const resetOrganizationPassword = ( + id: string, +): Promise> => + apiClient.v2.post(getVcdResetPasswordRoute(id)); diff --git a/packages/manager/apps/veeam-backup/src/data/api/veeam-backup.ts b/packages/manager/modules/vcd-api/src/api/veeam-backup.ts similarity index 67% rename from packages/manager/apps/veeam-backup/src/data/api/veeam-backup.ts rename to packages/manager/modules/vcd-api/src/api/veeam-backup.ts index ac5b6c7c56f6..6a3f0995a53f 100644 --- a/packages/manager/apps/veeam-backup/src/data/api/veeam-backup.ts +++ b/packages/manager/modules/vcd-api/src/api/veeam-backup.ts @@ -1,7 +1,7 @@ import { ApiResponse, apiClient } from '@ovh-ux/manager-core-api'; -import { VeeamBackupWithIam } from '../vcd.type'; +import { VeeamBackup } from '../types'; export const getVmwareCloudDirectorBackup = async ( backupId: string, -): Promise> => +): Promise> => apiClient.v2.get(`/vmwareCloudDirector/backup/${backupId}`); diff --git a/packages/manager/modules/vcd-api/src/hook/index.ts b/packages/manager/modules/vcd-api/src/hook/index.ts new file mode 100644 index 000000000000..1e6151686ff8 --- /dev/null +++ b/packages/manager/modules/vcd-api/src/hook/index.ts @@ -0,0 +1,10 @@ +export * from './useOrderableResource'; +export * from './useResetVcdPassword'; +export * from './useUpdateVcdDatacentre'; +export * from './useUpdateVcdOrganization'; +export * from './useVcdCatalog'; +export * from './useVcdDatacentre'; +export * from './useVcdOrder'; +export * from './useVcdOrganization'; +export * from './useVeeamBackup'; +export * from './useVeeamBackupCatalog'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useOrderableResource.ts b/packages/manager/modules/vcd-api/src/hook/useOrderableResource.ts similarity index 53% rename from packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useOrderableResource.ts rename to packages/manager/modules/vcd-api/src/hook/useOrderableResource.ts index 5b885ff5902f..1298b3e2fe99 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useOrderableResource.ts +++ b/packages/manager/modules/vcd-api/src/hook/useOrderableResource.ts @@ -1,11 +1,11 @@ import { ApiResponse, ApiError } from '@ovh-ux/manager-core-api'; import { useQuery, keepPreviousData } from '@tanstack/react-query'; -import { IVdcOrderableResourceData } from '@/types/vcd-vdc-orderable-resource.interface'; -import { getVdcOrderableResource } from '../api/hpc-vmware-managed-vcd-datacentre'; -import { getVdcOrderableResourceQueryKey } from '@/utils/queryKeys'; +import { VCDOrderableResourceData } from '../types'; +import { getVdcOrderableResourceQueryKey } from '../utils'; +import { getVdcOrderableResource } from '../api'; export const useVdcOrderableResource = (id: string, vdcId: string) => { - return useQuery, ApiError>({ + return useQuery, ApiError>({ queryKey: getVdcOrderableResourceQueryKey(vdcId), queryFn: () => getVdcOrderableResource(id, vdcId), placeholderData: keepPreviousData, diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useResetPassword.ts b/packages/manager/modules/vcd-api/src/hook/useResetVcdPassword.ts similarity index 67% rename from packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useResetPassword.ts rename to packages/manager/modules/vcd-api/src/hook/useResetVcdPassword.ts index db118380b031..d0ac417d0319 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useResetPassword.ts +++ b/packages/manager/modules/vcd-api/src/hook/useResetVcdPassword.ts @@ -1,9 +1,9 @@ import { useMutation, UseMutationOptions } from '@tanstack/react-query'; import { ApiError, ApiResponse } from '@ovh-ux/manager-core-api'; -import { resetOrganizationPassword } from '../api/hpc-vmware-managed-vcd-reset-password'; -import { getVcdOrganizationResetPasswordQueryKey } from '@/utils/queryKeys'; +import { getVcdOrganizationResetPasswordQueryKey } from '../utils'; +import { resetOrganizationPassword } from '../api'; -export const useResetPassword = ( +export const useResetVcdPassword = ( { id }: { id: string }, options?: Partial< UseMutationOptions, ApiError, void, unknown> diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useUpdateVcdDatacentre.ts b/packages/manager/modules/vcd-api/src/hook/useUpdateVcdDatacentre.ts similarity index 79% rename from packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useUpdateVcdDatacentre.ts rename to packages/manager/modules/vcd-api/src/hook/useUpdateVcdDatacentre.ts index 463e5fad9923..9fcb31caaf25 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useUpdateVcdDatacentre.ts +++ b/packages/manager/modules/vcd-api/src/hook/useUpdateVcdDatacentre.ts @@ -1,13 +1,10 @@ import { ApiError } from '@ovh-ux/manager-core-api'; import { useQueryClient, useMutation } from '@tanstack/react-query'; +import { updateVdcDetails, UpdateVdcDetailsParams } from '../api'; import { - UpdateVdcDetailsParams, - updateVdcDetails, -} from '../api/hpc-vmware-managed-vcd-datacentre'; -import { - getVcdDatacentresQueryKey, + getVcdDatacentreListQueryKey, updateVdcDetailsMutationKey, -} from '@/utils/queryKeys'; +} from '../utils'; export const useUpdateVdcDetails = ({ id, @@ -28,7 +25,7 @@ export const useUpdateVdcDetails = ({ updateVdcDetails({ id, vdcId, details }), onSuccess: () => { queryClient.invalidateQueries({ - queryKey: getVcdDatacentresQueryKey(id), + queryKey: getVcdDatacentreListQueryKey(id), }); onSuccess?.(); }, diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useUpdateVcdOrganization.ts b/packages/manager/modules/vcd-api/src/hook/useUpdateVcdOrganization.ts similarity index 86% rename from packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useUpdateVcdOrganization.ts rename to packages/manager/modules/vcd-api/src/hook/useUpdateVcdOrganization.ts index 384bdfc37e61..ae1325938dbe 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useUpdateVcdOrganization.ts +++ b/packages/manager/modules/vcd-api/src/hook/useUpdateVcdOrganization.ts @@ -3,13 +3,13 @@ import { ApiError } from '@ovh-ux/manager-core-api'; import { updateVcdOrganizationDetails, UpdateVcdOrganizationDetailsParams, -} from '../api/hpc-vmware-managed-vcd'; +} from '../api'; import { - getVcdOrganizationsQueryKey, + vcdOrganizationListQueryKey, getVcdOrganizationQueryKey, icebergListingQueryKey, updateVcdOrganizationDetailsMutationKey, -} from '@/utils/queryKeys'; +} from '../utils'; export const useUpdateVcdOrganizationDetails = ({ id, @@ -32,7 +32,7 @@ export const useUpdateVcdOrganizationDetails = ({ exact: true, }); queryClient.invalidateQueries({ - queryKey: [...getVcdOrganizationsQueryKey(), icebergListingQueryKey], + queryKey: [...vcdOrganizationListQueryKey, icebergListingQueryKey], exact: true, }); onSuccess?.(); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useVcdCatalog.ts b/packages/manager/modules/vcd-api/src/hook/useVcdCatalog.ts similarity index 57% rename from packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useVcdCatalog.ts rename to packages/manager/modules/vcd-api/src/hook/useVcdCatalog.ts index fe7948c0a534..970f7e266339 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useVcdCatalog.ts +++ b/packages/manager/modules/vcd-api/src/hook/useVcdCatalog.ts @@ -1,11 +1,11 @@ import { keepPreviousData, useQuery } from '@tanstack/react-query'; import { ApiError, ApiResponse } from '@ovh-ux/manager-core-api'; -import { getVcdCatalog } from '../api/hpc-vmware-managed-vcd-cart'; -import { TVcdCatalog } from '@/types/vcd-catalog.interface'; -import { getVcdCatalogQueryKey } from '@/utils/queryKeys'; +import { VCDCatalog } from '../types'; +import { getVcdCatalogQueryKey } from '../utils'; +import { getVcdCatalog } from '../api'; export const useVcdCatalog = (serviceName: string) => { - return useQuery, ApiError>({ + return useQuery, ApiError>({ queryKey: getVcdCatalogQueryKey(serviceName), queryFn: () => getVcdCatalog(serviceName), placeholderData: keepPreviousData, diff --git a/packages/manager/modules/vcd-api/src/hook/useVcdDatacentre.ts b/packages/manager/modules/vcd-api/src/hook/useVcdDatacentre.ts new file mode 100644 index 000000000000..b7a0e98baca7 --- /dev/null +++ b/packages/manager/modules/vcd-api/src/hook/useVcdDatacentre.ts @@ -0,0 +1,26 @@ +import { ApiError, ApiResponse } from '@ovh-ux/manager-core-api'; +import { keepPreviousData, useQuery } from '@tanstack/react-query'; +import { VCDDatacentre } from '../types'; +import { + getVcdDatacentreQueryKey, + getVcdDatacentreListQueryKey, +} from '../utils'; +import { getVcdDatacentre, getVcdDatacentres } from '../api'; + +export const useVcdDatacentres = (id: string) => { + return useQuery, ApiError>({ + queryKey: getVcdDatacentreListQueryKey(id), + queryFn: () => getVcdDatacentres(id), + retry: false, + placeholderData: keepPreviousData, + }); +}; + +export const useVcdDatacentre = (id: string, vdcId: string) => { + return useQuery, ApiError>({ + queryKey: getVcdDatacentreQueryKey(id, vdcId), + queryFn: () => getVcdDatacentre(id, vdcId), + retry: false, + placeholderData: keepPreviousData, + }); +}; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useVcdOrder.ts b/packages/manager/modules/vcd-api/src/hook/useVcdOrder.ts similarity index 74% rename from packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useVcdOrder.ts rename to packages/manager/modules/vcd-api/src/hook/useVcdOrder.ts index 0998f4d2b675..410da249a539 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/data/hooks/useVcdOrder.ts +++ b/packages/manager/modules/vcd-api/src/hook/useVcdOrder.ts @@ -2,20 +2,14 @@ import { useOrderURL, getVcdProductSettings, } from '@ovh-ux/manager-module-order'; +import { VCDOrder } from '../types'; -interface IVcdOrder { - serviceName: string; - planCode: string; - quantity?: number; - vdcOrgId?: string; -} - -const useVcdOrder = ({ +export const useVcdOrder = ({ serviceName, planCode, quantity, vdcOrgId, -}: IVcdOrder) => { +}: VCDOrder) => { const orderBaseUrl = useOrderURL('express_review_base'); const vcdProductSettings = getVcdProductSettings({ serviceName, @@ -30,5 +24,3 @@ const useVcdOrder = ({ return { orderLink, redirectToOrder }; }; - -export default useVcdOrder; diff --git a/packages/manager/apps/veeam-backup/src/data/hook/useOrganization.spec.ts b/packages/manager/modules/vcd-api/src/hook/useVcdOrganization.spec.ts similarity index 86% rename from packages/manager/apps/veeam-backup/src/data/hook/useOrganization.spec.ts rename to packages/manager/modules/vcd-api/src/hook/useVcdOrganization.spec.ts index 621e2bf10eb3..3b9e143ea5e9 100644 --- a/packages/manager/apps/veeam-backup/src/data/hook/useOrganization.spec.ts +++ b/packages/manager/modules/vcd-api/src/hook/useVcdOrganization.spec.ts @@ -1,12 +1,12 @@ -import { backupList } from '../../../mocks/veeam-backup.mock'; +import { backupList } from '../mocks/backup/veeam-backup.mock'; +import { organizationList } from '../mocks/vcd-organization/vcd-organization.mock'; import { getAvailabilityZone, getBackupIdFromOrganization, getOrganizationDisplayName, getOrganizationIdFromBackup, getOrganizationUuid, -} from './useOrganizations'; -import { organizationList } from '../../../mocks/vcd-organization.mock'; +} from './useVcdOrganization'; describe('Managed VCD API utils', () => { it('getAvailabilityZone returns the azName from the region', () => { @@ -43,7 +43,7 @@ describe('Managed VCD API utils', () => { ...organizationList[0], currentState: { ...organizationList[0].currentState, - fullName: null as string, + fullName: (null as unknown) as string, }, }; expect(getOrganizationDisplayName(organizationWithoutDisplayName)).toBe( diff --git a/packages/manager/apps/veeam-backup/src/data/hook/useOrganizations.ts b/packages/manager/modules/vcd-api/src/hook/useVcdOrganization.ts similarity index 67% rename from packages/manager/apps/veeam-backup/src/data/hook/useOrganizations.ts rename to packages/manager/modules/vcd-api/src/hook/useVcdOrganization.ts index 6788668224fb..d433d42a6f62 100644 --- a/packages/manager/apps/veeam-backup/src/data/hook/useOrganizations.ts +++ b/packages/manager/modules/vcd-api/src/hook/useVcdOrganization.ts @@ -1,18 +1,28 @@ -import { useQuery, useQueries } from '@tanstack/react-query'; +import { + useQuery, + useQueries, + UseQueryOptions, + keepPreviousData, +} from '@tanstack/react-query'; import { ApiError, ApiResponse } from '@ovh-ux/manager-core-api'; import { useResourcesIcebergV2 } from '@ovh-ux/manager-react-components'; -import { - organizationApiRoute, - getVcdOrganization, - getVmwareCloudDirectorBackup, -} from '../api'; +import { getVcdOrganization, getVmwareCloudDirectorBackup } from '../api'; +import { getRegionNameFromAzName } from './useVeeamBackup'; import { BackupStatus, VCDOrganization, VCDOrganizationWithBackupStatus, - VeeamBackupWithIam, -} from '../vcd.type'; -import { getRegionNameFromAzName } from './useVeeamBackup'; + VeeamBackup, +} from '../types'; +import { VCD_ORGANIZATION_ROUTE } from '../utils/apiRoutes'; +import { + getVcdOrganizationBackupQueryKey, + getVcdOrganizationQueryKey, +} from '../utils'; + +type UseVcdOrganization = Pick & { + id: string; +}; const backupSuffix = '-veeam-backup'; @@ -24,7 +34,7 @@ export const getOrganizationUuid = (organization?: VCDOrganization) => export const getAvailabilityZone = (organization?: VCDOrganization) => `${organization?.currentState?.region.toLowerCase()}-a`; -export const getOrganizationIdFromBackup = (backup?: VeeamBackupWithIam) => +export const getOrganizationIdFromBackup = (backup?: VeeamBackup) => `org-${getRegionNameFromAzName(backup?.currentState?.azName)}-${ backup?.id.split(backupSuffix)[0] }`; @@ -35,11 +45,11 @@ export const getOrganizationDisplayName = (organization?: VCDOrganization) => export const getBackupIdFromOrganization = (organization: VCDOrganization) => `${getOrganizationUuid(organization)}${backupSuffix}`; -export const organizationListQueryKey = [organizationApiRoute]; +export const organizationListQueryKey = [VCD_ORGANIZATION_ROUTE]; export const useOrganizationList = ({ pageSize }: { pageSize?: number }) => useResourcesIcebergV2({ - route: organizationApiRoute, + route: VCD_ORGANIZATION_ROUTE, queryKey: organizationListQueryKey, pageSize, }); @@ -95,6 +105,31 @@ export const useOrganizationWithBackupStatusList = ({ export const useOrganization = (organizationId: string) => useQuery, ApiError>({ - queryKey: [organizationApiRoute, organizationId], + queryKey: [VCD_ORGANIZATION_ROUTE, organizationId], queryFn: () => getVcdOrganization(organizationId), }); + +export const useVcdOrganization = ({ + id, + refetchInterval, +}: UseVcdOrganization) => { + return useQuery, ApiError>({ + queryKey: getVcdOrganizationQueryKey(id), + queryFn: () => getVcdOrganization(id), + retry: false, + refetchInterval, + placeholderData: keepPreviousData, + }); +}; + +export const useVcdOrganizationBackup = (vcdOrganization: VCDOrganization) => { + return useQuery, ApiError>({ + queryKey: getVcdOrganizationBackupQueryKey(vcdOrganization.id), + queryFn: () => + getVmwareCloudDirectorBackup( + getBackupIdFromOrganization(vcdOrganization), + ), + retry: false, + placeholderData: keepPreviousData, + }); +}; diff --git a/packages/manager/apps/veeam-backup/src/data/hook/useVeeamBackup.spec.ts b/packages/manager/modules/vcd-api/src/hook/useVeeamBackup.spec.ts similarity index 89% rename from packages/manager/apps/veeam-backup/src/data/hook/useVeeamBackup.spec.ts rename to packages/manager/modules/vcd-api/src/hook/useVeeamBackup.spec.ts index cbc643f8682a..0555a0e5c022 100644 --- a/packages/manager/apps/veeam-backup/src/data/hook/useVeeamBackup.spec.ts +++ b/packages/manager/modules/vcd-api/src/hook/useVeeamBackup.spec.ts @@ -1,4 +1,4 @@ -import { backupList } from '../../../mocks/veeam-backup.mock'; +import { backupList } from '../mocks'; import { getRegionNameFromAzName, getVeeamBackupDisplayName, @@ -25,7 +25,7 @@ describe('Veeam-backup API utils', () => { ...backupList[0], iam: { ...backupList[0].iam, - displayName: null as string, + displayName: (null as unknown) as string, }, }; expect(getVeeamBackupDisplayName(backupWithoutDisplayName)).toBe( diff --git a/packages/manager/apps/veeam-backup/src/data/hook/useVeeamBackup.ts b/packages/manager/modules/vcd-api/src/hook/useVeeamBackup.ts similarity index 65% rename from packages/manager/apps/veeam-backup/src/data/hook/useVeeamBackup.ts rename to packages/manager/modules/vcd-api/src/hook/useVeeamBackup.ts index bc4509e41b1d..592a8a565b04 100644 --- a/packages/manager/apps/veeam-backup/src/data/hook/useVeeamBackup.ts +++ b/packages/manager/modules/vcd-api/src/hook/useVeeamBackup.ts @@ -1,27 +1,22 @@ import { useResourcesIcebergV2 } from '@ovh-ux/manager-react-components'; import { useQuery } from '@tanstack/react-query'; import { ApiError, ApiResponse } from '@ovh-ux/manager-core-api'; -import { VeeamBackupWithIam } from '../vcd.type'; +import { VeeamBackup } from '../types'; import { getVmwareCloudDirectorBackup } from '../api'; +import { getVeeamBackupQueryKey, veeamBackupListQueryKey } from '../utils'; export const getRegionNameFromAzName = (azName = '') => azName?.split('-a')[0]; -export const veeamBackupListQueryKey = ['/vmwareCloudDirector/backup']; - export const useVeeamBackupList = ({ pageSize }: { pageSize?: number }) => - useResourcesIcebergV2({ + useResourcesIcebergV2({ route: '/vmwareCloudDirector/backup', queryKey: veeamBackupListQueryKey, pageSize, }); -export const veeamBackupQueryKey = (id: string) => [ - `/vmwareCloudDirector/backup/${id}`, -]; - export const useVeeamBackup = (id?: string) => - useQuery, ApiError>({ - queryKey: veeamBackupQueryKey(id), + useQuery, ApiError>({ + queryKey: getVeeamBackupQueryKey(id), queryFn: () => getVmwareCloudDirectorBackup(id), retry: false, retryOnMount: false, @@ -31,5 +26,5 @@ export const useVeeamBackup = (id?: string) => enabled: !!id, }); -export const getVeeamBackupDisplayName = (backup?: VeeamBackupWithIam) => +export const getVeeamBackupDisplayName = (backup?: VeeamBackup) => backup?.iam?.displayName || backup?.id; diff --git a/packages/manager/apps/veeam-backup/src/data/hook/useVeeamBackupCatalog.ts b/packages/manager/modules/vcd-api/src/hook/useVeeamBackupCatalog.ts similarity index 89% rename from packages/manager/apps/veeam-backup/src/data/hook/useVeeamBackupCatalog.ts rename to packages/manager/modules/vcd-api/src/hook/useVeeamBackupCatalog.ts index 900390c9f0a7..5d22fd05c241 100644 --- a/packages/manager/apps/veeam-backup/src/data/hook/useVeeamBackupCatalog.ts +++ b/packages/manager/modules/vcd-api/src/hook/useVeeamBackupCatalog.ts @@ -2,10 +2,9 @@ import React from 'react'; import { ApiError, ApiResponse } from '@ovh-ux/manager-core-api'; import { useQuery } from '@tanstack/react-query'; import { ShellContext } from '@ovh-ux/manager-react-shell-client'; -import { order } from '../catalog.type'; +import { order } from '../types/veeam-backup-catalog.type'; import { getVeeamBackupCatalog } from '../api'; - -export const veeamBackupCatalogQueryKey = ['catalog', 'veeam-backup']; +import { veeamBackupCatalogQueryKey } from '../utils'; export const vmPlanCode = 'backup-veeam-vcd-vm'; diff --git a/packages/manager/modules/vcd-api/src/index.ts b/packages/manager/modules/vcd-api/src/index.ts new file mode 100644 index 000000000000..0cb1a4769945 --- /dev/null +++ b/packages/manager/modules/vcd-api/src/index.ts @@ -0,0 +1,5 @@ +export * from './api'; +export * from './hook'; +export * from './mocks'; +export * from './types'; +export * from './utils'; diff --git a/packages/manager/modules/vcd-api/src/mocks/backup/index.ts b/packages/manager/modules/vcd-api/src/mocks/backup/index.ts new file mode 100644 index 000000000000..3bbd72f11ef7 --- /dev/null +++ b/packages/manager/modules/vcd-api/src/mocks/backup/index.ts @@ -0,0 +1,4 @@ +export * from './veeam-backup.handler'; +export * from './veeam-backup.mock'; +export * from './veeam-backup-catalog.handler'; +export * from './veeam-backup-catalog.mock'; diff --git a/packages/manager/apps/veeam-backup/mocks/catalog.handler.ts b/packages/manager/modules/vcd-api/src/mocks/backup/veeam-backup-catalog.handler.ts similarity index 76% rename from packages/manager/apps/veeam-backup/mocks/catalog.handler.ts rename to packages/manager/modules/vcd-api/src/mocks/backup/veeam-backup-catalog.handler.ts index 9389bc1a1ca4..9249b6243a1d 100644 --- a/packages/manager/apps/veeam-backup/mocks/catalog.handler.ts +++ b/packages/manager/modules/vcd-api/src/mocks/backup/veeam-backup-catalog.handler.ts @@ -1,5 +1,5 @@ -import { Handler } from '../../../../../playwright-helpers'; -import { veeamBackupCatalog } from './catalog.mock'; +import { Handler } from '@ovh-ux/manager-core-test-utils'; +import { veeamBackupCatalog } from './veeam-backup-catalog.mock'; export type GetCatalogMocksParams = { isCatalogKo?: boolean; diff --git a/packages/manager/apps/veeam-backup/mocks/catalog.mock.ts b/packages/manager/modules/vcd-api/src/mocks/backup/veeam-backup-catalog.mock.ts similarity index 99% rename from packages/manager/apps/veeam-backup/mocks/catalog.mock.ts rename to packages/manager/modules/vcd-api/src/mocks/backup/veeam-backup-catalog.mock.ts index 69bb7191bceb..b0f8fc262301 100644 --- a/packages/manager/apps/veeam-backup/mocks/catalog.mock.ts +++ b/packages/manager/modules/vcd-api/src/mocks/backup/veeam-backup-catalog.mock.ts @@ -1,4 +1,4 @@ -import { order } from '../src/data'; +import { order } from '../../types'; export const veeamBackupCatalog = ({ catalogId: 7700, diff --git a/packages/manager/apps/veeam-backup/mocks/veeam-backup.handler.ts b/packages/manager/modules/vcd-api/src/mocks/backup/veeam-backup.handler.ts similarity index 93% rename from packages/manager/apps/veeam-backup/mocks/veeam-backup.handler.ts rename to packages/manager/modules/vcd-api/src/mocks/backup/veeam-backup.handler.ts index 7c12e4bb4d5c..03006d4cb64f 100644 --- a/packages/manager/apps/veeam-backup/mocks/veeam-backup.handler.ts +++ b/packages/manager/modules/vcd-api/src/mocks/backup/veeam-backup.handler.ts @@ -1,5 +1,5 @@ import { PathParams } from 'msw'; -import { Handler } from '../../../../../playwright-helpers'; +import { Handler } from '@ovh-ux/manager-core-test-utils'; import { backupList } from './veeam-backup.mock'; export type GetVeeamBackupMocksParams = { diff --git a/packages/manager/apps/veeam-backup/mocks/veeam-backup.mock.ts b/packages/manager/modules/vcd-api/src/mocks/backup/veeam-backup.mock.ts similarity index 96% rename from packages/manager/apps/veeam-backup/mocks/veeam-backup.mock.ts rename to packages/manager/modules/vcd-api/src/mocks/backup/veeam-backup.mock.ts index 2711ac32d897..a5dbd9ff2f52 100644 --- a/packages/manager/apps/veeam-backup/mocks/veeam-backup.mock.ts +++ b/packages/manager/modules/vcd-api/src/mocks/backup/veeam-backup.mock.ts @@ -1,6 +1,6 @@ -import { VeeamBackupWithIam } from '@/data'; +import { VeeamBackup } from '../../types'; -export const backupList: VeeamBackupWithIam[] = [ +export const backupList: VeeamBackup[] = [ { id: '6cfa2c69-c62c-4853-80ee-c9682e6727f0-veeam-backup', iam: { diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/iam/iam.handler.ts b/packages/manager/modules/vcd-api/src/mocks/iam/iam.handler.ts similarity index 86% rename from packages/manager/apps/hpc-vmware-managed-vcd/mocks/iam/iam.handler.ts rename to packages/manager/modules/vcd-api/src/mocks/iam/iam.handler.ts index cb2b8e6ae4f7..2a5aa834d194 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/iam/iam.handler.ts +++ b/packages/manager/modules/vcd-api/src/mocks/iam/iam.handler.ts @@ -1,5 +1,5 @@ import { PathParams } from 'msw'; -import { Handler } from '../../../../../../playwright-helpers'; +import { Handler } from '@ovh-ux/manager-core-test-utils'; import { resourceList } from './iam.mock'; const findResourceByUrn = (params: PathParams) => diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/iam/iam.mock.ts b/packages/manager/modules/vcd-api/src/mocks/iam/iam.mock.ts similarity index 87% rename from packages/manager/apps/hpc-vmware-managed-vcd/mocks/iam/iam.mock.ts rename to packages/manager/modules/vcd-api/src/mocks/iam/iam.mock.ts index 2ef5404743a0..e041edee03cb 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/iam/iam.mock.ts +++ b/packages/manager/modules/vcd-api/src/mocks/iam/iam.mock.ts @@ -1,7 +1,7 @@ import { IamCheckResponse } from '@ovh-ux/manager-react-components'; -import { datacentreList } from '../vcd-organization/vcd-datacentre.mock'; +import { datacentreList } from '../vcd-datacentre'; import { organizationList } from '../vcd-organization/vcd-organization.mock'; -import { iamActions } from '@/utils/iam.constants'; +import { iamActions } from '../../utils'; export const resourceList: IamCheckResponse[] = [ { diff --git a/packages/manager/modules/vcd-api/src/mocks/iam/index.ts b/packages/manager/modules/vcd-api/src/mocks/iam/index.ts new file mode 100644 index 000000000000..2d862b35bd1f --- /dev/null +++ b/packages/manager/modules/vcd-api/src/mocks/iam/index.ts @@ -0,0 +1,2 @@ +export * from './iam.handler'; +export * from './iam.mock'; diff --git a/packages/manager/modules/vcd-api/src/mocks/index.ts b/packages/manager/modules/vcd-api/src/mocks/index.ts new file mode 100644 index 000000000000..984895e56ff6 --- /dev/null +++ b/packages/manager/modules/vcd-api/src/mocks/index.ts @@ -0,0 +1,4 @@ +export * from './backup'; +export * from './iam'; +export * from './vcd-datacentre'; +export * from './vcd-organization'; diff --git a/packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/index.ts b/packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/index.ts new file mode 100644 index 000000000000..075f10d96b16 --- /dev/null +++ b/packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/index.ts @@ -0,0 +1,6 @@ +export * from './vcd-datacentre-order.handler'; +export * from './vcd-datacentre.handler'; +export * from './vcd-datacentre.mock'; +export * from './vdc-compute.mock'; +export * from './vdc-orderable-resource.mock'; +export * from './vdc-storage.mock'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-datacentre-order.handler.ts b/packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/vcd-datacentre-order.handler.ts similarity index 81% rename from packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-datacentre-order.handler.ts rename to packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/vcd-datacentre-order.handler.ts index ac2af6c75a35..a689bd9f5f52 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-datacentre-order.handler.ts +++ b/packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/vcd-datacentre-order.handler.ts @@ -1,6 +1,6 @@ -import { IVdcOrderableResourceData } from '@/types/vcd-vdc-orderable-resource.interface'; -import { Handler } from '../../../../../../playwright-helpers'; -import { catalogProductList } from './vcd-catalog.mock'; +import { Handler } from '@ovh-ux/manager-core-test-utils'; +import { VCDOrderableResourceData } from '../../types'; +import { catalogProductList } from '../vcd-organization/vcd-catalog.mock'; import { orderableResourceData } from './vdc-orderable-resource.mock'; export type GetDatacentreOrderMocksParams = { @@ -16,7 +16,7 @@ export const getDatacentreOrderMocks = ({ isOrderableResourceKO, nbOrderableResource = Number.POSITIVE_INFINITY, }: GetDatacentreOrderMocksParams): Handler[] => { - const selectedOrderableResource: IVdcOrderableResourceData = { + const selectedOrderableResource: VCDOrderableResourceData = { compute: orderableResourceData.compute.slice(0, nbOrderableResource), storage: orderableResourceData.storage.slice(0, nbOrderableResource), }; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-datacentre.handler.ts b/packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/vcd-datacentre.handler.ts similarity index 97% rename from packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-datacentre.handler.ts rename to packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/vcd-datacentre.handler.ts index 27e4e84f4f3d..0ebc33ed0346 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-datacentre.handler.ts +++ b/packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/vcd-datacentre.handler.ts @@ -1,5 +1,5 @@ import { PathParams } from 'msw'; -import { Handler } from '../../../../../../playwright-helpers'; +import { Handler } from '@ovh-ux/manager-core-test-utils'; import { datacentreList } from './vcd-datacentre.mock'; import { computeList } from './vdc-compute.mock'; import { storageList } from './vdc-storage.mock'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-datacentre.mock.ts b/packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/vcd-datacentre.mock.ts similarity index 87% rename from packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-datacentre.mock.ts rename to packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/vcd-datacentre.mock.ts index 32446b83efd0..44be4f657713 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-datacentre.mock.ts +++ b/packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/vcd-datacentre.mock.ts @@ -1,6 +1,6 @@ -import IVcdDatacentre from '../../src/types/vcd-datacenter.interface'; +import { VCDDatacentre } from '../../types'; -export const datacentreList: IVcdDatacentre[] = [ +export const datacentreList: VCDDatacentre[] = [ { id: 'vdc-eu-central-waw-adc311b5-0c0b-4071-b48f-b20813868bcf', resourceStatus: 'READY', diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vdc-compute.mock.ts b/packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/vdc-compute.mock.ts similarity index 82% rename from packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vdc-compute.mock.ts rename to packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/vdc-compute.mock.ts index a0a42ed9cfb2..0d7d5c2e59e9 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vdc-compute.mock.ts +++ b/packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/vdc-compute.mock.ts @@ -1,6 +1,6 @@ -import IVcdCompute from '../../src/types/vcd-compute.interface'; +import { VCDCompute } from '../../types'; -export const computeList: IVcdCompute[] = [ +export const computeList: VCDCompute[] = [ { id: 'f578c64f-ebec-4c19-a006-c96b1c7c1b95', resourceStatus: 'READY', diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vdc-orderable-resource.mock.ts b/packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/vdc-orderable-resource.mock.ts similarity index 77% rename from packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vdc-orderable-resource.mock.ts rename to packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/vdc-orderable-resource.mock.ts index a62528086349..1a152cad328d 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vdc-orderable-resource.mock.ts +++ b/packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/vdc-orderable-resource.mock.ts @@ -1,6 +1,6 @@ -import { IVdcOrderableResourceData } from '../../src/types/vcd-vdc-orderable-resource.interface'; +import { VCDOrderableResourceData } from '../../types'; -export const orderableResourceData: IVdcOrderableResourceData = { +export const orderableResourceData: VCDOrderableResourceData = { compute: [ { memoryQuota: 64, diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vdc-storage.mock.ts b/packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/vdc-storage.mock.ts similarity index 83% rename from packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vdc-storage.mock.ts rename to packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/vdc-storage.mock.ts index e3538f33c932..d827d0c0bb01 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vdc-storage.mock.ts +++ b/packages/manager/modules/vcd-api/src/mocks/vcd-datacentre/vdc-storage.mock.ts @@ -1,6 +1,6 @@ -import IVcdStorage from '../../src/types/vcd-storage.interface'; +import { VCDStorage } from '../../types'; -export const storageList: IVcdStorage[] = [ +export const storageList: VCDStorage[] = [ { id: 'fccce864-e1d5-4ab8-ad6a-79ecd295f420', resourceStatus: 'READY', diff --git a/packages/manager/modules/vcd-api/src/mocks/vcd-organization/index.ts b/packages/manager/modules/vcd-api/src/mocks/vcd-organization/index.ts new file mode 100644 index 000000000000..e6d96900556a --- /dev/null +++ b/packages/manager/modules/vcd-api/src/mocks/vcd-organization/index.ts @@ -0,0 +1,3 @@ +export * from './vcd-catalog.mock'; +export * from './vcd-organization.handler'; +export * from './vcd-organization.mock'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-catalog.mock.ts b/packages/manager/modules/vcd-api/src/mocks/vcd-organization/vcd-catalog.mock.ts similarity index 97% rename from packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-catalog.mock.ts rename to packages/manager/modules/vcd-api/src/mocks/vcd-organization/vcd-catalog.mock.ts index 8d03032dd813..09181f74b86f 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-catalog.mock.ts +++ b/packages/manager/modules/vcd-api/src/mocks/vcd-organization/vcd-catalog.mock.ts @@ -1,6 +1,6 @@ -import { TVcdCatalog } from '../../src/types/vcd-catalog.interface'; +import { VCDCatalog } from '../../types'; -export const catalogProductList: TVcdCatalog = [ +export const catalogProductList: VCDCatalog = [ { productName: 'pack-3264', mandatory: false, diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-organization.handler.ts b/packages/manager/modules/vcd-api/src/mocks/vcd-organization/vcd-organization.handler.ts similarity index 96% rename from packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-organization.handler.ts rename to packages/manager/modules/vcd-api/src/mocks/vcd-organization/vcd-organization.handler.ts index 3009416f69ee..07de267f7920 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/mocks/vcd-organization/vcd-organization.handler.ts +++ b/packages/manager/modules/vcd-api/src/mocks/vcd-organization/vcd-organization.handler.ts @@ -1,5 +1,5 @@ import { PathParams } from 'msw'; -import { Handler } from '../../../../../../playwright-helpers'; +import { Handler } from '@ovh-ux/manager-core-test-utils'; import { organizationList } from './vcd-organization.mock'; export type GetOrganizationMocksParams = { diff --git a/packages/manager/apps/veeam-backup/mocks/vcd-organization.mock.ts b/packages/manager/modules/vcd-api/src/mocks/vcd-organization/vcd-organization.mock.ts similarity index 95% rename from packages/manager/apps/veeam-backup/mocks/vcd-organization.mock.ts rename to packages/manager/modules/vcd-api/src/mocks/vcd-organization/vcd-organization.mock.ts index 408d930d0b23..342e63a59d5e 100644 --- a/packages/manager/apps/veeam-backup/mocks/vcd-organization.mock.ts +++ b/packages/manager/modules/vcd-api/src/mocks/vcd-organization/vcd-organization.mock.ts @@ -1,6 +1,6 @@ -import { VCDOrganizationWithIam } from '@/data'; +import { VCDOrganization } from '../../types'; -export const organizationList: VCDOrganizationWithIam[] = [ +export const organizationList: VCDOrganization[] = [ { currentState: { apiUrl: 'https://vcd.my.company', diff --git a/packages/manager/modules/vcd-api/src/types/index.ts b/packages/manager/modules/vcd-api/src/types/index.ts new file mode 100644 index 000000000000..96e1cb4b4040 --- /dev/null +++ b/packages/manager/modules/vcd-api/src/types/index.ts @@ -0,0 +1,10 @@ +export * from './veeam-backup.type'; +export * from './veeam-backup-catalog.type'; +export * from './vcd-catalog.type'; +export * from './vcd-compute.type'; +export * from './vcd-datacentre.type'; +export * from './vcd-order.type'; +export * from './vcd-orderable-resource.type'; +export * from './vcd-organization.type'; +export * from './vcd-storage.type'; +export * from './vcd-utility.type'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-catalog.interface.ts b/packages/manager/modules/vcd-api/src/types/vcd-catalog.type.ts similarity index 84% rename from packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-catalog.interface.ts rename to packages/manager/modules/vcd-api/src/types/vcd-catalog.type.ts index 1964927281f3..4bf2299cda27 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/types/vcd-catalog.interface.ts +++ b/packages/manager/modules/vcd-api/src/types/vcd-catalog.type.ts @@ -1,6 +1,5 @@ import { Price } from '@ovh-ux/manager-module-order'; - -type ObjectValues = T[keyof T]; +import { ObjectValues } from './vcd-utility.type'; const pricingCapacity = { CONSUMPTION: 'consumption', @@ -29,7 +28,7 @@ const catalogProduct = { STORAGE: 'storage', } as const; -export interface IVcdCatalogProductPricing { +export type VCDCatalogProductPricing = { capacities: ObjectValues[]; description: string; duration: unknown; @@ -42,16 +41,16 @@ export interface IVcdCatalogProductPricing { priceInUcents: number; pricingMode: string; pricingType: ObjectValues; -} +}; -export interface IVcdCatalogProduct { +export type VCDCatalogProduct = { family: string; planCode: string; productName: string; productType: ObjectValues; - prices: IVcdCatalogProductPricing[]; + prices: VCDCatalogProductPricing[]; exclusive: boolean; mandatory: boolean; -} +}; -export type TVcdCatalog = IVcdCatalogProduct[]; +export type VCDCatalog = VCDCatalogProduct[]; diff --git a/packages/manager/modules/vcd-api/src/types/vcd-compute.type.ts b/packages/manager/modules/vcd-api/src/types/vcd-compute.type.ts new file mode 100644 index 000000000000..2a2065521ce2 --- /dev/null +++ b/packages/manager/modules/vcd-api/src/types/vcd-compute.type.ts @@ -0,0 +1,16 @@ +import { BillingType, ResourceStatus, Task } from './vcd-utility.type'; + +export type VCDComputeState = { + billingType: BillingType; + profile: string; + name: string; + vCPUCount: number; + memoryQuota: number; +}; + +export type VCDCompute = { + id: string; + resourceStatus: ResourceStatus; + currentState: VCDComputeState; + currentTasks?: Task[]; +}; diff --git a/packages/manager/modules/vcd-api/src/types/vcd-datacentre.type.ts b/packages/manager/modules/vcd-api/src/types/vcd-datacentre.type.ts new file mode 100644 index 000000000000..442f54126d6d --- /dev/null +++ b/packages/manager/modules/vcd-api/src/types/vcd-datacentre.type.ts @@ -0,0 +1,25 @@ +import { ResourceStatus, Task, WithIam } from './vcd-utility.type'; + +export type VCDDatacentreTargetSpec = { + vCPUSpeed: number; + description: string; +}; + +export type VCDDatacentreState = VCDDatacentreTargetSpec & { + commercialRange: string; + ipQuota: number; + storageQuota: number; + vCPUCount: number; + region: string; + memoryQuota: number; + name: string; +}; + +export type VCDDatacentre = WithIam<{ + id: string; + resourceStatus: ResourceStatus; + currentState: VCDDatacentreState; + targetSpec: VCDDatacentreTargetSpec; + currentTasks?: Task[]; + updatedAt: string; +}>; diff --git a/packages/manager/modules/vcd-api/src/types/vcd-order.type.ts b/packages/manager/modules/vcd-api/src/types/vcd-order.type.ts new file mode 100644 index 000000000000..f15edfe65614 --- /dev/null +++ b/packages/manager/modules/vcd-api/src/types/vcd-order.type.ts @@ -0,0 +1,6 @@ +export type VCDOrder = { + serviceName: string; + planCode: string; + quantity?: number; + vdcOrgId?: string; +}; diff --git a/packages/manager/modules/vcd-api/src/types/vcd-orderable-resource.type.ts b/packages/manager/modules/vcd-api/src/types/vcd-orderable-resource.type.ts new file mode 100644 index 000000000000..e98433d21ae1 --- /dev/null +++ b/packages/manager/modules/vcd-api/src/types/vcd-orderable-resource.type.ts @@ -0,0 +1,23 @@ +import { VCDComputeState } from './vcd-compute.type'; +import { VCDStorageState } from './vcd-storage.type'; +import { VCDCatalogProductPricing } from './vcd-catalog.type'; + +export type VCDOrderableVHost = Omit & { + vCPUSpeed: number; +}; +export type VCDOrderableStorage = Omit; + +type WithPricing = T & { pricing: VCDCatalogProductPricing }; + +export type VCDOrderableVhostPriced = WithPricing; +export type VCDOrderableStoragePriced = WithPricing; + +export type VCDOrderableResource = VCDOrderableVHost | VCDOrderableStorage; +export type VCDOrderableResourcePriced = + | VCDOrderableVhostPriced + | VCDOrderableStoragePriced; + +export type VCDOrderableResourceData = { + compute: VCDOrderableVHost[]; + storage: VCDOrderableStorage[]; +}; diff --git a/packages/manager/modules/vcd-api/src/types/vcd-organization.type.ts b/packages/manager/modules/vcd-api/src/types/vcd-organization.type.ts new file mode 100644 index 000000000000..60e4918797aa --- /dev/null +++ b/packages/manager/modules/vcd-api/src/types/vcd-organization.type.ts @@ -0,0 +1,44 @@ +import { BillingType, ResourceStatus, Task, WithIam } from './vcd-utility.type'; +import { BackupStatus } from './veeam-backup.type'; + +export type VCDRegion = + | 'AP-SOUTH-MUM' + | 'AP-SOUTHEAST-SGP' + | 'AP-SOUTHEAST-SYD' + | 'CA-EAST-BHS' + | 'EU-CENTRAL-WAW' + | 'EU-WEST-ERI' + | 'EU-WEST-GRA' + | 'EU-WEST-LIM' + | 'EU-WEST-PAR' + | 'EU-WEST-RBX' + | 'EU-WEST-SBG' + | 'US-EAST-VIN' + | 'US-WEST-HIL'; + +export type VCDOrganizationTargetSpec = { + fullName: string; + description: string; +}; + +export type VCDOrganizationState = VCDOrganizationTargetSpec & { + apiUrl?: string; + billingType: BillingType; + name: string; + region: VCDRegion; + spla: boolean; + webInterfaceUrl: string; +}; + +export type VCDOrganization = WithIam<{ + id: string; + resourceStatus: ResourceStatus; + currentState: VCDOrganizationState; + targetSpec: VCDOrganizationTargetSpec; + currentTasks?: Task[]; + updatedAt: string; +}>; + +export type VCDOrganizationWithBackupStatus = VCDOrganization & { + backupStatus?: BackupStatus; +}; diff --git a/packages/manager/modules/vcd-api/src/types/vcd-storage.type.ts b/packages/manager/modules/vcd-api/src/types/vcd-storage.type.ts new file mode 100644 index 000000000000..36bcd4f6a726 --- /dev/null +++ b/packages/manager/modules/vcd-api/src/types/vcd-storage.type.ts @@ -0,0 +1,16 @@ +import { BillingType, Task } from './vcd-utility.type'; + +export type VCDStorageState = { + billingType: BillingType; + profile: string; + name: string; + capacity: number; + type: string; +}; + +export type VCDStorage = { + id: string; + resourceStatus: string; + currentState: VCDStorageState; + currentTasks?: Task[]; +}; diff --git a/packages/manager/modules/vcd-api/src/types/vcd-utility.type.ts b/packages/manager/modules/vcd-api/src/types/vcd-utility.type.ts new file mode 100644 index 000000000000..4312800cd08f --- /dev/null +++ b/packages/manager/modules/vcd-api/src/types/vcd-utility.type.ts @@ -0,0 +1,22 @@ +import { IamObject } from '@ovh-ux/manager-react-components'; + +export type ObjectValues = T[keyof T]; + +export type WithIam = T & { iam: IamObject }; + +export type BillingType = 'MONTHLY' | 'DEMO'; + +export type ResourceStatus = + | 'READY' + | 'CREATING' + | 'DISABLED' + | 'DISABLING' + | 'REMOVED' + | 'UPDATING'; + +export type Task = { + id: string; + link: string; + status: 'ERROR' | 'PENDING' | 'RUNNING' | 'SCHEDULED' | null; + type: string; +}; diff --git a/packages/manager/apps/veeam-backup/src/data/catalog.type.ts b/packages/manager/modules/vcd-api/src/types/veeam-backup-catalog.type.ts similarity index 100% rename from packages/manager/apps/veeam-backup/src/data/catalog.type.ts rename to packages/manager/modules/vcd-api/src/types/veeam-backup-catalog.type.ts diff --git a/packages/manager/modules/vcd-api/src/types/veeam-backup.type.ts b/packages/manager/modules/vcd-api/src/types/veeam-backup.type.ts new file mode 100644 index 000000000000..7e28c4b378fc --- /dev/null +++ b/packages/manager/modules/vcd-api/src/types/veeam-backup.type.ts @@ -0,0 +1,43 @@ +import { ResourceStatus, WithIam } from './vcd-utility.type'; + +export type AvailabilityZone = + | 'ca-east-bhs-a' + | 'eu-central-waw-a' + | 'eu-west-eri-a' + | 'eu-west-lim-a' + | 'eu-west-rbx-a' + | 'eu-west-sbg-a'; + +export enum BackupStatus { + active = 'active', + none = 'none', + error = 'error', +} + +export type VeeamBackupOffer = { + name: 'BRONZE' | 'SILVER' | 'GOLD'; + quotaInTB: number; + usedSpaceInGB: number; + status: + | 'READY' + | 'CREATING' + | 'DISABLED' + | 'DISABLING' + | 'REMOVED' + | 'UPDATING'; +}; + +export type VeeamBackup = WithIam<{ + id: string; + currentState: { + vms?: number; + offers: VeeamBackupOffer[]; + azName: AvailabilityZone; + }; + updatedAt: string; + createdAt: string; + resourceStatus: ResourceStatus; + targetSpec: { + offers: Omit[]; + }; +}>; diff --git a/packages/manager/modules/vcd-api/src/utils/apiRoutes.ts b/packages/manager/modules/vcd-api/src/utils/apiRoutes.ts new file mode 100644 index 000000000000..c6f6f66344e3 --- /dev/null +++ b/packages/manager/modules/vcd-api/src/utils/apiRoutes.ts @@ -0,0 +1,28 @@ +export const VCD_ORGANIZATION_ROUTE = '/vmwareCloudDirector/organization'; + +export const getVcdOrganizationRoute = (id: string) => { + return `${VCD_ORGANIZATION_ROUTE}/${id}`; +}; + +export const getVcdResetPasswordRoute = (id: string) => + `${VCD_ORGANIZATION_ROUTE}/${id}/password`; + +export const getVcdDatacentresRoute = (id: string) => { + return `${VCD_ORGANIZATION_ROUTE}/${id}/virtualDataCenter`; +}; + +export const getVcdDatacentreRoute = (id: string, vdcId: string) => { + return `${getVcdDatacentresRoute(id)}/${vdcId}`; +}; + +export const getVcdDatacentreComputeRoute = (id: string, vdcId: string) => { + return `${getVcdDatacentreRoute(id, vdcId)}/compute`; +}; + +export const getVcdDatacentreStorageRoute = (id: string, vdcId: string) => { + return `${getVcdDatacentreRoute(id, vdcId)}/storage`; +}; + +export const getVdcOrderableResourceRoute = (id: string, vdcId: string) => { + return `${getVcdDatacentreRoute(id, vdcId)}/orderableResource`; +}; diff --git a/packages/manager/modules/vcd-api/src/utils/iam.constants.ts b/packages/manager/modules/vcd-api/src/utils/iam.constants.ts new file mode 100644 index 000000000000..11675016baf2 --- /dev/null +++ b/packages/manager/modules/vcd-api/src/utils/iam.constants.ts @@ -0,0 +1,6 @@ +export const iamActions = { + vmwareCloudDirectorApiovhOrganizationEdit: + 'vmwareCloudDirector:apiovh:organization/edit', + vmwareCloudDirectorApiovhOrganizationVirtualDataCenterEdit: + 'vmwareCloudDirector:apiovh:organization/virtualDataCenter/edit', +}; diff --git a/packages/manager/modules/vcd-api/src/utils/index.ts b/packages/manager/modules/vcd-api/src/utils/index.ts new file mode 100644 index 000000000000..702008a7482d --- /dev/null +++ b/packages/manager/modules/vcd-api/src/utils/index.ts @@ -0,0 +1,3 @@ +export * from './apiRoutes'; +export * from './iam.constants'; +export * from './queryKeys'; diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/queryKeys.ts b/packages/manager/modules/vcd-api/src/utils/queryKeys.ts similarity index 72% rename from packages/manager/apps/hpc-vmware-managed-vcd/src/utils/queryKeys.ts rename to packages/manager/modules/vcd-api/src/utils/queryKeys.ts index 4386c620355c..02276bccdfc1 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/utils/queryKeys.ts +++ b/packages/manager/modules/vcd-api/src/utils/queryKeys.ts @@ -1,11 +1,20 @@ const vcdBaseKey = 'vmwareCloudDirector'; const vdcBaseKey = 'virtualDataCenter'; +const veeamBackupBaseKey = 'backup'; export const icebergListingQueryKey = 'servicesListingIceberg'; +// Veeam Backup +export const veeamBackupListQueryKey = [vcdBaseKey, veeamBackupBaseKey]; +export const getVeeamBackupQueryKey = (id: string) => [ + ...veeamBackupListQueryKey, + id, +]; +export const veeamBackupCatalogQueryKey = [veeamBackupBaseKey, 'catalog']; + // VCD organizations -export const getVcdOrganizationsQueryKey = () => [vcdBaseKey, 'organizations']; +export const vcdOrganizationListQueryKey = [vcdBaseKey, 'organizations']; export const getVcdOrganizationQueryKey = (id: string) => [ - ...getVcdOrganizationsQueryKey(), + ...vcdOrganizationListQueryKey, id, ]; export const getVcdOrganizationBackupQueryKey = (id: string) => [ @@ -23,13 +32,13 @@ export const getVcdCatalogQueryKey = (serviceName: string) => [ serviceName, ]; -// VCD Organization virtualDataCenters -export const getVcdDatacentresQueryKey = (id: string) => [ +// VCD organization virtualDataCenters +export const getVcdDatacentreListQueryKey = (id: string) => [ ...getVcdOrganizationQueryKey(id), vdcBaseKey, ]; export const getVcdDatacentreQueryKey = (id: string, vdcId: string) => [ - ...getVcdDatacentresQueryKey(id), + ...getVcdDatacentreListQueryKey(id), vdcId, ]; diff --git a/packages/manager/modules/vcd-api/tsconfig.json b/packages/manager/modules/vcd-api/tsconfig.json new file mode 100644 index 000000000000..130eeca92488 --- /dev/null +++ b/packages/manager/modules/vcd-api/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "lib": ["dom", "es2021"], + "target": "es2021", + "types": ["vite/client", "node", "jest"], + "module": "ES2020", + "outDir": "dist", + "allowJs": false, + "skipLibCheck": true, + "esModuleInterop": false, + "allowSyntheticDefaultImports": true, + "moduleResolution": "Node", + "isolatedModules": true, + "declaration": true, + "declarationDir": "./dist/types", + "jsx": "react-jsx" + }, + "exclude": [ + "node_modules", + "dist", + "types", + "**/__tests__", + "src/**/*.spec.ts" + ] +} diff --git a/packages/manager/modules/vcd-api/vitest.config.js b/packages/manager/modules/vcd-api/vitest.config.js new file mode 100644 index 000000000000..10167ca243e2 --- /dev/null +++ b/packages/manager/modules/vcd-api/vitest.config.js @@ -0,0 +1,29 @@ +import { defineConfig } from 'vite'; +import react from '@vitejs/plugin-react'; + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [react()], + test: { + globals: true, + environment: 'jsdom', + coverage: { + include: ['src'], + exclude: [], + }, + testTimeout: 60000, + fileParallelism: false, + maxWorkers: 1, + pollOptions: { + forks: { + singleFork: true, + }, + threads: { + singleThread: true, + }, + }, + }, + resolve: { + mainFields: ['module'], + }, +}); diff --git a/yarn.lock b/yarn.lock index 3d11cab70a8b..dd9a095314a4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9928,15 +9928,6 @@ test-exclude "^7.0.1" tinyrainbow "^1.2.0" -"@vitest/expect@1.3.1": - version "1.3.1" - resolved "https://registry.npmjs.org/@vitest/expect/-/expect-1.3.1.tgz#d4c14b89c43a25fd400a6b941f51ba27fe0cb918" - integrity sha512-xofQFwIzfdmLLlHa6ag0dPV8YsnKOCP1KdAeVVh34vSjN2dcUiXYCD9htu/9eM7t8Xln4v03U9HLxLpPlsXdZw== - dependencies: - "@vitest/spy" "1.3.1" - "@vitest/utils" "1.3.1" - chai "^4.3.10" - "@vitest/expect@1.4.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-1.4.0.tgz#d64e17838a20007fecd252397f9b96a1ca81bfb0" @@ -10154,13 +10145,6 @@ magic-string "^0.30.12" pathe "^1.1.2" -"@vitest/spy@1.3.1": - version "1.3.1" - resolved "https://registry.npmjs.org/@vitest/spy/-/spy-1.3.1.tgz#814245d46d011b99edd1c7528f5725c64e85a88b" - integrity sha512-xAcW+S099ylC9VLU7eZfdT9myV67Nor9w9zhf0mGCYJSO+zM2839tOeROTdikOi/8Qeusffvxb/MyBSOja1Uig== - dependencies: - tinyspy "^2.2.0" - "@vitest/spy@1.4.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-1.4.0.tgz#cf953c93ae54885e801cbe6b408a547ae613f26c" From 30cd2f14129678f38d03dcd8ca338ad56be82489 Mon Sep 17 00:00:00 2001 From: Thibault Barske Date: Mon, 9 Dec 2024 16:35:12 +0100 Subject: [PATCH 3/9] feat(iam): remove pagination on type request ref: MANAGER-16351 Signed-off-by: Thibault Barske --- .../src/components/resourceSelect/resourceSelect.template.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/manager/modules/iam/src/components/resourceSelect/resourceSelect.template.html b/packages/manager/modules/iam/src/components/resourceSelect/resourceSelect.template.html index 86e3c48ec3e5..7fdc7a496a8d 100644 --- a/packages/manager/modules/iam/src/components/resourceSelect/resourceSelect.template.html +++ b/packages/manager/modules/iam/src/components/resourceSelect/resourceSelect.template.html @@ -15,7 +15,7 @@ > Date: Wed, 20 Nov 2024 11:25:57 +0100 Subject: [PATCH 4/9] feat(iam): add VCD translations in iam policy configuration ref: MANAGER-15957 Signed-off-by: Paul Dickerson --- .../manager/modules/iam/src/translations/Messages_de_DE.json | 5 ++++- .../manager/modules/iam/src/translations/Messages_en_GB.json | 5 ++++- .../manager/modules/iam/src/translations/Messages_es_ES.json | 5 ++++- .../manager/modules/iam/src/translations/Messages_fr_CA.json | 3 +++ .../manager/modules/iam/src/translations/Messages_fr_FR.json | 3 +++ .../manager/modules/iam/src/translations/Messages_it_IT.json | 5 ++++- .../manager/modules/iam/src/translations/Messages_pl_PL.json | 5 ++++- .../manager/modules/iam/src/translations/Messages_pt_PT.json | 5 ++++- 8 files changed, 30 insertions(+), 6 deletions(-) diff --git a/packages/manager/modules/iam/src/translations/Messages_de_DE.json b/packages/manager/modules/iam/src/translations/Messages_de_DE.json index 38df3ee2f105..be2cefca0dc2 100644 --- a/packages/manager/modules/iam/src/translations/Messages_de_DE.json +++ b/packages/manager/modules/iam/src/translations/Messages_de_DE.json @@ -97,5 +97,8 @@ "iam_resource_type_okms": "Key Management System (KMS)", "iam_resource_type_okms/kmip": "Key Management System (KMS)/KMIP", "iam_resource_type_okms/serviceKey": "Key Management System (KMS)/Schlüssel", - "iam_resource_type_licenseHycu": "HYCU for OVHcloud" + "iam_resource_type_licenseHycu": "HYCU for OVHcloud", + "iam_resource_type_vmwareCloudDirector": "VCD on OVHcloud", + "iam_resource_type_vmwareCloudDirector/virtualDataCenter": "VDC on OVHcloud", + "iam_resource_type_vmwareCloudDirectorBackup": "VEEAM Backup on OVHcloud" } diff --git a/packages/manager/modules/iam/src/translations/Messages_en_GB.json b/packages/manager/modules/iam/src/translations/Messages_en_GB.json index 281840d9e080..b4bfdb7e6c11 100644 --- a/packages/manager/modules/iam/src/translations/Messages_en_GB.json +++ b/packages/manager/modules/iam/src/translations/Messages_en_GB.json @@ -97,5 +97,8 @@ "iam_resource_type_okms": "Key Management System (KMS)", "iam_resource_type_okms/kmip": "Key Management System (KMS) / KMIP", "iam_resource_type_okms/serviceKey": "Key Management System (KMS) / Key", - "iam_resource_type_licenseHycu": "HYCU for OVHcloud" + "iam_resource_type_licenseHycu": "HYCU for OVHcloud", + "iam_resource_type_vmwareCloudDirector": "VCD on OVHcloud", + "iam_resource_type_vmwareCloudDirector/virtualDataCenter": "VDC on OVHcloud", + "iam_resource_type_vmwareCloudDirectorBackup": "VEEAM backup on OVHcloud" } diff --git a/packages/manager/modules/iam/src/translations/Messages_es_ES.json b/packages/manager/modules/iam/src/translations/Messages_es_ES.json index 315e2550614d..7b59da107416 100644 --- a/packages/manager/modules/iam/src/translations/Messages_es_ES.json +++ b/packages/manager/modules/iam/src/translations/Messages_es_ES.json @@ -97,5 +97,8 @@ "iam_resource_type_okms": "Key Management System (KMS)", "iam_resource_type_okms/kmip": "Key Management System (KMS) / KMIP", "iam_resource_type_okms/serviceKey": "Key Management System (KMS) / Clave", - "iam_resource_type_licenseHycu": "HYCU for OVHcloud" + "iam_resource_type_licenseHycu": "HYCU for OVHcloud", + "iam_resource_type_vmwareCloudDirector": "VCD on OVHcloud", + "iam_resource_type_vmwareCloudDirector/virtualDataCenter": "VDC on OVHcloud", + "iam_resource_type_vmwareCloudDirectorBackup": "Veeam Backup on OVHcloud" } diff --git a/packages/manager/modules/iam/src/translations/Messages_fr_CA.json b/packages/manager/modules/iam/src/translations/Messages_fr_CA.json index 40b03af1831d..32c378387210 100644 --- a/packages/manager/modules/iam/src/translations/Messages_fr_CA.json +++ b/packages/manager/modules/iam/src/translations/Messages_fr_CA.json @@ -81,6 +81,9 @@ "iam_resource_type_supportVIP": "Support VIP", "iam_resource_type_veeamCloudConnect": "Veeam Cloud Connect", "iam_resource_type_veeamEnterprise": "Veeam Enterprise", + "iam_resource_type_vmwareCloudDirector": "VCD on OVHcloud", + "iam_resource_type_vmwareCloudDirector/virtualDataCenter": "VDC on OVHcloud", + "iam_resource_type_vmwareCloudDirectorBackup": "VEEAM backup on OVHcloud", "iam_resource_type_voip": "Téléphonie (Ligne VoIP)", "iam_resource_type_voipAlias": "Alias VOIP", "iam_resource_type_voipLine": "Telephony (VoIP line)", diff --git a/packages/manager/modules/iam/src/translations/Messages_fr_FR.json b/packages/manager/modules/iam/src/translations/Messages_fr_FR.json index 40b03af1831d..32c378387210 100644 --- a/packages/manager/modules/iam/src/translations/Messages_fr_FR.json +++ b/packages/manager/modules/iam/src/translations/Messages_fr_FR.json @@ -81,6 +81,9 @@ "iam_resource_type_supportVIP": "Support VIP", "iam_resource_type_veeamCloudConnect": "Veeam Cloud Connect", "iam_resource_type_veeamEnterprise": "Veeam Enterprise", + "iam_resource_type_vmwareCloudDirector": "VCD on OVHcloud", + "iam_resource_type_vmwareCloudDirector/virtualDataCenter": "VDC on OVHcloud", + "iam_resource_type_vmwareCloudDirectorBackup": "VEEAM backup on OVHcloud", "iam_resource_type_voip": "Téléphonie (Ligne VoIP)", "iam_resource_type_voipAlias": "Alias VOIP", "iam_resource_type_voipLine": "Telephony (VoIP line)", diff --git a/packages/manager/modules/iam/src/translations/Messages_it_IT.json b/packages/manager/modules/iam/src/translations/Messages_it_IT.json index 3a38997b9488..79208ed6686e 100644 --- a/packages/manager/modules/iam/src/translations/Messages_it_IT.json +++ b/packages/manager/modules/iam/src/translations/Messages_it_IT.json @@ -97,5 +97,8 @@ "iam_resource_type_okms": "Key Management System (KMS)", "iam_resource_type_okms/kmip": "Key Management System (KMS)/KMIP", "iam_resource_type_okms/serviceKey": "Key Management System (KMS)/Chiave", - "iam_resource_type_licenseHycu": "HYCU for OVHcloud" + "iam_resource_type_licenseHycu": "HYCU for OVHcloud", + "iam_resource_type_vmwareCloudDirector": "VCD on OVHcloud", + "iam_resource_type_vmwareCloudDirector/virtualDataCenter": "VCD on OVHcloud", + "iam_resource_type_vmwareCloudDirectorBackup": "Veeam Backup on OVHcloud" } diff --git a/packages/manager/modules/iam/src/translations/Messages_pl_PL.json b/packages/manager/modules/iam/src/translations/Messages_pl_PL.json index 83082c498384..0366819dd807 100644 --- a/packages/manager/modules/iam/src/translations/Messages_pl_PL.json +++ b/packages/manager/modules/iam/src/translations/Messages_pl_PL.json @@ -97,5 +97,8 @@ "iam_resource_type_okms": "Key Management System (KMS)", "iam_resource_type_okms/kmip": "Key Management System (KMS) / KMIP", "iam_resource_type_okms/serviceKey": "Key Management System (KMS) / Klucz", - "iam_resource_type_licenseHycu": "HYCU for OVHcloud" + "iam_resource_type_licenseHycu": "HYCU for OVHcloud", + "iam_resource_type_vmwareCloudDirector": "VCD on OVHcloud", + "iam_resource_type_vmwareCloudDirector/virtualDataCenter": "VDC on OVHcloud", + "iam_resource_type_vmwareCloudDirectorBackup": "Veeam Backup on OVHcloud" } diff --git a/packages/manager/modules/iam/src/translations/Messages_pt_PT.json b/packages/manager/modules/iam/src/translations/Messages_pt_PT.json index 5bb6a6260974..b997024d6ac1 100644 --- a/packages/manager/modules/iam/src/translations/Messages_pt_PT.json +++ b/packages/manager/modules/iam/src/translations/Messages_pt_PT.json @@ -97,5 +97,8 @@ "iam_resource_type_okms": "Key Management System (KMS)", "iam_resource_type_okms/kmip": "Key Management System (KMS) / KMIP", "iam_resource_type_okms/serviceKey": "Key Management System (KMS) / Chave", - "iam_resource_type_licenseHycu": "HYCU for OVHcloud" + "iam_resource_type_licenseHycu": "HYCU for OVHcloud", + "iam_resource_type_vmwareCloudDirector": "VCD on OVHcloud", + "iam_resource_type_vmwareCloudDirector/virtualDataCenter": "VDC on OVHcloud", + "iam_resource_type_vmwareCloudDirectorBackup": "VEEAM backup on OVHcloud" } From 82b511a747741b1b0ba7cc50f4d1da93e25320af Mon Sep 17 00:00:00 2001 From: Daniel Fiala Date: Wed, 2 Oct 2024 14:08:10 +0200 Subject: [PATCH 5/9] feat(iam): add applications tab (#13396) Signed-off-by: Daniel Fiala --- .../deleteEntity/deleteEntity.constants.js | 6 ++ .../deleteEntity/deleteEntity.controller.js | 10 ++++ .../translations/Messages_fr_FR.json | 6 ++ .../applications/applications.component.js | 13 +++++ .../applications/applications.controller.js | 23 ++++++++ .../applications/applications.module.js | 15 +++++ .../applications/applications.routing.js | 16 +++++ .../applications/applications.template.html | 58 +++++++++++++++++++ .../applications/delete/delete.module.js | 10 ++++ .../applications/delete/delete.routing.js | 43 ++++++++++++++ .../dashboard/applications/delete/index.js | 22 +++++++ .../iam/src/dashboard/applications/index.js | 22 +++++++ .../translations/Messages_fr_FR.json | 11 ++++ .../iam/src/dashboard/dashboard.module.js | 3 +- .../iam/src/dashboard/dashboard.template.html | 5 ++ .../translations/Messages_fr_FR.json | 3 +- .../manager/modules/iam/src/iam.constants.js | 16 +++++ .../manager/modules/iam/src/iam.service.js | 35 +++++++++++ 18 files changed, 315 insertions(+), 2 deletions(-) create mode 100644 packages/manager/modules/iam/src/dashboard/applications/applications.component.js create mode 100644 packages/manager/modules/iam/src/dashboard/applications/applications.controller.js create mode 100644 packages/manager/modules/iam/src/dashboard/applications/applications.module.js create mode 100644 packages/manager/modules/iam/src/dashboard/applications/applications.routing.js create mode 100644 packages/manager/modules/iam/src/dashboard/applications/applications.template.html create mode 100644 packages/manager/modules/iam/src/dashboard/applications/delete/delete.module.js create mode 100644 packages/manager/modules/iam/src/dashboard/applications/delete/delete.routing.js create mode 100644 packages/manager/modules/iam/src/dashboard/applications/delete/index.js create mode 100644 packages/manager/modules/iam/src/dashboard/applications/index.js create mode 100644 packages/manager/modules/iam/src/dashboard/applications/translations/Messages_fr_FR.json diff --git a/packages/manager/modules/iam/src/components/deleteEntity/deleteEntity.constants.js b/packages/manager/modules/iam/src/components/deleteEntity/deleteEntity.constants.js index c81d8cbefe3a..8f893f962d1d 100644 --- a/packages/manager/modules/iam/src/components/deleteEntity/deleteEntity.constants.js +++ b/packages/manager/modules/iam/src/components/deleteEntity/deleteEntity.constants.js @@ -29,6 +29,12 @@ export const DELETE_ENTITY_TAG = { error: TAG.RESOURCE_GROUPS__DELETE_GROUP_CONFIRM_BANNER__ERROR, success: TAG.RESOURCE_GROUPS__DELETE_GROUP_CONFIRM_BANNER__SUCCESS, }, + [ENTITY.APPLICATION]: { + close: TAG.DELETE_APPLICATION__CANCEL, + delete: TAG.DELETE_APPLICATION__CONFIRM, + error: TAG.APPLICATIONS__DELETE_APPLICATION_CONFIRM_BANNER__ERROR, + success: TAG.APPLICATIONS__DELETE_APPLICATION_CONFIRM_BANNER__SUCCESS, + }, }; export default { diff --git a/packages/manager/modules/iam/src/components/deleteEntity/deleteEntity.controller.js b/packages/manager/modules/iam/src/components/deleteEntity/deleteEntity.controller.js index 43e7ab51d055..5db09ba3f061 100644 --- a/packages/manager/modules/iam/src/components/deleteEntity/deleteEntity.controller.js +++ b/packages/manager/modules/iam/src/components/deleteEntity/deleteEntity.controller.js @@ -87,6 +87,8 @@ export default class DeleteEntityController { promise = this.deletePolicy(); } else if (this.entity.type === ENTITY.RESOURCE_GROUP) { promise = this.deleteResourceGroup(); + } else if (this.entity.type === ENTITY.APPLICATION) { + promise = this.deleteApplication(); } else if (this.entity.type === ENTITY.RESOURCE_TYPE) { promise = this.$q.when(true); } else { @@ -135,6 +137,14 @@ export default class DeleteEntityController { return this.IAMService.deleteResourceGroup(this.entity.data.id); } + /** + * Delete the entity using the IAMService + * @returns {Promise} + */ + deleteApplication() { + return this.IAMService.deleteApplication(this.entity.data.applicationId); + } + /** * Custom trackClick wrapper witch uses the tagPrefix bound property * @param {'close'|'delete'} tagKey diff --git a/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_fr_FR.json b/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_fr_FR.json index ee9760ceb484..219b8e27bcd9 100644 --- a/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_fr_FR.json +++ b/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_fr_FR.json @@ -12,6 +12,12 @@ "iam_delete_entity_resourceGroup_name": "Suppression du groupe de ressources : ", "iam_delete_entity_resourceGroup_success": "Le groupe de ressources a bien été supprimé", "iam_delete_entity_resourceGroup_warn": "Êtes-vous sûr.e de confirmer la suppression ?", + "iam_delete_entity_application_error": "An error occurred while deleting the application: {{ message }}", + "iam_delete_entity_application_field": "Please enter the word \"{{ statement }}\" to delete your application", + "iam_delete_entity_application_heading": "Delete an application", + "iam_delete_entity_application_name": "Deleting application: ", + "iam_delete_entity_application_success": "Application deleted", + "iam_delete_entity_application_warn": "Warning: this action will delete the application and it will revoke all credential belonging to this application.", "iam_delete_entity_resourceType_error": "Une erreur est survenue lors de la suppression du type de produit : {{ message }}", "iam_delete_entity_resourceType_heading": "Supprimer un type de produit", "iam_delete_entity_resourceType_name": "Suppression du type de produit : ", diff --git a/packages/manager/modules/iam/src/dashboard/applications/applications.component.js b/packages/manager/modules/iam/src/dashboard/applications/applications.component.js new file mode 100644 index 000000000000..73fb0aac643c --- /dev/null +++ b/packages/manager/modules/iam/src/dashboard/applications/applications.component.js @@ -0,0 +1,13 @@ +import controller from './applications.controller'; +import template from './applications.template.html'; + +export default { + bindings: { + applications: '<', + alert: '<', + goTo: '<', + trackClick: '<', + }, + controller, + template, +}; diff --git a/packages/manager/modules/iam/src/dashboard/applications/applications.controller.js b/packages/manager/modules/iam/src/dashboard/applications/applications.controller.js new file mode 100644 index 000000000000..06eabc3a15f5 --- /dev/null +++ b/packages/manager/modules/iam/src/dashboard/applications/applications.controller.js @@ -0,0 +1,23 @@ +import { AbstractCursorDatagridController } from '@ovh-ux/manager-ng-apiv2-helper'; +import { TAG } from '../../iam.constants'; + +export default class ApplicationsController extends AbstractCursorDatagridController { + /* @ngInject */ + constructor(IAMService) { + super(); + this.IAMService = IAMService; + } + + /** + * Go to resourceGroup deletion + * @param {string} id The application id + * @returns {Promise} + */ + deleteApplication(id) { + this.trackClick(TAG.APPLICATIONS__DELETE); + this.goTo({ + name: 'iam.dashboard.applications.delete', + params: { application: id }, + }); + } +} diff --git a/packages/manager/modules/iam/src/dashboard/applications/applications.module.js b/packages/manager/modules/iam/src/dashboard/applications/applications.module.js new file mode 100644 index 000000000000..7964aa5aaa33 --- /dev/null +++ b/packages/manager/modules/iam/src/dashboard/applications/applications.module.js @@ -0,0 +1,15 @@ +import angular from 'angular'; + +import component from './applications.component'; +import routing from './applications.routing'; +import deleteModule from './delete'; + +const moduleName = 'ovhManagerIAMDashboardApplications'; + +angular + .module(moduleName, [deleteModule]) + .component('iamApplications', component) + .config(routing) + .run(/* @ngTranslationsInject:json ./translations */); + +export default moduleName; diff --git a/packages/manager/modules/iam/src/dashboard/applications/applications.routing.js b/packages/manager/modules/iam/src/dashboard/applications/applications.routing.js new file mode 100644 index 000000000000..ab3a7af20b89 --- /dev/null +++ b/packages/manager/modules/iam/src/dashboard/applications/applications.routing.js @@ -0,0 +1,16 @@ +import { TAG } from '../../iam.constants'; + +export default /* @ngInject */ ($stateProvider) => { + $stateProvider.state('iam.dashboard.applications', { + url: '/applications?cursors', + component: 'iamApplications', + resolve: { + breadcrumb: () => null, + applications: /* @ngInject */ (IAMService) => + IAMService.getApplications(), + }, + atInternet: { + rename: TAG.APPLICATIONS, + }, + }); +}; diff --git a/packages/manager/modules/iam/src/dashboard/applications/applications.template.html b/packages/manager/modules/iam/src/dashboard/applications/applications.template.html new file mode 100644 index 000000000000..a3b2df6f42f3 --- /dev/null +++ b/packages/manager/modules/iam/src/dashboard/applications/applications.template.html @@ -0,0 +1,58 @@ +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/packages/manager/modules/iam/src/dashboard/applications/delete/delete.module.js b/packages/manager/modules/iam/src/dashboard/applications/delete/delete.module.js new file mode 100644 index 000000000000..db5b906b908a --- /dev/null +++ b/packages/manager/modules/iam/src/dashboard/applications/delete/delete.module.js @@ -0,0 +1,10 @@ +import angular from 'angular'; + +import deleteEntity from '../../../components/deleteEntity'; +import routing from './delete.routing'; + +const moduleName = 'ovhManagerIAMDashboardApplicationsDelete'; + +angular.module(moduleName, [deleteEntity]).config(routing); + +export default moduleName; diff --git a/packages/manager/modules/iam/src/dashboard/applications/delete/delete.routing.js b/packages/manager/modules/iam/src/dashboard/applications/delete/delete.routing.js new file mode 100644 index 000000000000..90a843484806 --- /dev/null +++ b/packages/manager/modules/iam/src/dashboard/applications/delete/delete.routing.js @@ -0,0 +1,43 @@ +import { ENTITY, TAG } from '../../../iam.constants'; + +export default /* @ngInject */ ($stateProvider) => { + $stateProvider.state('iam.dashboard.applications.delete', { + url: '/delete/{application:string}', + component: 'iamDeleteEntity', + resolve: { + breadcrumb: () => null, + + /** + * A polymorphic DTO required by the deleteEntity component + * @returns {{ + * data: Object, + * type: string + * }|null} + */ + entity: /* @ngInject */ (application) => { + if (application) { + return { data: application, type: ENTITY.APPLICATION }; + } + return null; + }, + + /** + * The application to delete if an id is provided + * @returns {Object|null} + */ + application: /* @ngInject */ ($transition$, IAMService) => { + const { application: id } = $transition$.params(); + return id ? IAMService.getApplication(id) : null; + }, + + /** + * Whether the entity requires a statement + * @returns {boolean} + */ + statement: /* @ngInject */ (entity) => entity.type === ENTITY.APPLICATION, + }, + atInternet: { + rename: TAG.DELETE_APPLICATION, + }, + }); +}; diff --git a/packages/manager/modules/iam/src/dashboard/applications/delete/index.js b/packages/manager/modules/iam/src/dashboard/applications/delete/index.js new file mode 100644 index 000000000000..eef7e516159b --- /dev/null +++ b/packages/manager/modules/iam/src/dashboard/applications/delete/index.js @@ -0,0 +1,22 @@ +import angular from 'angular'; +import uiRouter from '@uirouter/angularjs'; +import ocLazyLoad from 'oclazyload'; + +const moduleName = 'ovhManagerIAMDashboardApplicationsDeleteLazyLoading'; + +angular.module(moduleName, [uiRouter, ocLazyLoad]).config( + /* @ngInject */ ($stateProvider) => { + $stateProvider.state('iam.dashboard.applications.delete.**', { + url: '/delete/{application:string}', + lazyLoad: (transition) => + import('./delete.module').then((module) => + transition + .injector() + .get('$ocLazyLoad') + .inject(module.default), + ), + }); + }, +); + +export default moduleName; diff --git a/packages/manager/modules/iam/src/dashboard/applications/index.js b/packages/manager/modules/iam/src/dashboard/applications/index.js new file mode 100644 index 000000000000..23a1506e0af1 --- /dev/null +++ b/packages/manager/modules/iam/src/dashboard/applications/index.js @@ -0,0 +1,22 @@ +import angular from 'angular'; +import uiRouter from '@uirouter/angularjs'; +import ocLazyLoad from 'oclazyload'; + +const moduleName = 'ovhManagerIAMDashboardApplicationsLazyLoading'; + +angular.module(moduleName, [uiRouter, ocLazyLoad]).config( + /* @ngInject */ ($stateProvider) => { + $stateProvider.state('iam.dashboard.applications.**', { + url: '/applications', + lazyLoad: (transition) => + import('./applications.module').then((module) => + transition + .injector() + .get('$ocLazyLoad') + .inject(module.default), + ), + }); + }, +); + +export default moduleName; diff --git a/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_fr_FR.json b/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_fr_FR.json new file mode 100644 index 000000000000..a9b0af94d96e --- /dev/null +++ b/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_fr_FR.json @@ -0,0 +1,11 @@ +{ + "iam_applications_datagrid_column_application_id": "Application id", + "iam_applications_datagrid_column_application_name": "Application name", + "iam_applications_datagrid_column_application_description": "Description", + "iam_applications_datagrid_column_application_status": "Status", + "iam_applications_datagrid_column_application_status_active": "Active", + "iam_applications_datagrid_column_application_status_inactive": "Inactive", + "iam_applications_datagrid_column_application_key": "Application key", + "iam_applications_datagrid_action_delete_application": "Delete application", + "iam_applications_description": "View and manage your applications. For more information about applications, see the documentation." +} diff --git a/packages/manager/modules/iam/src/dashboard/dashboard.module.js b/packages/manager/modules/iam/src/dashboard/dashboard.module.js index 5a61865b226b..8a48ad100465 100644 --- a/packages/manager/modules/iam/src/dashboard/dashboard.module.js +++ b/packages/manager/modules/iam/src/dashboard/dashboard.module.js @@ -2,6 +2,7 @@ import angular from 'angular'; import policies from './policies'; import resourceGroups from './resourceGroups'; +import applications from './applications'; import users from './users/users.module'; import component from './dashboard.component'; @@ -10,7 +11,7 @@ import routing from './dashboard.routing'; const moduleName = 'ovhManagerIAMDashboard'; angular - .module(moduleName, [policies, resourceGroups, users]) + .module(moduleName, [policies, resourceGroups, applications, users]) .component('iamDashboard', component) .config(routing) .run(/* @ngTranslationsInject:json ./translations */); diff --git a/packages/manager/modules/iam/src/dashboard/dashboard.template.html b/packages/manager/modules/iam/src/dashboard/dashboard.template.html index 3635635ac992..235edf80be4c 100644 --- a/packages/manager/modules/iam/src/dashboard/dashboard.template.html +++ b/packages/manager/modules/iam/src/dashboard/dashboard.template.html @@ -19,6 +19,11 @@ data-translate="iam_dashboard_header_tabs_item_resource_groups" > + diff --git a/packages/manager/modules/iam/src/dashboard/translations/Messages_fr_FR.json b/packages/manager/modules/iam/src/dashboard/translations/Messages_fr_FR.json index d94cde1eb64d..783923c7c582 100644 --- a/packages/manager/modules/iam/src/dashboard/translations/Messages_fr_FR.json +++ b/packages/manager/modules/iam/src/dashboard/translations/Messages_fr_FR.json @@ -4,5 +4,6 @@ "iam_dashboard_header_heading": "Gestion des identités et des accès (IAM)", "iam_dashboard_header_tabs_item_identities": "Identités", "iam_dashboard_header_tabs_item_policies": "Politiques", - "iam_dashboard_header_tabs_item_resource_groups": "Groupes de ressources" + "iam_dashboard_header_tabs_item_resource_groups": "Groupes de ressources", + "iam_dashboard_header_tabs_item_applications": "Applications" } diff --git a/packages/manager/modules/iam/src/iam.constants.js b/packages/manager/modules/iam/src/iam.constants.js index d8d49907fbeb..6ba26d885648 100644 --- a/packages/manager/modules/iam/src/iam.constants.js +++ b/packages/manager/modules/iam/src/iam.constants.js @@ -35,6 +35,7 @@ const ENTITY = { IDENTITY: 'identity', RESOURCE_GROUP: 'resourceGroup', RESOURCE_TYPE: 'resourceType', + APPLICATION: 'application', }; const ENTITY_NAME_PATTERN = /^[a-zA-Z0-9-/_+]*$/; @@ -192,6 +193,11 @@ const TAG = { 'dedicated::account::iam::delete-group-ressources::cancel', DELETE_RESOURCE_GROUP__CONFIRM: 'dedicated::account::iam::delete-group-ressources::confirm', + DELETE_APPLICATION: 'dedicated::account::iam::delete-application', + DELETE_APPLICATION__CANCEL: + 'dedicated::account::iam::delete-application::cancel', + DELETE_APPLICATION__CONFIRM: + 'dedicated::account::iam::delete-application::confirm', // Policy edition EDIT_POLICY: 'dedicated::account::iam::edit-policy', @@ -254,6 +260,16 @@ const TAG = { RESOURCE_GROUPS__EDIT_GROUP_CONFIRM_BANNER__SUCCESS: 'iam::group-ressources::edit-group-confirm-banner::success', + // List of applications + APPLICATIONS: 'dedicated::account::iam::applications', + APPLICATIONS__DELETE: 'dedicated::account::iam::applications::delete', + + // List of applications - banners + APPLICATIONS__DELETE_APPLICATION_CONFIRM_BANNER__ERROR: + 'iam::applications::delete-application-confirm-banner::error', + APPLICATIONS__DELETE_APPLICATION_CONFIRM_BANNER__SUCCESS: + 'iam::applications::delete-application-confirm-banner::success', + // Commons ADD_ACTION_MANUALLY_SUCCESS: 'add-manually-success', ADD_ACTION_MANUALLY: 'add-manually', diff --git a/packages/manager/modules/iam/src/iam.service.js b/packages/manager/modules/iam/src/iam.service.js index 6dac09cd64d4..e181eb44f242 100644 --- a/packages/manager/modules/iam/src/iam.service.js +++ b/packages/manager/modules/iam/src/iam.service.js @@ -11,6 +11,7 @@ export const URL = { RESOURCE_GROUP: '/engine/api/v2/iam/resourceGroup', RESOURCE_TYPE: '/engine/api/v2/iam/reference/resource/type', PERMISSIONS_GROUPS: '/engine/api/v2/iam/permissionsGroup', + APPLICATIONS: '/me/api/application', }; export default class IAMService { @@ -489,4 +490,38 @@ export default class IAMService { data, }).then(({ data: resourceGroup }) => resourceGroup); } + + /** + * Retrieves a list of all applications. + * @returns {Promise} A Promise that resolves to an array of application objects, or null if an application fetch fails. + */ + getApplications() { + return this.$http + .get(URL.APPLICATIONS) + .then(({ data }) => + this.$q.all( + data + .map((id) => this.getApplication(id).catch(() => null)) + .filter((application) => application !== null), + ), + ); + } + + /** + * Retrieves the details of a specific application. + * @param {string} id The unique identifier of the application. + * @returns {Promise} A Promise that resolves to the application object. + */ + getApplication(id) { + return this.$http.get(`${URL.APPLICATIONS}/${id}`).then(({ data }) => data); + } + + /** + * Deletes an application. + * @param {string} id The unique identifier of the application to be deleted. + * @returns {Promise} A Promise that resolves when the deletion is complete. + */ + deleteApplication(id) { + return this.$http.delete(`${URL.APPLICATIONS}/${id}`); + } } From 9290b672a9498d3aef4dbc7f26989ea77a63fb9d Mon Sep 17 00:00:00 2001 From: Romain Jamet Date: Mon, 7 Oct 2024 10:12:47 +0200 Subject: [PATCH 6/9] fix(iam): update application tab translations ref: MANAGER-15410 Signed-off-by: Romain Jamet --- .../deleteEntity/translations/Messages_fr_FR.json | 12 ++++++------ .../applications/translations/Messages_fr_FR.json | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_fr_FR.json b/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_fr_FR.json index 219b8e27bcd9..cc9782db9345 100644 --- a/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_fr_FR.json +++ b/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_fr_FR.json @@ -12,12 +12,12 @@ "iam_delete_entity_resourceGroup_name": "Suppression du groupe de ressources : ", "iam_delete_entity_resourceGroup_success": "Le groupe de ressources a bien été supprimé", "iam_delete_entity_resourceGroup_warn": "Êtes-vous sûr.e de confirmer la suppression ?", - "iam_delete_entity_application_error": "An error occurred while deleting the application: {{ message }}", - "iam_delete_entity_application_field": "Please enter the word \"{{ statement }}\" to delete your application", - "iam_delete_entity_application_heading": "Delete an application", - "iam_delete_entity_application_name": "Deleting application: ", - "iam_delete_entity_application_success": "Application deleted", - "iam_delete_entity_application_warn": "Warning: this action will delete the application and it will revoke all credential belonging to this application.", + "iam_delete_entity_application_error": "L'application n'a pas pu être supprimée en raison d'une erreur : {{ message }}", + "iam_delete_entity_application_field": "Veuillez entrer le mot \"{{ statement }}\" pour confirmer la suppression de votre application", + "iam_delete_entity_application_heading": "Supprimer une application", + "iam_delete_entity_application_name": "Suppression de l'application : ", + "iam_delete_entity_application_success": "Application supprimée", + "iam_delete_entity_application_warn": "Avertissement : cette action supprimera l'application et révoquera tous les certificats associées à cette application.", "iam_delete_entity_resourceType_error": "Une erreur est survenue lors de la suppression du type de produit : {{ message }}", "iam_delete_entity_resourceType_heading": "Supprimer un type de produit", "iam_delete_entity_resourceType_name": "Suppression du type de produit : ", diff --git a/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_fr_FR.json b/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_fr_FR.json index a9b0af94d96e..6ab3b987bcff 100644 --- a/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_fr_FR.json +++ b/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_fr_FR.json @@ -1,11 +1,11 @@ { - "iam_applications_datagrid_column_application_id": "Application id", - "iam_applications_datagrid_column_application_name": "Application name", + "iam_applications_datagrid_column_application_id": "ID", + "iam_applications_datagrid_column_application_name": "Nom", "iam_applications_datagrid_column_application_description": "Description", - "iam_applications_datagrid_column_application_status": "Status", + "iam_applications_datagrid_column_application_status": "Statut", + "iam_applications_datagrid_column_application_key": "Clé", "iam_applications_datagrid_column_application_status_active": "Active", - "iam_applications_datagrid_column_application_status_inactive": "Inactive", - "iam_applications_datagrid_column_application_key": "Application key", - "iam_applications_datagrid_action_delete_application": "Delete application", - "iam_applications_description": "View and manage your applications. For more information about applications, see the documentation." + "iam_applications_datagrid_column_application_status_inactive": "Désactivée", + "iam_applications_datagrid_action_delete_application": "Supprimer", + "iam_applications_description": "Consultez et gérez vos applications. Pour plus d'informations sur les applications, consultez la documentation." } From 576c6664a421e7cfc69b73752dbe71a13fb0ebec Mon Sep 17 00:00:00 2001 From: Romain Jamet Date: Thu, 14 Nov 2024 18:08:13 +0100 Subject: [PATCH 7/9] fix(iam): fix application tracking constants ref: MANAGER-15410 Signed-off-by: Romain Jamet --- .../deleteEntity/translations/Messages_de_DE.json | 10 ++++++++-- .../deleteEntity/translations/Messages_en_GB.json | 10 ++++++++-- .../deleteEntity/translations/Messages_es_ES.json | 10 ++++++++-- .../deleteEntity/translations/Messages_fr_CA.json | 8 +++++++- .../deleteEntity/translations/Messages_it_IT.json | 10 ++++++++-- .../deleteEntity/translations/Messages_pl_PL.json | 10 ++++++++-- .../deleteEntity/translations/Messages_pt_PT.json | 10 ++++++++-- .../applications/translations/Messages_de_DE.json | 11 +++++++++++ .../applications/translations/Messages_en_GB.json | 11 +++++++++++ .../applications/translations/Messages_es_ES.json | 11 +++++++++++ .../applications/translations/Messages_fr_CA.json | 11 +++++++++++ .../applications/translations/Messages_it_IT.json | 11 +++++++++++ .../applications/translations/Messages_pl_PL.json | 11 +++++++++++ .../applications/translations/Messages_pt_PT.json | 11 +++++++++++ .../src/dashboard/translations/Messages_de_DE.json | 3 ++- .../src/dashboard/translations/Messages_en_GB.json | 3 ++- .../src/dashboard/translations/Messages_es_ES.json | 3 ++- .../src/dashboard/translations/Messages_fr_CA.json | 3 ++- .../src/dashboard/translations/Messages_it_IT.json | 3 ++- .../src/dashboard/translations/Messages_pl_PL.json | 3 ++- .../src/dashboard/translations/Messages_pt_PT.json | 3 ++- packages/manager/modules/iam/src/iam.constants.js | 4 ++-- 22 files changed, 148 insertions(+), 22 deletions(-) create mode 100644 packages/manager/modules/iam/src/dashboard/applications/translations/Messages_de_DE.json create mode 100644 packages/manager/modules/iam/src/dashboard/applications/translations/Messages_en_GB.json create mode 100644 packages/manager/modules/iam/src/dashboard/applications/translations/Messages_es_ES.json create mode 100644 packages/manager/modules/iam/src/dashboard/applications/translations/Messages_fr_CA.json create mode 100644 packages/manager/modules/iam/src/dashboard/applications/translations/Messages_it_IT.json create mode 100644 packages/manager/modules/iam/src/dashboard/applications/translations/Messages_pl_PL.json create mode 100644 packages/manager/modules/iam/src/dashboard/applications/translations/Messages_pt_PT.json diff --git a/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_de_DE.json b/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_de_DE.json index 006d9ea4cd88..f121c0a1854c 100644 --- a/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_de_DE.json +++ b/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_de_DE.json @@ -17,5 +17,11 @@ "iam_delete_entity_resourceType_name": "Löschen des Produkttyps: ", "iam_delete_entity_resourceType_success": "Der Produkttyp wurde gelöscht", "iam_delete_entity_resourceType_warn": "Achtung, mit dieser Aktion werden alle zugehörigen Ressourcen und ausgewählten Aktionen gelöscht", - "iam_delete_entity_secondary_label": "Abbrechen" -} \ No newline at end of file + "iam_delete_entity_secondary_label": "Abbrechen", + "iam_delete_entity_application_error": "Die Anwendung konnte aufgrund eines Fehlers nicht gelöscht werden: {{ message }}", + "iam_delete_entity_application_field": "Bitte geben Sie das Wort „{{ statement }}“ ein, um das Löschen Ihrer Anwendung zu bestätigen.", + "iam_delete_entity_application_heading": "Anwendung löschen", + "iam_delete_entity_application_name": "Löschung der Anwendung: ", + "iam_delete_entity_application_success": "Anwendung gelöscht", + "iam_delete_entity_application_warn": "Warnung: Durch diese Aktion wird die Anwendung gelöscht und alle dieser Anwendung zugeordneten Zertifikate werden widerrufen." +} diff --git a/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_en_GB.json b/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_en_GB.json index 368d8d7d0f2b..e11a76903cef 100644 --- a/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_en_GB.json +++ b/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_en_GB.json @@ -17,5 +17,11 @@ "iam_delete_entity_resourceType_name": "Deleting product type: ", "iam_delete_entity_resourceType_success": "Product type deleted", "iam_delete_entity_resourceType_warn": "Warning: this action will delete the associated resources and the selected actions", - "iam_delete_entity_secondary_label": "Exit" -} \ No newline at end of file + "iam_delete_entity_secondary_label": "Exit", + "iam_delete_entity_application_error": "An error occurred deleting the application: {{ message }}", + "iam_delete_entity_application_field": "Please enter the word “{{ statement }}” to confirm the deletion of your application", + "iam_delete_entity_application_heading": "Delete an application", + "iam_delete_entity_application_name": "Delete application: ", + "iam_delete_entity_application_success": "Application deleted", + "iam_delete_entity_application_warn": "Warning: This action will delete the application and revoke all associated certificates." +} diff --git a/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_es_ES.json b/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_es_ES.json index 287455a67170..d1cecfc635f6 100644 --- a/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_es_ES.json +++ b/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_es_ES.json @@ -17,5 +17,11 @@ "iam_delete_entity_resourceType_name": "Eliminación del tipo de producto: ", "iam_delete_entity_resourceType_success": "El tipo de producto se ha eliminado correctamente", "iam_delete_entity_resourceType_warn": "Atención: Esta acción eliminará los recursos asociados y las acciones seleccionadas", - "iam_delete_entity_secondary_label": "Cancelar" -} \ No newline at end of file + "iam_delete_entity_secondary_label": "Cancelar", + "iam_delete_entity_application_error": "No se ha podido eliminar la aplicación debido a un error: {{ message }}", + "iam_delete_entity_application_field": "Introduzca la palabra «{{ statement }}» para confirmar la eliminación de su aplicación.", + "iam_delete_entity_application_heading": "Eliminar una aplicación", + "iam_delete_entity_application_name": "Eliminación de la aplicación: ", + "iam_delete_entity_application_success": "Aplicación eliminada", + "iam_delete_entity_application_warn": "Importante: esta acción eliminará la aplicación y revocará todos los certificados asociados a dicha aplicación." +} diff --git a/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_fr_CA.json b/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_fr_CA.json index 1daca17d53e9..cc9782db9345 100644 --- a/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_fr_CA.json +++ b/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_fr_CA.json @@ -12,10 +12,16 @@ "iam_delete_entity_resourceGroup_name": "Suppression du groupe de ressources : ", "iam_delete_entity_resourceGroup_success": "Le groupe de ressources a bien été supprimé", "iam_delete_entity_resourceGroup_warn": "Êtes-vous sûr.e de confirmer la suppression ?", + "iam_delete_entity_application_error": "L'application n'a pas pu être supprimée en raison d'une erreur : {{ message }}", + "iam_delete_entity_application_field": "Veuillez entrer le mot \"{{ statement }}\" pour confirmer la suppression de votre application", + "iam_delete_entity_application_heading": "Supprimer une application", + "iam_delete_entity_application_name": "Suppression de l'application : ", + "iam_delete_entity_application_success": "Application supprimée", + "iam_delete_entity_application_warn": "Avertissement : cette action supprimera l'application et révoquera tous les certificats associées à cette application.", "iam_delete_entity_resourceType_error": "Une erreur est survenue lors de la suppression du type de produit : {{ message }}", "iam_delete_entity_resourceType_heading": "Supprimer un type de produit", "iam_delete_entity_resourceType_name": "Suppression du type de produit : ", "iam_delete_entity_resourceType_success": "Le type de produit a bien été supprimé", "iam_delete_entity_resourceType_warn": "Attention, cette action va entrainer la suppression des ressources associées et des actions sélectionnées", "iam_delete_entity_secondary_label": "Annuler" -} \ No newline at end of file +} diff --git a/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_it_IT.json b/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_it_IT.json index 3df4020dd370..d7bee04d3205 100644 --- a/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_it_IT.json +++ b/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_it_IT.json @@ -17,5 +17,11 @@ "iam_delete_entity_resourceType_name": "Eliminazione del tipo di prodotto: ", "iam_delete_entity_resourceType_success": "Il tipo di prodotto è stato eliminato correttamente", "iam_delete_entity_resourceType_warn": "Attenzione: questa azione comporta l'eliminazione delle risorse associate e delle azioni selezionate", - "iam_delete_entity_secondary_label": "Annullare" -} \ No newline at end of file + "iam_delete_entity_secondary_label": "Annullare", + "iam_delete_entity_application_error": "Impossibile eliminare l’applicazione a causa di un errore: {{ message }}", + "iam_delete_entity_application_field": "Inserisci la parola \"{{ statement }}\" per confermare l'eliminazione della tua applicazione.", + "iam_delete_entity_application_heading": "Eliminare un'applicazione", + "iam_delete_entity_application_name": "Eliminazione dell'applicazione ", + "iam_delete_entity_application_success": "Applicazione eliminata", + "iam_delete_entity_application_warn": "Importante: questa azione comporta l'eliminazione dell'applicazione e la revoca di tutti i certificati ad essa associati." +} diff --git a/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_pl_PL.json b/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_pl_PL.json index c512113f2db7..ce1f1b23aa8c 100644 --- a/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_pl_PL.json +++ b/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_pl_PL.json @@ -17,5 +17,11 @@ "iam_delete_entity_resourceType_name": "Usuwanie typu usługi: ", "iam_delete_entity_resourceType_success": "Typ usługi został usunięty", "iam_delete_entity_resourceType_warn": "Uwaga, ta operacja spowoduje usunięcie zasobów i powiązanych operacji.", - "iam_delete_entity_secondary_label": "Anuluj" -} \ No newline at end of file + "iam_delete_entity_secondary_label": "Anuluj", + "iam_delete_entity_application_error": "Aplikacja nie mogła zostać usunięta z powodu błędu: {{message}}", + "iam_delete_entity_application_field": "Wpisz słowo „{{ statement }}”, aby potwierdzić usunięcie aplikacji.", + "iam_delete_entity_application_heading": "Usuń aplikację", + "iam_delete_entity_application_name": "Usuwanie aplikacji: ", + "iam_delete_entity_application_success": "Aplikacja usunięta", + "iam_delete_entity_application_warn": "Ostrzeżenie: ta operacja spowoduje usunięcie aplikacji i unieważni wszystkie certyfikaty powiązane z tą aplikacją." +} diff --git a/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_pt_PT.json b/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_pt_PT.json index 15f5ffc05302..90533620e180 100644 --- a/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_pt_PT.json +++ b/packages/manager/modules/iam/src/components/deleteEntity/translations/Messages_pt_PT.json @@ -17,5 +17,11 @@ "iam_delete_entity_resourceType_name": "Eliminação do tipo de produto: ", "iam_delete_entity_resourceType_success": "O tipo de produto foi eliminado com sucesso", "iam_delete_entity_resourceType_warn": "Atenção, esta ação levará à eliminação dos recursos associados e das ações selecionadas", - "iam_delete_entity_secondary_label": "Anular" -} \ No newline at end of file + "iam_delete_entity_secondary_label": "Anular", + "iam_delete_entity_application_error": "Não foi possível eliminar a aplicação devido a um erro: {{ message }}", + "iam_delete_entity_application_field": "Introduza a palavra \"{{ statement }}\" para confirmar a eliminação da sua aplicação", + "iam_delete_entity_application_heading": "Eliminar uma aplicação", + "iam_delete_entity_application_name": "Eliminação da aplicação: ", + "iam_delete_entity_application_success": "Aplicação eliminada", + "iam_delete_entity_application_warn": "Atenção: esta ação eliminará a aplicação e revogará todos os certificados associados a esta aplicação." +} diff --git a/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_de_DE.json b/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_de_DE.json new file mode 100644 index 000000000000..292d38ac9135 --- /dev/null +++ b/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_de_DE.json @@ -0,0 +1,11 @@ +{ + "iam_applications_datagrid_column_application_id": "ID", + "iam_applications_datagrid_column_application_name": "Name", + "iam_applications_datagrid_column_application_description": "Beschreibung", + "iam_applications_datagrid_column_application_status": "Status", + "iam_applications_datagrid_column_application_key": "Schlüssel", + "iam_applications_datagrid_column_application_status_active": "Aktiv", + "iam_applications_datagrid_column_application_status_inactive": "Deaktiviert", + "iam_applications_datagrid_action_delete_application": "Löschen", + "iam_applications_description": "Sehen Sie sich Ihre Anwendungen an und verwalten Sie sie. Weitere Informationen zu den Anwendungen finden Sie in der Dokumentation." +} diff --git a/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_en_GB.json b/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_en_GB.json new file mode 100644 index 000000000000..eb0dc3a6b6f2 --- /dev/null +++ b/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_en_GB.json @@ -0,0 +1,11 @@ +{ + "iam_applications_datagrid_column_application_id": "ID", + "iam_applications_datagrid_column_application_name": "Name", + "iam_applications_datagrid_column_application_description": "Description", + "iam_applications_datagrid_column_application_status": "Status", + "iam_applications_datagrid_column_application_key": "Key", + "iam_applications_datagrid_column_application_status_active": "Active", + "iam_applications_datagrid_column_application_status_inactive": "Disabled", + "iam_applications_datagrid_action_delete_application": "Delete", + "iam_applications_description": "View and manage your applications. For more information about applications, see documentation." +} diff --git a/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_es_ES.json b/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_es_ES.json new file mode 100644 index 000000000000..2ba0941effaf --- /dev/null +++ b/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_es_ES.json @@ -0,0 +1,11 @@ +{ + "iam_applications_datagrid_column_application_id": "ID", + "iam_applications_datagrid_column_application_name": "Apellido", + "iam_applications_datagrid_column_application_description": "Descripción", + "iam_applications_datagrid_column_application_status": "Estado", + "iam_applications_datagrid_column_application_key": "Clave", + "iam_applications_datagrid_column_application_status_active": "Activo", + "iam_applications_datagrid_column_application_status_inactive": "Desactivada", + "iam_applications_datagrid_action_delete_application": "Eliminar", + "iam_applications_description": "Consulte y gestione sus aplicaciones. Para más información sobre las aplicaciones, consulte la documentación." +} diff --git a/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_fr_CA.json b/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_fr_CA.json new file mode 100644 index 000000000000..6ab3b987bcff --- /dev/null +++ b/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_fr_CA.json @@ -0,0 +1,11 @@ +{ + "iam_applications_datagrid_column_application_id": "ID", + "iam_applications_datagrid_column_application_name": "Nom", + "iam_applications_datagrid_column_application_description": "Description", + "iam_applications_datagrid_column_application_status": "Statut", + "iam_applications_datagrid_column_application_key": "Clé", + "iam_applications_datagrid_column_application_status_active": "Active", + "iam_applications_datagrid_column_application_status_inactive": "Désactivée", + "iam_applications_datagrid_action_delete_application": "Supprimer", + "iam_applications_description": "Consultez et gérez vos applications. Pour plus d'informations sur les applications, consultez la documentation." +} diff --git a/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_it_IT.json b/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_it_IT.json new file mode 100644 index 000000000000..2500bc91f738 --- /dev/null +++ b/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_it_IT.json @@ -0,0 +1,11 @@ +{ + "iam_applications_datagrid_column_application_id": "ID", + "iam_applications_datagrid_column_application_name": "Cognome", + "iam_applications_datagrid_column_application_description": "Descrizione", + "iam_applications_datagrid_column_application_status": "Stato", + "iam_applications_datagrid_column_application_key": "Chiave", + "iam_applications_datagrid_column_application_status_active": "Attivo", + "iam_applications_datagrid_column_application_status_inactive": "Disattivata", + "iam_applications_datagrid_action_delete_application": "Eliminare", + "iam_applications_description": "Consulta e gestisci le tue applicazioni. Per maggiori informazioni sulle applicazioni, consulta la documentazione." +} diff --git a/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_pl_PL.json b/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_pl_PL.json new file mode 100644 index 000000000000..57f467a0b739 --- /dev/null +++ b/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_pl_PL.json @@ -0,0 +1,11 @@ +{ + "iam_applications_datagrid_column_application_id": "ID", + "iam_applications_datagrid_column_application_name": "Nazwisko", + "iam_applications_datagrid_column_application_description": "Opis", + "iam_applications_datagrid_column_application_status": "Status", + "iam_applications_datagrid_column_application_key": "Klucz", + "iam_applications_datagrid_column_application_status_active": "Aktywny", + "iam_applications_datagrid_column_application_status_inactive": "Wyłączona", + "iam_applications_datagrid_action_delete_application": "Usuń", + "iam_applications_description": "Wyświetlaj aplikacje i zarządzaj nimi. Więcej informacji na temat aplikacji znajdziesz w dokumentacji." +} diff --git a/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_pt_PT.json b/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_pt_PT.json new file mode 100644 index 000000000000..d92639faa317 --- /dev/null +++ b/packages/manager/modules/iam/src/dashboard/applications/translations/Messages_pt_PT.json @@ -0,0 +1,11 @@ +{ + "iam_applications_datagrid_column_application_id": "ID", + "iam_applications_datagrid_column_application_name": "Nome", + "iam_applications_datagrid_column_application_description": "Descrição", + "iam_applications_datagrid_column_application_status": "Estado", + "iam_applications_datagrid_column_application_key": "Chave", + "iam_applications_datagrid_column_application_status_active": "Ativo", + "iam_applications_datagrid_column_application_status_inactive": "Désactivée", + "iam_applications_datagrid_action_delete_application": "Eliminar", + "iam_applications_description": "Consulte e faça a gestão das suas aplicações. Para obter mais informações sobre as aplicações, consulte a documentação." +} diff --git a/packages/manager/modules/iam/src/dashboard/translations/Messages_de_DE.json b/packages/manager/modules/iam/src/dashboard/translations/Messages_de_DE.json index b526d0f1b02b..1e2dde764361 100644 --- a/packages/manager/modules/iam/src/dashboard/translations/Messages_de_DE.json +++ b/packages/manager/modules/iam/src/dashboard/translations/Messages_de_DE.json @@ -4,5 +4,6 @@ "iam_dashboard_header_tabs_item_identities": "Identitäten", "iam_dashboard_header_tabs_item_policies": "Richtlinien", "iam_dashboard_header_tabs_item_resource_groups": "Ressourcengruppen", - "iam_error": "Sie sind nicht berechtigt, diese Aktion durchzuführen: {{details}}" + "iam_error": "Sie sind nicht berechtigt, diese Aktion durchzuführen: {{details}}", + "iam_dashboard_header_tabs_item_applications": "Anwendungen" } diff --git a/packages/manager/modules/iam/src/dashboard/translations/Messages_en_GB.json b/packages/manager/modules/iam/src/dashboard/translations/Messages_en_GB.json index 1aafc09e982a..2e4ef2ab49c0 100644 --- a/packages/manager/modules/iam/src/dashboard/translations/Messages_en_GB.json +++ b/packages/manager/modules/iam/src/dashboard/translations/Messages_en_GB.json @@ -4,5 +4,6 @@ "iam_dashboard_header_tabs_item_identities": "Identities", "iam_dashboard_header_tabs_item_policies": "Policies", "iam_dashboard_header_tabs_item_resource_groups": "Resource groups", - "iam_error": "You do not have the permissions to perform this action: {{details}}" + "iam_error": "You do not have the permissions to perform this action: {{details}}", + "iam_dashboard_header_tabs_item_applications": "Applications" } diff --git a/packages/manager/modules/iam/src/dashboard/translations/Messages_es_ES.json b/packages/manager/modules/iam/src/dashboard/translations/Messages_es_ES.json index d5c77f367e67..e5705458e829 100644 --- a/packages/manager/modules/iam/src/dashboard/translations/Messages_es_ES.json +++ b/packages/manager/modules/iam/src/dashboard/translations/Messages_es_ES.json @@ -4,5 +4,6 @@ "iam_dashboard_header_tabs_item_identities": "Identidades", "iam_dashboard_header_tabs_item_policies": "Políticas", "iam_dashboard_header_tabs_item_resource_groups": "Grupos de recursos", - "iam_error": "No tiene permisos para realizar esta acción: {{details}}" + "iam_error": "No tiene permisos para realizar esta acción: {{details}}", + "iam_dashboard_header_tabs_item_applications": "Aplicaciones" } diff --git a/packages/manager/modules/iam/src/dashboard/translations/Messages_fr_CA.json b/packages/manager/modules/iam/src/dashboard/translations/Messages_fr_CA.json index d94cde1eb64d..783923c7c582 100644 --- a/packages/manager/modules/iam/src/dashboard/translations/Messages_fr_CA.json +++ b/packages/manager/modules/iam/src/dashboard/translations/Messages_fr_CA.json @@ -4,5 +4,6 @@ "iam_dashboard_header_heading": "Gestion des identités et des accès (IAM)", "iam_dashboard_header_tabs_item_identities": "Identités", "iam_dashboard_header_tabs_item_policies": "Politiques", - "iam_dashboard_header_tabs_item_resource_groups": "Groupes de ressources" + "iam_dashboard_header_tabs_item_resource_groups": "Groupes de ressources", + "iam_dashboard_header_tabs_item_applications": "Applications" } diff --git a/packages/manager/modules/iam/src/dashboard/translations/Messages_it_IT.json b/packages/manager/modules/iam/src/dashboard/translations/Messages_it_IT.json index bd914dfad326..0ea8f4962eb7 100644 --- a/packages/manager/modules/iam/src/dashboard/translations/Messages_it_IT.json +++ b/packages/manager/modules/iam/src/dashboard/translations/Messages_it_IT.json @@ -4,5 +4,6 @@ "iam_dashboard_header_tabs_item_identities": "Identità", "iam_dashboard_header_tabs_item_policies": "Policy", "iam_dashboard_header_tabs_item_resource_groups": "Gruppi di risorse", - "iam_error": "Non hai i permessi per effettuare questa azione: {{details}}" + "iam_error": "Non hai i permessi per effettuare questa azione: {{details}}", + "iam_dashboard_header_tabs_item_applications": "Applicazioni" } diff --git a/packages/manager/modules/iam/src/dashboard/translations/Messages_pl_PL.json b/packages/manager/modules/iam/src/dashboard/translations/Messages_pl_PL.json index 83ac4882eac1..1ee086eedaaa 100644 --- a/packages/manager/modules/iam/src/dashboard/translations/Messages_pl_PL.json +++ b/packages/manager/modules/iam/src/dashboard/translations/Messages_pl_PL.json @@ -4,5 +4,6 @@ "iam_dashboard_header_tabs_item_identities": "Tożsamości", "iam_dashboard_header_tabs_item_policies": "Polityki", "iam_dashboard_header_tabs_item_resource_groups": "Grupy zasobów", - "iam_error": "Nie masz uprawnień do wykonania tej operacji: {{details}}" + "iam_error": "Nie masz uprawnień do wykonania tej operacji: {{details}}", + "iam_dashboard_header_tabs_item_applications": "Aplikacje" } diff --git a/packages/manager/modules/iam/src/dashboard/translations/Messages_pt_PT.json b/packages/manager/modules/iam/src/dashboard/translations/Messages_pt_PT.json index 8dec47bac2dc..61fdacce0c1a 100644 --- a/packages/manager/modules/iam/src/dashboard/translations/Messages_pt_PT.json +++ b/packages/manager/modules/iam/src/dashboard/translations/Messages_pt_PT.json @@ -4,5 +4,6 @@ "iam_dashboard_header_tabs_item_identities": "Identidades", "iam_dashboard_header_tabs_item_policies": "Políticas", "iam_dashboard_header_tabs_item_resource_groups": "Grupos de recursos", - "iam_error": "Não tem permissões para realizar esta ação: {{details}}" + "iam_error": "Não tem permissões para realizar esta ação: {{details}}", + "iam_dashboard_header_tabs_item_applications": "Aplicações" } diff --git a/packages/manager/modules/iam/src/iam.constants.js b/packages/manager/modules/iam/src/iam.constants.js index 6ba26d885648..a167d73ca29c 100644 --- a/packages/manager/modules/iam/src/iam.constants.js +++ b/packages/manager/modules/iam/src/iam.constants.js @@ -266,9 +266,9 @@ const TAG = { // List of applications - banners APPLICATIONS__DELETE_APPLICATION_CONFIRM_BANNER__ERROR: - 'iam::applications::delete-application-confirm-banner::error', + 'dedicated::account::iam::applications::delete-application::confirm-banner::error', APPLICATIONS__DELETE_APPLICATION_CONFIRM_BANNER__SUCCESS: - 'iam::applications::delete-application-confirm-banner::success', + 'dedicated::account::iam::applications::delete-application::confirm-banner::success', // Commons ADD_ACTION_MANUALLY_SUCCESS: 'add-manually-success', From 25a0b5c8f3e871e3140aa4a0780d5e0d3ab8f28a Mon Sep 17 00:00:00 2001 From: Paul Dickerson Date: Mon, 16 Dec 2024 12:42:15 +0100 Subject: [PATCH 8/9] revert(vcd): revert resetPassword and usageTile ref: MANAGER-15191 MANAGER-15243 Signed-off-by: Paul Dickerson --- .../dashboard/Messages_fr_FR.json | 1 + ...centreGeneralInformationTile.component.tsx | 20 ++++ ...izationServiceManagementTile.component.tsx | 16 +-- .../ServicePasswordTileItem.tsx | 48 +++++++++ .../DatacentreGeneralInformation.page.tsx | 1 - .../OrganizationGeneralInformation.spec.tsx | 100 +++++++++--------- .../src/routes/routes.tsx | 31 +++--- 7 files changed, 139 insertions(+), 78 deletions(-) create mode 100644 packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-service-tile/password-tile-item/ServicePasswordTileItem.tsx diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/dashboard/Messages_fr_FR.json b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/dashboard/Messages_fr_FR.json index 9ab63c50698d..bc6793f2c272 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/dashboard/Messages_fr_FR.json +++ b/packages/manager/apps/hpc-vmware-managed-vcd/public/translations/dashboard/Messages_fr_FR.json @@ -24,6 +24,7 @@ "managed_vcd_dashboard_service_cancellation": "Résilier le service", "managed_vcd_dashboard_password": "Mot de passe", "managed_vcd_dashboard_password_renew": "Renouveler le mot de passe admin", + "managed_vcd_dashboard_password_tooltip": "Si vous souhaitez changer votre mot de passe administrateur, merci de contacter le support", "managed_vcd_dashboard_password_modal_title": "Changer le mot de passe", "managed_vcd_dashboard_password_modal_subtitle": "Êtes-vous certain de changer de mot de passe ?", "managed_vcd_dashboard_password_renew_success": "Vous allez recevoir un email pour visualiser votre mot de passe", diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-general-information-tile/DatacentreGeneralInformationTile.component.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-general-information-tile/DatacentreGeneralInformationTile.component.tsx index f0fb668d86cd..c1ba199f59bc 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-general-information-tile/DatacentreGeneralInformationTile.component.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/datacentre-general-information-tile/DatacentreGeneralInformationTile.component.tsx @@ -56,6 +56,15 @@ export default function DatacentreGenerationInformationTile({ ), }, + { + id: 'cpuCount', + label: tVdc('managed_vcd_vdc_vcpu_count'), + value: ( + + {vcdDatacentre?.currentState.vCPUCount?.toString()} + + ), + }, { id: 'ramCount', label: tVdc('managed_vcd_vdc_ram_count'), @@ -67,6 +76,17 @@ export default function DatacentreGenerationInformationTile({ ), }, + { + id: 'vcpuSpeed', + label: tVdc('managed_vcd_vdc_vcpu_speed'), + value: ( + + {tVdc('managed_vcd_vdc_vcpu_value', { + speed: vcdDatacentre?.currentState.vCPUSpeed, + })} + + ), + }, { id: 'interface', label: t('managed_vcd_dashboard_management_interface'), diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-service-tile/OrganizationServiceManagementTile.component.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-service-tile/OrganizationServiceManagementTile.component.tsx index 5c882e6f0158..1b3756d7f5d3 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-service-tile/OrganizationServiceManagementTile.component.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-service-tile/OrganizationServiceManagementTile.component.tsx @@ -1,18 +1,15 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; -import { useNavigate, useParams } from 'react-router-dom'; -import { DashboardTile, Links } from '@ovh-ux/manager-react-components'; +import { DashboardTile } from '@ovh-ux/manager-react-components'; import { OsdsChip } from '@ovhcloud/ods-components/react'; import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; import { ODS_CHIP_SIZE } from '@ovhcloud/ods-components'; import ServiceRenewTileItem from './renew-tile-item/ServiceRenewTileItem'; import ServiceContactsTileItem from './contact-tile-item/ServiceContactsTileItem'; -import { subRoutes, urls } from '@/routes/routes.constant'; +import ServicePasswordTileItem from './password-tile-item/ServicePasswordTileItem'; export default function OrganizationServiceManagementTile() { const { t } = useTranslation('dashboard'); - const { id } = useParams(); - const navigate = useNavigate(); return (
@@ -41,14 +38,7 @@ export default function OrganizationServiceManagementTile() { { id: 'servicePassword', label: t('managed_vcd_dashboard_password'), - value: ( - - navigate(urls.resetPassword.replace(subRoutes.dashboard, id)) - } - /> - ), + value: , }, { id: 'serviceContacts', diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-service-tile/password-tile-item/ServicePasswordTileItem.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-service-tile/password-tile-item/ServicePasswordTileItem.tsx new file mode 100644 index 000000000000..fd80c3b81430 --- /dev/null +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-service-tile/password-tile-item/ServicePasswordTileItem.tsx @@ -0,0 +1,48 @@ +import React from 'react'; +import { useTranslation } from 'react-i18next'; +import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; +import { + ODS_ICON_NAME, + ODS_ICON_SIZE, + ODS_CHIP_SIZE, +} from '@ovhcloud/ods-components'; +import { + OsdsChip, + OsdsIcon, + OsdsLink, + OsdsTooltip, + OsdsTooltipContent, +} from '@ovhcloud/ods-components/react'; + +export default function ServicePasswordTileItem() { + const { t } = useTranslation('dashboard'); + + return ( +
+
+ + {t('managed_vcd_dashboard_password_renew')} + + + + + {t('managed_vcd_dashboard_password_tooltip')} + + +
+ + {t('managed_vcd_dashboard_coming_soon')} + +
+ ); +} diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.page.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.page.tsx index 925a0a937bf1..d6bbd4059f14 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.page.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/datacentre/general-informations/DatacentreGeneralInformation.page.tsx @@ -43,7 +43,6 @@ export default function DatacentresGeneralInformationPage() { vcdDatacentre={vcdDatacentre?.data} vcdOrganization={vcdOrganization?.data} /> -
diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/OrganizationGeneralInformation.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/OrganizationGeneralInformation.spec.tsx index f7d3b8425a1b..cd37d397110b 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/OrganizationGeneralInformation.spec.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/OrganizationGeneralInformation.spec.tsx @@ -94,53 +94,55 @@ describe('Organization General Information Page', () => { await assertModalText({ container, text: 'Organization update error' }); }); - it('resets the password of the organization', async () => { - const { container } = await renderTest({ - initialRoute: `/${organizationList[1].id}`, - }); - - await assertTextVisibility( - labels.dashboard.managed_vcd_dashboard_password_renew, - ); - - const resetPasswordLink = await getButtonByLabel({ - container, - label: labels.dashboard.managed_vcd_dashboard_password_renew, - isLink: true, - }); - await waitFor(() => userEvents.click(resetPasswordLink)); - - await assertModalVisibility({ container, isVisible: true }); - - const validateButton = await getButtonByLabel({ - container, - label: labels.dashboard.managed_vcd_dashboard_edit_modal_cta_validate, - }); - await waitFor(() => userEvents.click(validateButton)); - - await assertModalVisibility({ container, isVisible: false }); - await assertTextVisibility( - labels.dashboard.managed_vcd_dashboard_password_renew_success, - ); - }); - - it('trying to reset password displays an error if reset password service is KO', async () => { - const { container } = await renderTest({ - initialRoute: `/${organizationList[0].id}/reset-password`, - isOrganizationResetPasswordKo: true, - }); - - await assertModalVisibility({ container, isVisible: true }); - - const validateButton = await getButtonByLabel({ - container, - label: labels.dashboard.managed_vcd_dashboard_edit_modal_cta_validate, - }); - await waitFor(() => userEvents.click(validateButton)); - - await assertModalVisibility({ container, isVisible: false }); - await assertTextVisibility( - labels.dashboard.managed_vcd_dashboard_password_renew_error, - ); - }); + // uncomment below: when API for resetPassword is available + // it('resets the password of the organization', async () => { + // const { container } = await renderTest({ + // initialRoute: `/${organizationList[1].id}`, + // }); + + // await assertTextVisibility( + // labels.dashboard.managed_vcd_dashboard_password_renew, + // ); + + // const resetPasswordLink = await getButtonByLabel({ + // container, + // label: labels.dashboard.managed_vcd_dashboard_password_renew, + // isLink: true, + // }); + // await waitFor(() => userEvents.click(resetPasswordLink)); + + // await assertModalVisibility({ container, isVisible: true }); + + // const validateButton = await getButtonByLabel({ + // container, + // label: labels.dashboard.managed_vcd_dashboard_edit_modal_cta_validate, + // }); + // await waitFor(() => userEvents.click(validateButton)); + + // await assertModalVisibility({ container, isVisible: false }); + // await assertTextVisibility( + // labels.dashboard.managed_vcd_dashboard_password_renew_success, + // ); + // }); + + // uncomment below: when API for resetPassword is available + // it('trying to reset password displays an error if reset password service is KO', async () => { + // const { container } = await renderTest({ + // initialRoute: `/${organizationList[0].id}/reset-password`, + // isOrganizationResetPasswordKo: true, + // }); + + // await assertModalVisibility({ container, isVisible: true }); + + // const validateButton = await getButtonByLabel({ + // container, + // label: labels.dashboard.managed_vcd_dashboard_edit_modal_cta_validate, + // }); + // await waitFor(() => userEvents.click(validateButton)); + + // await assertModalVisibility({ container, isVisible: false }); + // await assertTextVisibility( + // labels.dashboard.managed_vcd_dashboard_password_renew_error, + // ); + // }); }); diff --git a/packages/manager/apps/hpc-vmware-managed-vcd/src/routes/routes.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/routes/routes.tsx index d396d231eb92..b4096696284b 100644 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/routes/routes.tsx +++ b/packages/manager/apps/hpc-vmware-managed-vcd/src/routes/routes.tsx @@ -85,21 +85,22 @@ export const Routes: any = [ }, }, }, - { - id: 'reset-password', - path: urls.resetPassword, - ...lazyRouteConfig(() => - import( - '@/pages/dashboard/organization/general-information/edit/EditPassword.page' - ), - ), - handle: { - tracking: { - pageName: 'reset-password', - pageType: PageType.popup, - }, - }, - }, + // uncomment below: when API for resetPassword is available + // { + // id: 'reset-password', + // path: urls.resetPassword, + // ...lazyRouteConfig(() => + // import( + // '@/pages/dashboard/organization/general-information/edit/EditPassword.page' + // ), + // ), + // handle: { + // tracking: { + // pageName: 'reset-password', + // pageType: PageType.popup, + // }, + // }, + // }, ], }, { From bc9bc75deea305ef365d807db616f827de822044 Mon Sep 17 00:00:00 2001 From: Thibault Barske Date: Tue, 17 Dec 2024 10:46:56 +0100 Subject: [PATCH 9/9] fix(kms): revert "feat(kms): refacto delete modal" This reverts commit d7c2efde61b46b4660ccbb894ce660de68f2e7f7. ref: MANAGER-15233 Signed-off-by: Thibault Barske --- .../terminate/TerminateModal.component.tsx | 119 ++++++++++++++++++ .../terminate/TerminateModal.constants.ts | 1 + .../BillingInformationsTile.tsx | 43 ++++++- .../src/data/hooks/useTerminateOKms.ts | 28 ++--- .../dashboard/KmsDashboard.page.spec.tsx | 6 +- .../GeneralInformations.tsx | 5 +- .../pages/listing/terminate/TerminateKms.tsx | 51 ++------ .../src/routes/routes.constants.ts | 2 +- .../src/routes/routes.tsx | 12 -- 9 files changed, 189 insertions(+), 78 deletions(-) create mode 100644 packages/manager/apps/key-management-service/src/components/Modal/terminate/TerminateModal.component.tsx create mode 100644 packages/manager/apps/key-management-service/src/components/Modal/terminate/TerminateModal.constants.ts diff --git a/packages/manager/apps/key-management-service/src/components/Modal/terminate/TerminateModal.component.tsx b/packages/manager/apps/key-management-service/src/components/Modal/terminate/TerminateModal.component.tsx new file mode 100644 index 000000000000..29df84dfd14b --- /dev/null +++ b/packages/manager/apps/key-management-service/src/components/Modal/terminate/TerminateModal.component.tsx @@ -0,0 +1,119 @@ +import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; +import { + ButtonType, + PageLocation, + useOvhTracking, +} from '@ovh-ux/manager-react-shell-client'; +import { + ODS_BUTTON_TYPE, + ODS_BUTTON_VARIANT, + ODS_INPUT_TYPE, + ODS_SPINNER_SIZE, + ODS_TEXT_LEVEL, + OdsInputValueChangeEvent, +} from '@ovhcloud/ods-components'; +import { + OsdsButton, + OsdsInput, + OsdsModal, + OsdsSpinner, + OsdsText, +} from '@ovhcloud/ods-components/react'; +import React, { useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { terminateValue } from './TerminateModal.constants'; + +export type TerminateModalProps = { + closeModal: () => void; + isLoading?: boolean; + onConfirmTerminate: () => void; +}; + +export const TerminateModal: React.FC = ({ + closeModal, + isLoading, + onConfirmTerminate, +}) => { + const { trackClick } = useOvhTracking(); + const { t } = useTranslation('key-management-service/terminate'); + const [terminateInput, setTerminateInput] = useState(''); + + const close = () => { + setTerminateInput(''); + closeModal(); + }; + + return ( + +
+ {isLoading ? ( +
+ +
+ ) : ( + <> + + {t('key_management_service_terminate_description', { + terminateKeyword: terminateValue, + })} + + + setTerminateInput(e.detail.value) + } + /> + + )} +
+ { + trackClick({ + location: PageLocation.popup, + buttonType: ButtonType.button, + actionType: 'navigation', + actions: ['delete_kms', 'cancel'], + }); + close(); + }} + > + {t('key_management_service_terminate_cancel')} + + { + trackClick({ + location: PageLocation.popup, + buttonType: ButtonType.button, + actionType: 'navigation', + actions: ['delete_kms', 'confirm'], + }); + setTerminateInput(''); + onConfirmTerminate(); + }} + > + {t('key_management_service_terminate_confirm')} + +
+ ); +}; diff --git a/packages/manager/apps/key-management-service/src/components/Modal/terminate/TerminateModal.constants.ts b/packages/manager/apps/key-management-service/src/components/Modal/terminate/TerminateModal.constants.ts new file mode 100644 index 000000000000..b12864b664ed --- /dev/null +++ b/packages/manager/apps/key-management-service/src/components/Modal/terminate/TerminateModal.constants.ts @@ -0,0 +1 @@ +export const terminateValue = 'TERMINATE'; diff --git a/packages/manager/apps/key-management-service/src/components/layout-helpers/Dashboard/GeneralInformationsTiles/BillingInformationsTile.tsx b/packages/manager/apps/key-management-service/src/components/layout-helpers/Dashboard/GeneralInformationsTiles/BillingInformationsTile.tsx index 36b856b43fdc..c0334ef1e19c 100644 --- a/packages/manager/apps/key-management-service/src/components/layout-helpers/Dashboard/GeneralInformationsTiles/BillingInformationsTile.tsx +++ b/packages/manager/apps/key-management-service/src/components/layout-helpers/Dashboard/GeneralInformationsTiles/BillingInformationsTile.tsx @@ -10,16 +10,19 @@ import { ODS_ICON_SIZE, ODS_TEXT_COLOR_INTENT, } from '@ovhcloud/ods-components'; -import { Outlet, useNavigate } from 'react-router-dom'; import { OsdsChip, OsdsIcon, OsdsLink } from '@ovhcloud/ods-components/react'; import React, { useContext, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { ButtonType, PageLocation, + PageType, ShellContext, useOvhTracking, } from '@ovh-ux/manager-react-shell-client'; +import { OKMS } from '@/types/okms.type'; +import { useTerminateOKms } from '@/data/hooks/useTerminateOKms'; +import { TerminateModal } from '@/components/Modal/terminate/TerminateModal.component'; import { OkmsServiceState } from '../okmsServiceState/OkmsServiceState.component'; import { Tile } from '@/components/dashboard/tile/tile.component'; import { TileItem } from '@/components/dashboard/tile-item/tileItem.component'; @@ -27,25 +30,47 @@ import { TileValue } from '@/components/dashboard/tile-value/tileValue.component import { TileSeparator } from '@/components/dashboard/tile-separator/tileSeparator'; import { TileValueDate } from '@/components/dashboard/tile-value-date/tileValueDate.component'; import { DISPLAY_CONTACTS_MANAGEMENT_KEY } from './BillingInformationsTile.constants'; -import { ROUTES_URLS } from '@/routes/routes.constants'; type BillingInformationsTileProps = { + okmsData?: OKMS; okmsService?: ServiceDetails; }; const BillingInformationsTile = ({ + okmsData, okmsService, }: BillingInformationsTileProps) => { const { t } = useTranslation('key-management-service/dashboard'); - const navigate = useNavigate(); - const { trackClick } = useOvhTracking(); + const { trackClick, trackPage } = useOvhTracking(); const [contactUrl, setContactUrl] = useState(''); + const [showTerminationModal, setShowTerminationModal] = useState(false); const { data: availability } = useFeatureAvailability([ DISPLAY_CONTACTS_MANAGEMENT_KEY, ]); const { shell: { navigation }, } = useContext(ShellContext); + const closeTerminateModal = () => { + setShowTerminationModal(false); + }; + + const { terminateKms, isPending } = useTerminateOKms({ + okmsId: okmsData.id, + onSuccess: () => { + trackPage({ + pageType: PageType.bannerSuccess, + pageName: 'delete_kms_success', + }); + closeTerminateModal(); + }, + onError: () => { + trackPage({ + pageType: PageType.bannerError, + pageName: 'delete_kms_error', + }); + closeTerminateModal(); + }, + }); const dateFormat: Intl.DateTimeFormatOptions = { day: '2-digit', @@ -65,7 +90,7 @@ const BillingInformationsTile = ({ actionType: 'navigation', actions: ['delete_kms'], }); - navigate(ROUTES_URLS.terminateOkms); + setShowTerminationModal(true); }, }, ]; @@ -187,7 +212,13 @@ const BillingInformationsTile = ({ )} - + {showTerminationModal && ( + + )} ); }; diff --git a/packages/manager/apps/key-management-service/src/data/hooks/useTerminateOKms.ts b/packages/manager/apps/key-management-service/src/data/hooks/useTerminateOKms.ts index c3f4e751017b..a862377f09d9 100644 --- a/packages/manager/apps/key-management-service/src/data/hooks/useTerminateOKms.ts +++ b/packages/manager/apps/key-management-service/src/data/hooks/useTerminateOKms.ts @@ -1,10 +1,6 @@ import { ApiError, ApiResponse } from '@ovh-ux/manager-core-api'; import { useNotifications } from '@ovh-ux/manager-react-components'; -import { - MutationOptions, - useMutation, - useQueryClient, -} from '@tanstack/react-query'; +import { useMutation, useQueryClient } from '@tanstack/react-query'; import { useTranslation } from 'react-i18next'; import { getOkmsServicesResourceListQueryKey } from '../api/okms'; import { @@ -14,14 +10,15 @@ import { terminateOKmsQueryKey, } from '../api/okmsService'; -export type UseTerminateOkmsParams = { - okmsId: string; -} & MutationOptions, ApiError>; - export const useTerminateOKms = ({ okmsId, - ...options -}: UseTerminateOkmsParams) => { + onSuccess, + onError, +}: { + okmsId: string; + onSuccess?: () => void; + onError?: () => void; +}) => { const queryClient = useQueryClient(); const { addError, addSuccess, clearNotifications } = useNotifications(); const { t } = useTranslation('key-management-service/terminate'); @@ -37,7 +34,7 @@ export const useTerminateOKms = ({ }); return terminateOKms({ serviceId: servicesId[0] }); }, - onSuccess: (...params) => { + onSuccess: () => { clearNotifications(); addSuccess( t('key_management_service_terminate_success_banner', { @@ -48,9 +45,9 @@ export const useTerminateOKms = ({ queryClient.invalidateQueries({ queryKey: getOkmsServicesResourceListQueryKey, }); - options?.onSuccess?.(...params); + onSuccess?.(); }, - onError: (result: ApiError, ...params) => { + onError: (result: ApiError) => { clearNotifications(); addError( t('key_management_service_terminate_error', { @@ -58,9 +55,8 @@ export const useTerminateOKms = ({ }), true, ); - options?.onError?.(result, ...params); + onError?.(); }, - ...options, }); return { diff --git a/packages/manager/apps/key-management-service/src/pages/dashboard/KmsDashboard.page.spec.tsx b/packages/manager/apps/key-management-service/src/pages/dashboard/KmsDashboard.page.spec.tsx index 698c515e6871..5a8dfdaa55fe 100644 --- a/packages/manager/apps/key-management-service/src/pages/dashboard/KmsDashboard.page.spec.tsx +++ b/packages/manager/apps/key-management-service/src/pages/dashboard/KmsDashboard.page.spec.tsx @@ -1,9 +1,9 @@ import { act, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { renderTestApp } from '@/utils/tests/renderTestApp'; +import '@testing-library/jest-dom'; import { labels } from '@/utils/tests/init.i18n'; import { okmsMock } from '@/mocks/kms/okms.mock'; -import '@testing-library/jest-dom'; describe('KMS dashboard test suite', () => { it('should display an error if the API is KO', async () => { @@ -134,12 +134,12 @@ describe('KMS dashboard test suite', () => { await waitFor( () => expect( - screen.getAllByText( + screen.getByText( labels.serviceKeys[ 'key_management_service_service-keys_dashboard_field_name' ], ), - ).toHaveLength(2), + ).toBeVisible(), { timeout: 30_000, }, diff --git a/packages/manager/apps/key-management-service/src/pages/dashboard/generalInformations/GeneralInformations.tsx b/packages/manager/apps/key-management-service/src/pages/dashboard/generalInformations/GeneralInformations.tsx index 3f7e3329a5dd..64853d40c477 100644 --- a/packages/manager/apps/key-management-service/src/pages/dashboard/generalInformations/GeneralInformations.tsx +++ b/packages/manager/apps/key-management-service/src/pages/dashboard/generalInformations/GeneralInformations.tsx @@ -36,7 +36,10 @@ function GeneralInformationsTab() { okmsData={okms.data} okmsServiceInfos={okmsService.data} /> - + ); } diff --git a/packages/manager/apps/key-management-service/src/pages/listing/terminate/TerminateKms.tsx b/packages/manager/apps/key-management-service/src/pages/listing/terminate/TerminateKms.tsx index 89b6c6c7fcbf..d829aff8b300 100644 --- a/packages/manager/apps/key-management-service/src/pages/listing/terminate/TerminateKms.tsx +++ b/packages/manager/apps/key-management-service/src/pages/listing/terminate/TerminateKms.tsx @@ -1,23 +1,17 @@ import React from 'react'; -import { - ButtonType, - PageLocation, - PageType, - useOvhTracking, -} from '@ovh-ux/manager-react-shell-client'; +import { PageType, useOvhTracking } from '@ovh-ux/manager-react-shell-client'; import { useNavigate, useParams } from 'react-router-dom'; -import { useTranslation } from 'react-i18next'; -import { - DeleteModal, - defaultDeleteModalTerminateValue, -} from '@ovh-ux/manager-react-components'; +import { TerminateModal } from '@/components/Modal/terminate/TerminateModal.component'; import { useTerminateOKms } from '@/data/hooks/useTerminateOKms'; export default function TerminateKms() { const navigate = useNavigate(); - const { t } = useTranslation('key-management-service/terminate'); + const { trackPage } = useOvhTracking(); const { okmsId } = useParams(); - const { trackPage, trackClick } = useOvhTracking(); + + const closeModal = () => { + navigate('..'); + }; const { terminateKms, isPending } = useTerminateOKms({ okmsId, @@ -26,43 +20,22 @@ export default function TerminateKms() { pageType: PageType.bannerSuccess, pageName: 'delete_kms_success', }); + closeModal(); }, onError: () => { trackPage({ pageType: PageType.bannerError, pageName: 'delete_kms_error', }); - }, - onSettled: () => { - navigate('..'); + closeModal(); }, }); return ( - { - trackClick({ - location: PageLocation.popup, - buttonType: ButtonType.button, - actionType: 'navigation', - actions: ['delete_kms', 'cancel'], - }); - navigate('..'); - }} + { - trackClick({ - location: PageLocation.popup, - buttonType: ButtonType.button, - actionType: 'navigation', - actions: ['delete_kms', 'confirm'], - }); - terminateKms(); - }} - deleteInputLabel={t('key_management_service_terminate_description', { - terminateKeyword: defaultDeleteModalTerminateValue, - })} /> ); } diff --git a/packages/manager/apps/key-management-service/src/routes/routes.constants.ts b/packages/manager/apps/key-management-service/src/routes/routes.constants.ts index f9847cc3ec15..0041c5ff8b1e 100644 --- a/packages/manager/apps/key-management-service/src/routes/routes.constants.ts +++ b/packages/manager/apps/key-management-service/src/routes/routes.constants.ts @@ -2,7 +2,7 @@ export const ROUTES_URLS = { root: '/', listing: '/', onboarding: '/onboarding', - terminateOkms: 'terminate', + terminateOkms: '/terminate', createKeyManagementService: 'create', okmsId: ':okmsId', okmsUpdateName: 'update-name', diff --git a/packages/manager/apps/key-management-service/src/routes/routes.tsx b/packages/manager/apps/key-management-service/src/routes/routes.tsx index 015abd04f327..fddde97f6f77 100644 --- a/packages/manager/apps/key-management-service/src/routes/routes.tsx +++ b/packages/manager/apps/key-management-service/src/routes/routes.tsx @@ -99,18 +99,6 @@ export default [ }, }, }, - { - path: ROUTES_URLS.terminateOkms, - ...lazyRouteConfig(() => - import('@/pages/listing/terminate/TerminateKms'), - ), - handle: { - tracking: { - pageName: 'terminate', - pageType: PageType.popup, - }, - }, - }, ], }, {