-
Notifications
You must be signed in to change notification settings - Fork 111
feat(public-vcf-aas): add edge gateway tab #20068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pauldkn
merged 1 commit into
project/vcf-edge-gateway
from
feat/MANAGER-18386-vcd-edge-listing
Oct 30, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
...pc-vmware-public-vcf-aas/public/translations/datacentres/edge-gateway/Messages_fr_FR.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "edge_add": "Ajouter une Edge Gateway", | ||
| "edge_add_tooltip": "Vous pouvez créer 5 Edge Gateways maximum.", | ||
| "edge_connectivity_type": "Type de connectivité", | ||
| "edge_ip_block": "Bloc IP", | ||
| "edge_edit_config": "Modifier la configuration" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...hpc-vmware-public-vcf-aas/src/pages/dashboard/datacentre/datacentreDashboard.constants.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| export const COMPUTE_LABEL = 'Compute'; | ||
| export const STORAGE_LABEL = 'Storage'; | ||
| export const EDGE_GATEWAY_LABEL = 'Edge Gateway'; |
60 changes: 60 additions & 0 deletions
60
...public-vcf-aas/src/pages/dashboard/datacentre/edge-gateway/DatacentreEdgeGateway.page.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import { | ||
| useVcdDatacentre, | ||
| useVcdEdgeGatewaysMocks, | ||
| } from '@ovh-ux/manager-module-vcd-api'; | ||
| import { | ||
| Datagrid, | ||
| ErrorBanner, | ||
| RedirectionGuard, | ||
| } from '@ovh-ux/manager-react-components'; | ||
| import { OdsText } from '@ovhcloud/ods-components/react'; | ||
| import { useParams } from 'react-router-dom'; | ||
| import { Suspense } from 'react'; | ||
| import { urls } from '@/routes/routes.constant'; | ||
| import { EDGE_GATEWAY_LABEL } from '../datacentreDashboard.constants'; | ||
| import Loading from '@/components/loading/Loading.component'; | ||
| import { useEdgeGatewayListingColumns } from './hooks/useEdgeGatewayListingColumns'; | ||
| import { EdgeGatewayOrderButton } from './components/EdgeGatewayOrderButton.component'; | ||
| import { isEdgeCompatibleVDC } from '@/utils/edgeGatewayCompatibility'; | ||
|
|
||
| export default function EdgeGatewayListingPage() { | ||
| const { id, vdcId } = useParams(); | ||
| const columns = useEdgeGatewayListingColumns(); | ||
| const vdcQuery = useVcdDatacentre(id, vdcId); | ||
| const edgeQuery = useVcdEdgeGatewaysMocks(id, vdcId); | ||
|
|
||
| const queryList = [vdcQuery, edgeQuery]; | ||
| const queries = { | ||
| isLoading: queryList.some((q) => q.isLoading), | ||
| isError: queryList.some((q) => q.isError), | ||
| error: queryList.find((q) => q.isError)?.error?.message ?? null, | ||
| data: { vdc: vdcQuery?.data?.data, edge: edgeQuery?.data }, | ||
| }; | ||
|
|
||
| if (queries.isLoading) return <Loading />; | ||
| if (queries.isError) { | ||
| return ( | ||
| <ErrorBanner error={{ status: 404, data: { message: queries.error } }} /> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <RedirectionGuard | ||
| isLoading={queries.isLoading} | ||
| route={urls.listing} | ||
| condition={isEdgeCompatibleVDC(queries.data.vdc)} | ||
| > | ||
| <Suspense fallback={<Loading />}> | ||
| <section className="px-10 flex flex-col"> | ||
| <OdsText preset="heading-3">{EDGE_GATEWAY_LABEL}</OdsText> | ||
| <EdgeGatewayOrderButton className="mt-4 mb-8" /> | ||
| <Datagrid | ||
| columns={columns} | ||
| items={queries.data.edge} | ||
| totalItems={queries.data.edge?.length} | ||
| /> | ||
| </section> | ||
| </Suspense> | ||
| </RedirectionGuard> | ||
| ); | ||
| } |
63 changes: 63 additions & 0 deletions
63
...public-vcf-aas/src/pages/dashboard/datacentre/edge-gateway/DatacentreEdgeGateway.spec.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| import { expect, it, describe } from 'vitest'; | ||
| import { screen, waitFor } from '@testing-library/react'; | ||
| import { | ||
| organizationList, | ||
| datacentreList, | ||
| EDGE_GATEWAY_MOCKS, | ||
| } from '@ovh-ux/manager-module-vcd-api'; | ||
| import { assertTextVisibility } from '@ovh-ux/manager-core-test-utils'; | ||
| import { labels, renderTest } from '../../../../test-utils'; | ||
| import { EDGE_GATEWAY_LABEL } from '../datacentreDashboard.constants'; | ||
| import { urls } from '../../../../routes/routes.constant'; | ||
| import TEST_IDS from '../../../../utils/testIds.constants'; | ||
|
|
||
| const config = { | ||
| org: organizationList[0], | ||
| vdc: datacentreList[0], | ||
| edge: EDGE_GATEWAY_MOCKS[0], | ||
| labels: { ...labels.datacentresEdgeGateway, ...labels.commonDashboard }, | ||
| waitOptions: { timeout: 10_000 }, | ||
| }; | ||
|
|
||
| describe('Datacentre Edge Gateway Listing Page', () => { | ||
| const initialRoute = urls.edgeGateway | ||
| .replace(':id', config.org.id) | ||
| .replace(':vdcId', config.vdc.id); | ||
|
|
||
| it('access and display Edge Gateway listing page', async () => { | ||
| await renderTest({ initialRoute }); | ||
|
|
||
| // check page title | ||
| await assertTextVisibility(EDGE_GATEWAY_LABEL); | ||
|
|
||
| // wait for data to be loaded | ||
| await waitFor(() => { | ||
| expect( | ||
| screen.getByText(config.edge.currentState.edgeGatewayName), | ||
| ).toBeVisible(); | ||
| }, config.waitOptions); | ||
|
|
||
| // check order button | ||
| const orderCta = screen.getByTestId(TEST_IDS.edgeGatewayOrderCta); | ||
| expect(orderCta).toBeVisible(); | ||
| expect(orderCta).toBeEnabled(); | ||
| expect(orderCta).toHaveAttribute('label', config.labels.edge_add); | ||
|
|
||
| // check datagrid columns | ||
| const elements = [ | ||
| labels.commonDashboard.name, | ||
| config.labels.edge_ip_block, | ||
| config.labels.edge_connectivity_type, | ||
| config.edge.currentState.edgeGatewayName, | ||
| config.edge.currentState.ipBlock, | ||
| ]; | ||
| elements.forEach((el) => expect(screen.getByText(el)).toBeVisible()); | ||
| }); | ||
|
|
||
| // TODO: [EDGE] remove when unmocking | ||
| it.skip('display an error', async () => { | ||
| await renderTest({ initialRoute, isEdgeGatewayKO: true }); | ||
|
|
||
| await assertTextVisibility(labels.error.manager_error_page_default); | ||
| }); | ||
| }); |
56 changes: 56 additions & 0 deletions
56
...aas/src/pages/dashboard/datacentre/edge-gateway/components/EdgeGatewayCells.component.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import { NAMESPACES } from '@ovh-ux/manager-common-translations'; | ||
| import { VCDEdgeGateway } from '@ovh-ux/manager-module-vcd-api'; | ||
| import { | ||
| ActionMenu, | ||
| ActionMenuItem, | ||
| DataGridTextCell, | ||
| } from '@ovh-ux/manager-react-components'; | ||
| import { ODS_BUTTON_VARIANT } from '@ovhcloud/ods-components'; | ||
| import { useId } from 'react'; | ||
| import { useTranslation } from 'react-i18next'; | ||
|
|
||
| export const EdgeGatewayNameCell = (edge: VCDEdgeGateway) => ( | ||
| <DataGridTextCell>{edge.currentState.edgeGatewayName}</DataGridTextCell> | ||
| ); | ||
|
|
||
| export const EdgeGatewayConnectivityCell = () => ( | ||
| // TODO: [EDGE] see what content goes here | ||
| <DataGridTextCell>N/A</DataGridTextCell> | ||
| ); | ||
|
|
||
| export const EdgeGatewayIPBlockCell = (edge: VCDEdgeGateway) => ( | ||
| <DataGridTextCell>{edge.currentState.ipBlock}</DataGridTextCell> | ||
| ); | ||
|
|
||
| export const EdgeGatewayActionCell = () => { | ||
| const { t } = useTranslation([ | ||
| 'datacentres/edge-gateway', | ||
| NAMESPACES.ACTIONS, | ||
| ]); | ||
| const id = useId(); | ||
|
|
||
| const actionMenuItems: ActionMenuItem[] = [ | ||
| { | ||
| id: 1, | ||
| label: t('datacentres/edge-gateway:edge_edit_config'), | ||
| isDisabled: false, | ||
| onClick: () => {}, | ||
| }, | ||
| { | ||
| id: 2, | ||
| label: t(`${NAMESPACES.ACTIONS}:delete`), | ||
| isDisabled: false, | ||
| onClick: () => {}, | ||
| }, | ||
| ]; | ||
|
|
||
| return ( | ||
| <ActionMenu | ||
| id={`edgeActionMenu-${id}`} | ||
| items={actionMenuItems} | ||
| isCompact | ||
| variant={ODS_BUTTON_VARIANT.ghost} | ||
| isDisabled={false} | ||
| /> | ||
| ); | ||
| }; |
41 changes: 41 additions & 0 deletions
41
...c/pages/dashboard/datacentre/edge-gateway/components/EdgeGatewayOrderButton.component.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import { useId } from 'react'; | ||
| import { useTranslation } from 'react-i18next'; | ||
| import clsx from 'clsx'; | ||
| import { ODS_BUTTON_COLOR } from '@ovhcloud/ods-components'; | ||
| import { | ||
| OdsButton, | ||
| OdsIcon, | ||
| OdsText, | ||
| OdsTooltip, | ||
| } from '@ovhcloud/ods-components/react'; | ||
| import TEST_IDS from '@/utils/testIds.constants'; | ||
|
|
||
| export const EdgeGatewayOrderButton = ( | ||
| props: React.HTMLAttributes<HTMLDivElement>, | ||
| ) => { | ||
| const { t } = useTranslation('datacentres/edge-gateway'); | ||
| const tooltipId = useId(); | ||
|
|
||
| return ( | ||
| <div | ||
| {...props} | ||
| className={clsx('flex gap-x-2 items-center w-fit', props.className)} | ||
| > | ||
| <OdsButton | ||
| label={t('edge_add')} | ||
| variant="outline" | ||
| onClick={() => {}} | ||
| data-testid={TEST_IDS.edgeGatewayOrderCta} | ||
| /> | ||
| <OdsIcon | ||
| id={tooltipId} | ||
| name="circle-info" | ||
| className="cursor-help" | ||
| color={ODS_BUTTON_COLOR.primary} | ||
| /> | ||
| <OdsTooltip triggerId={tooltipId}> | ||
| <OdsText>{t('edge_add_tooltip')}</OdsText> | ||
| </OdsTooltip> | ||
| </div> | ||
| ); | ||
| }; |
44 changes: 44 additions & 0 deletions
44
...vcf-aas/src/pages/dashboard/datacentre/edge-gateway/hooks/useEdgeGatewayListingColumns.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { VCDEdgeGateway } from '@ovh-ux/manager-module-vcd-api'; | ||
| import { DatagridColumn } from '@ovh-ux/manager-react-components'; | ||
| import { useTranslation } from 'react-i18next'; | ||
| import { NAMESPACES } from '@ovh-ux/manager-common-translations'; | ||
| import { | ||
| EdgeGatewayNameCell, | ||
| EdgeGatewayConnectivityCell, | ||
| EdgeGatewayIPBlockCell, | ||
| EdgeGatewayActionCell, | ||
| } from '../components/EdgeGatewayCells.component'; | ||
|
|
||
| export const useEdgeGatewayListingColumns = () => { | ||
| const { t } = useTranslation('datacentres/edge-gateway'); | ||
| const { t: tCommonDashboard } = useTranslation(NAMESPACES.DASHBOARD); | ||
|
|
||
| const columns: Array<DatagridColumn<VCDEdgeGateway>> = [ | ||
| { | ||
| id: 'name', | ||
| cell: EdgeGatewayNameCell, | ||
| label: tCommonDashboard('name'), | ||
| isSortable: false, | ||
| }, | ||
| { | ||
| id: 'connectivity_type', | ||
| cell: EdgeGatewayConnectivityCell, | ||
| label: t('edge_connectivity_type'), | ||
| isSortable: false, | ||
| }, | ||
| { | ||
| id: 'ip_block', | ||
| cell: EdgeGatewayIPBlockCell, | ||
| label: t('edge_ip_block'), | ||
| isSortable: false, | ||
| }, | ||
| { | ||
| id: 'actions', | ||
| cell: EdgeGatewayActionCell, | ||
| label: '', | ||
| isSortable: false, | ||
| }, | ||
| ]; | ||
|
|
||
| return columns; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.