+
+
{t('dashboard_users_download_info')}
{t('dashboard_users_download_id')}
-
- {columns && (
- ({
- ...column,
- label: t(column.label),
- }))}
- items={dataUsers || []}
- totalItems={dataUsers?.length || 0}
- className="mt-4"
- />
+ {isLoadingUsers || isLoadingLicenceDetail ? (
+
+ ) : (
+ <>
+
+ ({
+ ...column,
+ label: t(column.label),
+ }))}
+ items={dataUsers || []}
+ totalItems={dataUsers?.length || 0}
+ className="mt-4"
+ />
+ >
)}
);
diff --git a/packages/manager/apps/web-office/src/pages/dashboard/users/__test__/ModalDeleteUsers.component.spec.tsx b/packages/manager/apps/web-office/src/pages/dashboard/users/__test__/ModalDeleteUsers.component.spec.tsx
new file mode 100644
index 000000000000..0730a17ca3dc
--- /dev/null
+++ b/packages/manager/apps/web-office/src/pages/dashboard/users/__test__/ModalDeleteUsers.component.spec.tsx
@@ -0,0 +1,50 @@
+import React from 'react';
+import { describe, expect, it, vi } from 'vitest';
+import { useSearchParams } from 'react-router-dom';
+import ModalDeleteUsers from '../ModalDeleteUsers.component';
+import { fireEvent, render, act } from '@/utils/test.provider';
+import { postOfficePrepaidLicenseUnconfigure } from '@/api/license';
+import { deleteOfficeUser } from '@/api/users';
+
+describe('ModalDeleteUsers Component', () => {
+ it('if prepaid licence with licencePrepaidName', async () => {
+ vi.mocked(useSearchParams).mockReturnValue([
+ new URLSearchParams({
+ activationEmail: 'activationEmail@activationEmail',
+ licencePrepaidName: 'licencePrepaidName',
+ }),
+ vi.fn(),
+ ]);
+
+ const { getByTestId } = render(
);
+
+ const deleteButton = getByTestId('delete-btn');
+
+ await act(() => {
+ fireEvent.click(deleteButton);
+ });
+
+ expect(postOfficePrepaidLicenseUnconfigure).toHaveBeenCalledOnce();
+ });
+
+ it('if postpaid licence without licencePrepaidName', async () => {
+ vi.mocked(useSearchParams).mockReturnValue([
+ new URLSearchParams({
+ activationEmail: 'activationEmail@activationEmail',
+ }),
+ vi.fn(),
+ ]);
+
+ const { getByTestId } = render(
);
+
+ const deleteButton = getByTestId('delete-btn');
+
+ expect(deleteButton).toBeInTheDocument();
+
+ await act(() => {
+ fireEvent.click(deleteButton);
+ });
+
+ expect(deleteOfficeUser).toHaveBeenCalledOnce();
+ });
+});
diff --git a/packages/manager/apps/web-office/src/pages/licenses/licenses.page.tsx b/packages/manager/apps/web-office/src/pages/licenses/licenses.page.tsx
index b2457a05652b..e92280028e96 100644
--- a/packages/manager/apps/web-office/src/pages/licenses/licenses.page.tsx
+++ b/packages/manager/apps/web-office/src/pages/licenses/licenses.page.tsx
@@ -19,14 +19,14 @@ import { ShellContext } from '@ovh-ux/manager-react-shell-client';
import { CTAS } from '@/guides.constants';
import { urls } from '@/routes/routes.constants';
import { LicenseType } from '@/api/license';
-import { useOfficeLicenses, UseGenerateUrl } from '@/hooks';
+import { useOfficeLicenses, useGenerateUrl } from '@/hooks';
import Loading from '@/components/Loading/Loading';
const columns: DatagridColumn
[] = [
{
id: 'serviceName',
cell: (item) => {
- const href = UseGenerateUrl(urls.license, 'href', {
+ const href = useGenerateUrl(urls.license, 'href', {
serviceName: item.serviceName,
});
diff --git a/packages/manager/apps/web-office/src/queryClient.ts b/packages/manager/apps/web-office/src/queryClient.ts
new file mode 100644
index 000000000000..94100b5328ad
--- /dev/null
+++ b/packages/manager/apps/web-office/src/queryClient.ts
@@ -0,0 +1,11 @@
+import { QueryClient } from '@tanstack/react-query';
+
+const queryClient = new QueryClient({
+ defaultOptions: {
+ queries: {
+ staleTime: 300_000,
+ },
+ },
+});
+
+export default queryClient;
diff --git a/packages/manager/apps/web-office/src/routes/routes.tsx b/packages/manager/apps/web-office/src/routes/routes.tsx
index 82cd177585b2..22943ba52b34 100644
--- a/packages/manager/apps/web-office/src/routes/routes.tsx
+++ b/packages/manager/apps/web-office/src/routes/routes.tsx
@@ -44,6 +44,20 @@ export const Routes: any = [
pageType: PageType.dashboard,
},
},
+ children: [
+ {
+ path: 'users/delete',
+ ...lazyRouteConfig(() =>
+ import('@/pages/dashboard/users/ModalDeleteUsers.component'),
+ ),
+ handle: {
+ tracking: {
+ pageName: 'users-delete',
+ pageType: PageType.popup,
+ },
+ },
+ },
+ ],
},
{
path: 'consumption',
diff --git a/packages/manager/apps/web-office/src/utils/test.setup.tsx b/packages/manager/apps/web-office/src/utils/test.setup.tsx
index 21c7021685a7..ad44c9f34d30 100644
--- a/packages/manager/apps/web-office/src/utils/test.setup.tsx
+++ b/packages/manager/apps/web-office/src/utils/test.setup.tsx
@@ -4,6 +4,8 @@ import {
licensesMock,
licensesPrepaidMock,
licensesPrepaidExpandedMock,
+ pendingTask,
+ tenantPendingTask,
} from '@/api/_mock_';
const mocksAxios = vi.hoisted(() => ({
@@ -67,6 +69,9 @@ vi.mock('@/api/license', async (importActual) => {
),
);
}),
+ postOfficePrepaidLicenseUnconfigure: vi.fn(() => {
+ return Promise.resolve(pendingTask);
+ }),
};
});
@@ -76,6 +81,9 @@ vi.mock('@/api/users', async (importActual) => {
getOfficeUsers: vi.fn(() => {
return Promise.resolve(usersMock);
}),
+ deleteOfficeUser: vi.fn(() => {
+ return Promise.resolve(tenantPendingTask);
+ }),
};
});