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 bc6793f2c272..9ab63c50698d 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,7 +24,6 @@ "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/organization-service-tile/OrganizationServiceManagementTile.component.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-service-tile/OrganizationServiceManagementTile.component.tsx index 1b3756d7f5d3..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,15 +1,18 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; -import { DashboardTile } from '@ovh-ux/manager-react-components'; +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 } from '@ovhcloud/ods-components'; import ServiceRenewTileItem from './renew-tile-item/ServiceRenewTileItem'; import ServiceContactsTileItem from './contact-tile-item/ServiceContactsTileItem'; -import ServicePasswordTileItem from './password-tile-item/ServicePasswordTileItem'; +import { subRoutes, urls } from '@/routes/routes.constant'; export default function OrganizationServiceManagementTile() { const { t } = useTranslation('dashboard'); + const { id } = useParams(); + const navigate = useNavigate(); return (
@@ -38,7 +41,14 @@ export default function OrganizationServiceManagementTile() { { id: 'servicePassword', label: t('managed_vcd_dashboard_password'), - value: , + value: ( + + navigate(urls.resetPassword.replace(subRoutes.dashboard, id)) + } + /> + ), }, { 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 deleted file mode 100644 index fd80c3b81430..000000000000 --- a/packages/manager/apps/hpc-vmware-managed-vcd/src/components/tiles/organization-service-tile/password-tile-item/ServicePasswordTileItem.tsx +++ /dev/null @@ -1,48 +0,0 @@ -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/organization/general-information/OrganizationGeneralInformation.spec.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/pages/dashboard/organization/general-information/OrganizationGeneralInformation.spec.tsx index cd37d397110b..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 @@ -94,55 +94,53 @@ describe('Organization General Information Page', () => { await assertModalText({ container, text: 'Organization update 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, - // ); - // }); + 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/routes/routes.tsx b/packages/manager/apps/hpc-vmware-managed-vcd/src/routes/routes.tsx index b4096696284b..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,22 +85,21 @@ export const Routes: any = [ }, }, }, - // 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, - // }, - // }, - // }, + { + id: 'reset-password', + path: urls.resetPassword, + ...lazyRouteConfig(() => + import( + '@/pages/dashboard/organization/general-information/edit/EditPassword.page' + ), + ), + handle: { + tracking: { + pageName: 'reset-password', + pageType: PageType.popup, + }, + }, + }, ], }, {