Skip to content

Commit

Permalink
feat(web-office): add button order user or licences
Browse files Browse the repository at this point in the history
ref:MANAGER-16542

Signed-off-by: stif59100 <[email protected]>
  • Loading branch information
stif59100 committed Jan 9, 2025
1 parent 5a85803 commit 3f4e168
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"dashboard_users_action_user_change_password": "Changer le mot de passe",
"dashboard_users_action_user_edit": "Editer le compte",
"dashboard_users_action_user_delete": "Supprimer le compte",
"dashboard_users_order_button_licenses": "Commander plus de licenses"
"dashboard_users_order_button_licenses": "Commander plus de licenses",
"dashboard_users_order_button_users": "Ajouter un utilisateur"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ import {
OdsText,
OdsButton,
} from '@ovhcloud/ods-components/react';
import { useParams } from 'react-router-dom';
import { UserNativeType } from '@/api/users/type';
import Loading from '@/components/Loading/Loading';
import { useOfficeLicenseDetail, useOfficeUsers } from '@/hooks';
import {
useOfficeLicenseDetail,
useOfficeServiceType,
useOfficeUsers,
} from '@/hooks';
import { BadgeStatus } from '@/components/BadgeStatus';
import { UserStateEnum } from '@/api/api.type';
import ActionButtonUsers from './ActionButtonUsers.component';
Expand All @@ -28,6 +33,9 @@ export default function Users() {
isLoading: isLoadingLicenceDetail,
} = useOfficeLicenseDetail();

const { serviceName } = useParams();
const isPostpaidLicence = useOfficeServiceType(serviceName) === 'payAsYouGo';

Check failure on line 37 in packages/manager/apps/web-office/src/pages/dashboard/users/Users.tsx

View workflow job for this annotation

GitHub Actions / test

src/pages/dashboard/users/__test__/Users.spec.tsx > Users page > Page should display correctly

Error: [vitest] No "useOfficeServiceType" export is defined on the "@/hooks" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock(import("@/hooks"), async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ Users src/pages/dashboard/users/Users.tsx:37:29 ❯ renderWithHooks ../../../../node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ mountIndeterminateComponent ../../../../node_modules/react-dom/cjs/react-dom.development.js:20074:13 ❯ beginWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:21587:16 ❯ beginWork$1 ../../../../node_modules/react-dom/cjs/react-dom.development.js:27426:14 ❯ performUnitOfWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:26560:12 ❯ workLoopSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26466:5 ❯ renderRootSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26434:7

if (isLoadingUsers || isLoadingLicenceDetail) {
return <Loading />;
}
Expand Down Expand Up @@ -113,11 +121,17 @@ export default function Users() {
<p>{t('dashboard_users_download_info')}</p>
<strong>{t('dashboard_users_download_id')}</strong>
</OdsText>

<OdsButton
label={t('dashboard_users_order_button_licenses')}
label={
isPostpaidLicence
? t('dashboard_users_order_button_users')
: t('dashboard_users_order_button_licenses')
}
variant={ODS_BUTTON_VARIANT.outline}
className="block"
/>

{columns && (
<Datagrid
columns={columns.map((column) => ({
Expand Down

0 comments on commit 3f4e168

Please sign in to comment.