diff --git a/packages/components/ovh-at-internet/src/constants.ts b/packages/components/ovh-at-internet/src/constants.ts index 0948a3783751..ed24bf8c1e2f 100644 --- a/packages/components/ovh-at-internet/src/constants.ts +++ b/packages/components/ovh-at-internet/src/constants.ts @@ -9,7 +9,7 @@ export const AT_INTERNET_LEVEL2: Record = { 86: 'Manager-PublicCloud', 87: 'Manager-Telecom', 88: 'Manager-Hub', - 95: 'account-creation', + 95: 'Manager-account-creation', 98: 'Manager-HostedPrivateCloud', }; diff --git a/packages/manager/apps/container/src/container/nav-reshuffle/data/api/defaultPublicCloudProject.ts b/packages/manager/apps/container/src/container/nav-reshuffle/data/api/defaultPublicCloudProject.ts new file mode 100644 index 000000000000..5e8ba13f920e --- /dev/null +++ b/packages/manager/apps/container/src/container/nav-reshuffle/data/api/defaultPublicCloudProject.ts @@ -0,0 +1,13 @@ +import { v6 } from '@ovh-ux/manager-core-api'; +import { DefaultPublicCloudProjectPreference, Preference } from '@/types/preferences'; + +export const getDefaultPublicCloudProjectId = async () => { + try { + const { data } = await v6.get('/me/preferences/manager/PUBLIC_CLOUD_DEFAULT_PROJECT'); + const defaultProject: DefaultPublicCloudProjectPreference = data?.value ? JSON.parse(data.value) : null; + return defaultProject.projectId; + } + catch (e) { + return null; + } +} diff --git a/packages/manager/apps/container/src/container/nav-reshuffle/data/hooks/defaultPublicCloudProject/useDefaultPublicCloudProject.tsx b/packages/manager/apps/container/src/container/nav-reshuffle/data/hooks/defaultPublicCloudProject/useDefaultPublicCloudProject.tsx new file mode 100644 index 000000000000..7130876b1655 --- /dev/null +++ b/packages/manager/apps/container/src/container/nav-reshuffle/data/hooks/defaultPublicCloudProject/useDefaultPublicCloudProject.tsx @@ -0,0 +1,11 @@ +import { DefinedInitialDataOptions, useQuery } from '@tanstack/react-query'; +import { getDefaultPublicCloudProjectId } from '@/container/nav-reshuffle/data/api/defaultPublicCloudProject'; +import { PciProject } from '@/container/nav-reshuffle/sidebar/ProjectSelector/PciProject'; + +export const useDefaultPublicCloudProject = (options?: Partial>) => + useQuery({ + ...options, + queryKey: ['default-pci-project'], + queryFn: getDefaultPublicCloudProjectId, + retry: false, + }); diff --git a/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/SidebarLink.tsx b/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/SidebarLink.tsx index 143414251d71..df715e313540 100644 --- a/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/SidebarLink.tsx +++ b/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/SidebarLink.tsx @@ -44,7 +44,7 @@ const SidebarLink: React.FC> = ({ /> ) : (