diff --git a/packages/manager-react-components/src/components/breadcrumb/breadcrumb.component.tsx b/packages/manager-react-components/src/components/breadcrumb/breadcrumb.component.tsx index 71fa6ec6ce37..1755f6593fee 100644 --- a/packages/manager-react-components/src/components/breadcrumb/breadcrumb.component.tsx +++ b/packages/manager-react-components/src/components/breadcrumb/breadcrumb.component.tsx @@ -16,9 +16,8 @@ export const Breadcrumb: React.FC = ({ rootLabel, appName, }) => { - const label = rootLabel; const breadcrumbItems = useBreadcrumb({ - rootLabel: label, + rootLabel, appName, }); return ( diff --git a/packages/manager-react-components/src/components/templates/error/error.component.tsx b/packages/manager-react-components/src/components/templates/error/error.component.tsx index 62680985bbdf..99912efa4790 100644 --- a/packages/manager-react-components/src/components/templates/error/error.component.tsx +++ b/packages/manager-react-components/src/components/templates/error/error.component.tsx @@ -35,7 +35,6 @@ export const ErrorBanner = ({ env?.then((response) => { const { applicationName } = response; const name = `errors::${getTrackingTypology(error)}::${applicationName}`; - // to confirm with the tracking team shell?.tracking?.trackPage({ name, level2: '81', diff --git a/packages/manager/core/generator/app/conditional-templates/listing/v2/index.tsx.hbs b/packages/manager/core/generator/app/conditional-templates/listing/v2/index.tsx.hbs index a9154d344849..1d0c30075408 100644 --- a/packages/manager/core/generator/app/conditional-templates/listing/v2/index.tsx.hbs +++ b/packages/manager/core/generator/app/conditional-templates/listing/v2/index.tsx.hbs @@ -2,7 +2,7 @@ import React, { useState, useEffect, } from 'react'; import { useTranslation } from 'react-i18next'; import { {{#if isPCI }}useParams, {{/if}} useNavigate, useLocation } from 'react-router-dom'; -import { OdsButton } from '@ovhcloud/ods-components/react'; +import { OdsButton, OdsSpinner } from '@ovhcloud/ods-components/react'; import { ODS_BUTTON_VARIANT } from '@ovhcloud/ods-components'; import { @@ -10,12 +10,10 @@ import { Breadcrumb, Datagrid, DataGridTextCell, + ErrorBanner, useResourcesIcebergV2, } from '@ovh-ux/manager-react-components'; -import Loading from '@/components/Loading/Loading'; -import ErrorBanner from '@/components/Error/Error'; - import appConfig from '@/{{appName}}.config'; import { urls } from '@/routes/routes.constant'; @@ -83,11 +81,21 @@ export default function Listing() { }, [data]); if (isError) { - return ; + const { response }: any = error; + const errorObj = { + data: error, + headers: response.headers, + status: response.status, + }; + return (); } if (isLoading && !flattenData) { - return (
) + return ( +
+ +
+ ); } const header = { diff --git a/packages/manager/core/generator/app/conditional-templates/listing/v6/index.tsx.hbs b/packages/manager/core/generator/app/conditional-templates/listing/v6/index.tsx.hbs index 0c7cbf3576e6..5246835a980d 100644 --- a/packages/manager/core/generator/app/conditional-templates/listing/v6/index.tsx.hbs +++ b/packages/manager/core/generator/app/conditional-templates/listing/v6/index.tsx.hbs @@ -2,21 +2,19 @@ import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { {{#if isPCI }} useParams, {{/if}} useNavigate, useLocation } from 'react-router-dom'; -import { OdsButton } from '@ovhcloud/ods-components/react'; +import { OdsButton, OdsSpinner } from '@ovhcloud/ods-components/react'; import { ODS_BUTTON_VARIANT } from '@ovhcloud/ods-components'; import { Breadcrumb, Datagrid, DataGridTextCell, + ErrorBanner, useResourcesIcebergV6, dataType, BaseLayout } from '@ovh-ux/manager-react-components'; -import Loading from '@/components/Loading/Loading'; -import ErrorBanner from '@/components/Error/Error'; - import appConfig from '@/{{appName}}.config'; export default function Listing() { @@ -84,11 +82,25 @@ export default function Listing() { }, [flattenData]); if (isError) { - return ; + const { response }: any = error; + const errorObj = { + data: error, + headers: response.headers, + status: response.status, + }; + return ( + + ); } if (isLoading && pageIndex === 1) { - return (
) + return ( +
+ +
+ ); } const header = { diff --git a/packages/manager/core/generator/app/templates/src/components/Error/Error.scss b/packages/manager/core/generator/app/templates/src/components/Error/Error.scss deleted file mode 100644 index c73220cd3be3..000000000000 --- a/packages/manager/core/generator/app/templates/src/components/Error/Error.scss +++ /dev/null @@ -1,18 +0,0 @@ -.manager-error-page { - margin-left: auto; - margin-right: auto; - max-width: 600px; - width: 100%; - display: grid; - height: 100%; - overflow: hidden; - .manager-error-page-image { - img { - width: 100%; - } - } - .manager-error-page-footer { - text-align: right; - overflow: hidden; - } -} diff --git a/packages/manager/core/generator/app/templates/src/components/Error/Error.tsx b/packages/manager/core/generator/app/templates/src/components/Error/Error.tsx deleted file mode 100644 index f3c146ce05c2..000000000000 --- a/packages/manager/core/generator/app/templates/src/components/Error/Error.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import React from 'react'; -import { useLocation, useNavigate } from 'react-router-dom'; -import { ShellContext } from '@ovh-ux/manager-react-shell-client'; -import { - ErrorMessage, - TRACKING_LABELS, - ErrorBanner, -} from '@ovh-ux/manager-react-components'; - -interface ErrorObject { - [key: string]: any; -} - -function getTrackingTypology(error: ErrorMessage) { - if (error?.detail?.status && Math.floor(error.detail.status / 100) === 4) { - return [401, 403].includes(error.detail.status) - ? TRACKING_LABELS.UNAUTHORIZED - : TRACKING_LABELS.SERVICE_NOT_FOUND; - } - return TRACKING_LABELS.PAGE_LOAD; -} - -const Errors: React.FC = ({ error }) => { - const navigate = useNavigate(); - const location = useLocation(); - const { shell } = React.useContext(ShellContext); - const { tracking, environment } = shell; - const env = environment.getEnvironment(); - - React.useEffect(() => { - env.then((response) => { - const { applicationName } = response; - const name = `errors::${getTrackingTypology(error)}::${applicationName}`; - tracking.trackPage({ - name, - level2: '81', - type: 'navigation', - page_category: location.pathname, - }); - }); - }, []); - - return ( - navigate(location.pathname, { replace: true })} - onRedirectHome={() => navigate('/', { replace: true })} - /> - ); -}; - -export default Errors; diff --git a/packages/manager/core/generator/app/templates/src/components/Loading/Loading.tsx b/packages/manager/core/generator/app/templates/src/components/Loading/Loading.tsx deleted file mode 100644 index 4c69fd5a5a11..000000000000 --- a/packages/manager/core/generator/app/templates/src/components/Loading/Loading.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react'; -import { OdsSpinner } from '@ovhcloud/ods-components/react'; - -export default function Loading() { - return ( -
-
- -
-
- ); -}