Skip to content

Commit

Permalink
revert(vcd): revert resetPassword and usageTile
Browse files Browse the repository at this point in the history
ref: MANAGER-15191 MANAGER-15243

Signed-off-by: Paul Dickerson <[email protected]>
  • Loading branch information
Paul Dickerson authored and tibs245 committed Dec 16, 2024
1 parent 73f4871 commit b7e66e8
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ export default function DatacentreGenerationInformationTile({
</Description>
),
},
{
id: 'cpuCount',
label: tVdc('managed_vcd_vdc_vcpu_count'),
value: (
<Description>
{vcdDatacentre?.currentState.vCPUCount?.toString()}
</Description>
),
},
{
id: 'ramCount',
label: tVdc('managed_vcd_vdc_ram_count'),
Expand All @@ -67,6 +76,17 @@ export default function DatacentreGenerationInformationTile({
</Description>
),
},
{
id: 'vcpuSpeed',
label: tVdc('managed_vcd_vdc_vcpu_speed'),
value: (
<Description>
{tVdc('managed_vcd_vdc_vcpu_value', {
speed: vcdDatacentre?.currentState.vCPUSpeed,
})}
</Description>
),
},
{
id: 'interface',
label: t('managed_vcd_dashboard_management_interface'),
Expand Down
Original file line number Diff line number Diff line change
@@ -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 (
<div className="h-fit">
Expand Down Expand Up @@ -41,14 +38,7 @@ export default function OrganizationServiceManagementTile() {
{
id: 'servicePassword',
label: t('managed_vcd_dashboard_password'),
value: (
<Links
label={t('managed_vcd_dashboard_password_renew')}
onClickReturn={() =>
navigate(urls.resetPassword.replace(subRoutes.dashboard, id))
}
/>
),
value: <ServicePasswordTileItem />,
},
{
id: 'serviceContacts',
Expand Down
Original file line number Diff line number Diff line change
@@ -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 (
<div className="flex-wrap">
<div className="flex items-center gap-x-2">
<OsdsLink disabled>
{t('managed_vcd_dashboard_password_renew')}
</OsdsLink>
<OsdsTooltip className="flex items-center">
<OsdsIcon
className="cursor-pointer"
name={ODS_ICON_NAME.HELP}
size={ODS_ICON_SIZE.xxs}
color={ODS_THEME_COLOR_INTENT.text}
/>
<OsdsTooltipContent slot="tooltip-content" className="break-normal">
{t('managed_vcd_dashboard_password_tooltip')}
</OsdsTooltipContent>
</OsdsTooltip>
</div>
<OsdsChip
inline
color={ODS_THEME_COLOR_INTENT.primary}
className="ml-3 mt-3"
size={ODS_CHIP_SIZE.sm}
>
{t('managed_vcd_dashboard_coming_soon')}
</OsdsChip>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export default function DatacentresGeneralInformationPage() {
vcdDatacentre={vcdDatacentre?.data}
vcdOrganization={vcdOrganization?.data}
/>
<DatacentreUsageTile vcdDatacentre={vcdDatacentre?.data} />
</div>
<Outlet />
</React.Suspense>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
// );
// });
});
31 changes: 16 additions & 15 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,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,
// },
// },
// },
],
},
{
Expand Down

0 comments on commit b7e66e8

Please sign in to comment.