Skip to content

Commit 6c86395

Browse files
committed
feat(web-hosting): add technical conception for multisite
ref: #PUWEBPT-51 Signed-off-by: stif59100 <[email protected]>
1 parent 808d884 commit 6c86395

26 files changed

+728
-54
lines changed

packages/manager/apps/web-hosting/public/translations/common/Messages_fr_FR.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@
1010
"confirmation_delete_single_site": "Êtes-vous sûr de vouloir supprimer votre site {{website}}?",
1111
"confirmation_delete_multiple_sites": "Êtes-vous sûr de vouloir supprimer vos sites {{website}}?",
1212
"action_user_import": "Importer vos données",
13+
"multisite": "Multisite",
14+
"add_website": "Ajouter un site",
15+
"add_domain": "Ajouter un domaine",
16+
"detache_domain": "Détacher un domaine",
17+
"modify_domain": "Modifier un domaine",
18+
"associate_git": "Associer GIT",
19+
"configure_git": "Configurer GIT",
20+
"delete_git": "Supprimer GIT",
21+
"deploye_git": "Déployer GIT",
22+
"last_deployment_git": "Informations sur le dernier déploiement",
23+
"modify_cdn": "Modifier le CDN",
24+
"purge_cdn": "Purger le CDN",
25+
"add_module": "Ajouter un module",
26+
"delete_module": "Supprimer le module",
27+
"access_website": "Accéder au site",
28+
"access_interface": "Accéder à l'interface",
1329
"web_hosting_header_order": "Commander",
1430
"web_hosting_header_guide_general_informations": "Informations générales",
1531
"web_hosting_header_tasks": "Tâches",

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

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
import { EmailOptionType } from '@/data/types/product/service';
3434
import { DashboardTab } from '@/data/types/product/ssl';
3535
import { useEmailsUrl, useHostingUrl } from '@/hooks';
36+
import { useOverridePage } from '@/hooks/overridePage/useOverridePage';
3637
import { subRoutes, urls } from '@/routes/routes.constants';
3738
import { CHANGELOG_LINKS } from '@/utils/changelog.constants';
3839

@@ -43,7 +44,7 @@ export default function Layout() {
4344
const navigate = useNavigate();
4445
const { serviceName } = useParams();
4546
const { t } = useTranslation('dashboard');
46-
47+
const isOverridedPage = useOverridePage();
4748
const { data } = useGetHostingService(serviceName);
4849
const { flattenData } = useResourcesIcebergV6<EmailOptionType>({
4950
route: `/hosting/web/${serviceName}/emailOption`,
@@ -56,7 +57,7 @@ export default function Layout() {
5657
const { pathname, hash } = useLocation();
5758

5859
const generalUrl = useHostingUrl(serviceName);
59-
const multisiteUrl = useHostingUrl(serviceName, 'multisite');
60+
const multisiteUrl = `#/${serviceName}/multisite`;
6061
const sslPathname = `#/${serviceName}/ssl`;
6162
const moduleUrl = useHostingUrl(serviceName, 'module');
6263
const logsUrl = useHostingUrl(serviceName, 'user-logs');
@@ -161,7 +162,8 @@ export default function Layout() {
161162
return safeUrl.startsWith('#') ? safeUrl.slice(1) : safeUrl;
162163
};
163164
const activeTab = useMemo(() => {
164-
const currentPath = hash || pathname;
165+
const currentPath = hash ? hash : pathname;
166+
165167
return tabs.find((tab) => getComparablePath(tab.to) === currentPath);
166168
}, [tabs, pathname, hash]);
167169

@@ -241,47 +243,50 @@ export default function Layout() {
241243
<GuideButton items={guideItems} />
242244
</div>
243245
</div>
244-
245-
<div className="flex items-center justify-between mb-7">
246-
<OdsText>{data?.serviceName}</OdsText>
247-
<div className="flex flex-wrap justify-end">
248-
<ActionMenu
249-
id="add_domain"
250-
items={[
251-
{
252-
id: 1,
253-
label: t('hosting_action_add_domain'),
254-
onClick: () =>
255-
navigate(urls.orderDomain.replace(subRoutes.serviceName, serviceName)),
256-
},
257-
]}
258-
/>
259-
</div>
260-
</div>
261-
<ExpirationDate />
262-
{onUpdateError && (
263-
<OdsMessage
264-
className="mb-10 w-full"
265-
color={ODS_MESSAGE_COLOR.warning}
266-
isDismissible
267-
onOdsRemove={() => {
268-
setOnUpdateError(false);
269-
}}
270-
>
271-
{t('hosting_dashboard_loading_error')}
272-
</OdsMessage>
246+
{!isOverridedPage && (
247+
<>
248+
<div className="flex items-center justify-between mb-7">
249+
<OdsText>{data?.serviceName}</OdsText>
250+
<div className="flex flex-wrap justify-end">
251+
<ActionMenu
252+
id="add_domain"
253+
items={[
254+
{
255+
id: 1,
256+
label: t('hosting_action_add_domain'),
257+
onClick: () =>
258+
navigate(urls.orderDomain.replace(subRoutes.serviceName, serviceName)),
259+
},
260+
]}
261+
/>
262+
</div>
263+
</div>
264+
<ExpirationDate />
265+
{onUpdateError && (
266+
<OdsMessage
267+
className="mb-10 w-full"
268+
color={ODS_MESSAGE_COLOR.warning}
269+
isDismissible
270+
onOdsRemove={() => {
271+
setOnUpdateError(false);
272+
}}
273+
>
274+
{t('hosting_dashboard_loading_error')}
275+
</OdsMessage>
276+
)}
277+
<div className=" mt-8 mb-6">
278+
<Tabs>
279+
{tabs.map((tab: DashboardTab) => (
280+
<a href={tab.to} className="no-underline" key={tab.name}>
281+
<OdsTab isSelected={tab.name === activeTab?.name} role="tab">
282+
{tab.title}
283+
</OdsTab>
284+
</a>
285+
))}
286+
</Tabs>
287+
</div>
288+
</>
273289
)}
274-
<div className=" mt-8 mb-6">
275-
<Tabs>
276-
{tabs.map((tab: DashboardTab) => (
277-
<a href={tab.to} className="no-underline" key={tab.name}>
278-
<OdsTab isSelected={tab.name === activeTab?.name} role="tab">
279-
{tab.title}
280-
</OdsTab>
281-
</a>
282-
))}
283-
</Tabs>
284-
</div>
285290
<Outlet />
286291
</PageLayout>
287292
);
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
import { useMemo } from 'react';
2+
3+
import { Outlet, useNavigate, useParams } from 'react-router-dom';
4+
5+
import { useTranslation } from 'react-i18next';
6+
7+
import { Datagrid, DatagridColumn, ManagerButton } from '@ovh-ux/manager-react-components';
8+
9+
import { useOverridePage } from '@/hooks/overridePage/useOverridePage';
10+
import { subRoutes, urls } from '@/routes/routes.constants';
11+
12+
import ActionButtonMultisite from './component/ActionButtonMultisite.component';
13+
14+
export type DashboardTabItemProps = {
15+
name: string;
16+
title: string;
17+
pathMatchers?: RegExp[];
18+
to: string;
19+
};
20+
21+
export type DashboardLayoutProps = {
22+
tabs: DashboardTabItemProps[];
23+
};
24+
export default function MultisitePage() {
25+
const { serviceName } = useParams<{ serviceName: string }>();
26+
const { t } = useTranslation('common');
27+
const isOverridedPage = useOverridePage();
28+
const navigate = useNavigate();
29+
const items = [
30+
{
31+
site: serviceName,
32+
domain: 'test.site',
33+
path: 'testsuppression',
34+
},
35+
];
36+
const columns: DatagridColumn<(typeof items)[0]>[] = useMemo(
37+
() => [
38+
{
39+
id: 'site',
40+
label: 'Site',
41+
isSortable: true,
42+
cell: (row) => <div>{row.site}</div>,
43+
},
44+
{
45+
id: 'domain',
46+
label: 'Domaine',
47+
isSortable: true,
48+
cell: (row) => <div>{row.domain}</div>,
49+
},
50+
{
51+
id: 'cms',
52+
label: 'Cms',
53+
isSortable: true,
54+
cell: (row) => <div>{row.site}</div>,
55+
},
56+
{
57+
id: 'path',
58+
label: 'Répertoire',
59+
isSortable: true,
60+
cell: (row) => <div>{row.path}</div>,
61+
},
62+
{
63+
id: 'git',
64+
label: 'Git',
65+
isSortable: true,
66+
cell: (row) => <div>{row.site}</div>,
67+
},
68+
{
69+
id: 'action',
70+
label: '',
71+
isSortable: true,
72+
cell: (row) => (
73+
<ActionButtonMultisite
74+
site={row.site}
75+
domain={row.domain}
76+
//cms={row.cms}
77+
path={row.path}
78+
//git={row.git}
79+
/>
80+
),
81+
},
82+
],
83+
[],
84+
);
85+
return (
86+
<>
87+
{!isOverridedPage && (
88+
<Datagrid
89+
columns={columns}
90+
items={items || []}
91+
totalItems={0}
92+
topbar={
93+
<ManagerButton
94+
id={''}
95+
label={t('add_website')}
96+
onClick={() => navigate(urls.addWebSite.replace(subRoutes.serviceName, serviceName))}
97+
/>
98+
}
99+
/>
100+
)}
101+
<Outlet />
102+
</>
103+
);
104+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function ModifyCdnPage() {
2+
return <>ModifyCdnPage</>;
3+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { useNavigate } from 'react-router-dom';
2+
3+
import { useTranslation } from 'react-i18next';
4+
5+
import { Modal } from '@ovh-ux/manager-react-components';
6+
7+
export default function PurgeCdnModal() {
8+
const { t } = useTranslation('common');
9+
const navigate = useNavigate();
10+
11+
const onClose = () => {
12+
navigate(-1);
13+
};
14+
return <Modal heading={t('purge_cdn')} onDismiss={onClose} isOpen></Modal>;
15+
}

0 commit comments

Comments
 (0)