Skip to content

Commit c0aa874

Browse files
committed
feat(web-hosting): fix tests and add get expanded row
ref: #PUWEPT-86 Signed-off-by: stif59100 <[email protected]>
1 parent de9614f commit c0aa874

File tree

26 files changed

+167
-419
lines changed

26 files changed

+167
-419
lines changed

packages/manager/apps/web-hosting/package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@
3030
"@ovh-ux/manager-react-shell-client": "^0.11.2",
3131
"@ovh-ux/manager-tailwind-config": "^0.6.1",
3232
"@ovh-ux/request-tagger": "^0.5.9",
33-
"@ovh-ux/shell": "^4.9.2",
34-
"@ovhcloud/ods-components": "^18.6.2",
35-
"@ovhcloud/ods-themes": "^18.6.2",
36-
"@ovh-ux/muk": "^0.9.0",
37-
"@ovhcloud/ods-react": "^19.2.1",
33+
"@ovh-ux/shell": "^4.9.2",
34+
"@ovh-ux/muk": "^0.9.1",
35+
"@ovhcloud/ods-react": "^19.3.0",
36+
"@ovhcloud/ods-themes": "^19.3.0",
3837
"@tanstack/react-query": "^5.51.21",
3938
"@tanstack/react-table": "^8.20.1",
4039
"clsx": "2.1.1",

packages/manager/apps/web-hosting/src/hooks/localSeo/useDatagridColumn.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ export default function useDatagridColumn() {
9797
return [
9898
{
9999
id: 'name',
100-
accessorFn: (row: LocalSeoType) => row.name, // Assurez-vous que `accessorFn` est présent et typé correctement
100+
accessorKey: 'name',
101101
cell: ({ row }) => <div>{row.original.name}</div>,
102102
header: t('hosting_tab_LOCAL_SEO_table_header_name'),
103103
},
104104
{
105105
id: 'address',
106-
accessorFn: (row: LocalSeoType) => row.address,
106+
accessorKey: 'address',
107107
cell: ({ row }) => (
108108
<div>
109109
{row.original.address ? (
@@ -119,7 +119,7 @@ export default function useDatagridColumn() {
119119
},
120120
{
121121
id: 'email',
122-
accessorFn: (row: LocalSeoType) => row.accountId,
122+
accessorKey: 'accountId',
123123
cell: ({ row }) => (
124124
<EmailCell
125125
serviceName={serviceName}
@@ -130,7 +130,7 @@ export default function useDatagridColumn() {
130130
},
131131
{
132132
id: 'status',
133-
accessorFn: (row: LocalSeoType) => row.status,
133+
accessorKey: 'status',
134134
cell: ({ row }) => (
135135
<div className="w-10">
136136
<Badge className="my-3" color={StatusColor[row.original.status]}>

packages/manager/apps/web-hosting/src/index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@tailwind utilities;
22
@import '@ovh-ux/muk/dist/style.css';
3+
@import '@ovhcloud/ods-themes/default';
34
html {
45
font-family: var(--ods-font-family-default);
56
}

packages/manager/apps/web-hosting/src/pages/dashboard/OrderDomain.page.spec.tsx

Lines changed: 0 additions & 125 deletions
This file was deleted.

packages/manager/apps/web-hosting/src/pages/dashboard/OrderDomain.page.tsx

Lines changed: 0 additions & 91 deletions
This file was deleted.

packages/manager/apps/web-hosting/src/pages/dashboard/layout.tsx

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222

2323
import { ShellContext, useRouteSynchro } from '@ovh-ux/manager-react-shell-client';
2424
import {
25-
ActionMenu,
2625
BaseLayout,
2726
ChangelogMenu,
2827
GuideMenu,
@@ -41,7 +40,6 @@ import { EmailOptionType } from '@/data/types/product/service';
4140
import { DashboardTab } from '@/data/types/product/ssl';
4241
import { useEmailsUrl, useHostingUrl } from '@/hooks';
4342
import { useOverridePage } from '@/hooks/overridePage/useOverridePage';
44-
import { subRoutes, urls } from '@/routes/routes.constants';
4543
import { CHANGELOG_LINKS } from '@/utils/changelog.constants';
4644

4745
import { GUIDE_URL } from '../websites/websites.constants';
@@ -52,7 +50,6 @@ export default function Layout() {
5250
const { t } = useTranslation('dashboard');
5351
const isOverridedPage = useOverridePage();
5452
const { data } = useGetHostingService(serviceName);
55-
const navigate = useNavigate();
5653

5754
const { flattenData } = useDataApi<EmailOptionType>({
5855
version: 'v6',
@@ -251,19 +248,6 @@ export default function Layout() {
251248
<>
252249
<div className="mb-7 flex items-center justify-between">
253250
<Text>{data?.serviceName}</Text>
254-
<div className="flex flex-wrap justify-end">
255-
<ActionMenu
256-
id="add_domain"
257-
items={[
258-
{
259-
id: 1,
260-
label: t('hosting_action_add_domain'),
261-
onClick: () =>
262-
navigate(urls.orderDomain.replace(subRoutes.serviceName, serviceName)),
263-
},
264-
]}
265-
/>
266-
</div>
267251
</div>
268252
<ExpirationDate />
269253
{onUpdateError && (

packages/manager/apps/web-hosting/src/pages/dashboard/local-seo/LocalSeo.page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default function LocalSeo() {
6363
</Button>
6464

6565
<Datagrid
66-
columns={flattenData?.length ? columns : []}
66+
columns={flattenData ? columns : []}
6767
data={flattenData || []}
6868
hasNextPage={hasNextPage && !isLoading}
6969
onFetchNextPage={(): void => {

packages/manager/apps/web-hosting/src/pages/dashboard/multisite/Multisite.page.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ export default function MultisitePage() {
293293
<>
294294
{!isOverridedPage && (
295295
<Datagrid
296-
columns={combinedData ? columns : []}
296+
columns={columns}
297297
data={combinedData || []}
298298
isLoading={isLoading}
299299
autoScroll={false}
@@ -309,7 +309,13 @@ export default function MultisitePage() {
309309
expandable={{
310310
expanded,
311311
setExpanded,
312-
// getRowCanExpand: () => {},
312+
getRowCanExpand: (row) => {
313+
if (isDomain(row.original)) {
314+
return false;
315+
}
316+
const website = row.original as WebHostingWebsiteType;
317+
return (website.currentState?.linkedDomains ?? 0) > 0;
318+
},
313319
}}
314320
/>
315321
)}

packages/manager/apps/web-hosting/src/pages/dashboard/multisite/__tests__/Multisite.page.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ describe('MultisitePage component', () => {
6868
expect(getByTestId('add-website-button')).toBeInTheDocument();
6969
});
7070
const button = getByTestId('add-website-button');
71-
expect(button).toHaveAttribute('label', commonTranslation.add_website);
71+
expect(button).toHaveTextContent(commonTranslation.add_website);
7272
});
7373
});

0 commit comments

Comments
 (0)