Skip to content

Commit

Permalink
feat(vcd): implement reset VCD password
Browse files Browse the repository at this point in the history
ref: MANAGER-15191

Signed-off-by: Paul Dickerson <[email protected]>
  • Loading branch information
Paul Dickerson committed Dec 18, 2024
1 parent 263817e commit 8f1b14a
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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 (
<div className="h-fit">
Expand Down Expand Up @@ -38,7 +41,14 @@ export default function OrganizationServiceManagementTile() {
{
id: 'servicePassword',
label: t('managed_vcd_dashboard_password'),
value: <ServicePasswordTileItem />,
value: (
<Links
label={t('managed_vcd_dashboard_password_renew')}
onClickReturn={() =>
navigate(urls.resetPassword.replace(subRoutes.dashboard, id))
}
/>
),
},
{
id: 'serviceContacts',
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
});
});
31 changes: 15 additions & 16 deletions packages/manager/apps/hpc-vmware-managed-vcd/src/routes/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
},
],
},
{
Expand Down

0 comments on commit 8f1b14a

Please sign in to comment.