-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sync: master to develop
- Loading branch information
Showing
21 changed files
with
278 additions
and
103 deletions.
There are no files selected for viewing
This file contains 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
13 changes: 13 additions & 0 deletions
13
.../manager/apps/container/src/container/nav-reshuffle/data/api/defaultPublicCloudProject.ts
This file contains 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,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<Preference>('/me/preferences/manager/PUBLIC_CLOUD_DEFAULT_PROJECT'); | ||
const defaultProject: DefaultPublicCloudProjectPreference = data?.value ? JSON.parse(data.value) : null; | ||
return defaultProject.projectId; | ||
} | ||
catch (e) { | ||
return null; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...ainer/nav-reshuffle/data/hooks/defaultPublicCloudProject/useDefaultPublicCloudProject.tsx
This file contains 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,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<DefinedInitialDataOptions<string | null, unknown, PciProject>>) => | ||
useQuery({ | ||
...options, | ||
queryKey: ['default-pci-project'], | ||
queryFn: getDefaultPublicCloudProjectId, | ||
retry: false, | ||
}); |
This file contains 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 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 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 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 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 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,8 @@ | ||
export type Preference = { | ||
key: string; | ||
value: string; | ||
} | ||
|
||
export type DefaultPublicCloudProjectPreference = { | ||
projectId: string; | ||
} |
This file contains 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 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 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 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.