diff --git a/gql-queries-generator/doc/queries.graphql b/gql-queries-generator/doc/queries.graphql index 0adaeae37..8189d88b6 100644 --- a/gql-queries-generator/doc/queries.graphql +++ b/gql-queries-generator/doc/queries.graphql @@ -48,6 +48,13 @@ mutation consoleCreateAccount($account: AccountIn!) { } } +query consoleGetAvailableKloudliteRegions { + accounts_availableKloudliteRegions { + displayName + id + } +} + query consoleListAccounts { accounts_listAccounts { id @@ -57,6 +64,7 @@ query consoleListAccounts { } updateTime displayName + kloudliteGatewayRegion } } @@ -76,6 +84,7 @@ query consoleGetAccount($accountName: String!) { updateTime contactEmail displayName + kloudliteGatewayRegion } } diff --git a/src/apps/console/routes/_a+/new-team.tsx b/src/apps/console/routes/_a+/new-team.tsx index e3ca20aa2..a2c67feff 100644 --- a/src/apps/console/routes/_a+/new-team.tsx +++ b/src/apps/console/routes/_a+/new-team.tsx @@ -29,50 +29,32 @@ const NewAccount = () => { return api.listAccounts({}); }); - const regions = [ - { - label: 'ap-south-1', - value: 'ap-south-1', - render: () => ( -
-
ap-south-1
-
- ), - }, - { - label: 'eu-north-1', - value: 'eu-north-1', - render: () => ( -
-
eu-north-1
-
- ), - }, - { - label: 'eu-west-3', - value: 'eu-west-3', - render: () => ( -
-
eu-west-3
-
- ), - }, - { - label: 'eu-west-2', - value: 'eu-west-2', + const { data: kloudliteRegionsData, isLoading: klRegionIsLoading } = + useCustomSwr( + 'kloudliteRegions', + async () => api.getAvailableKloudliteRegions({}), + true + ); + + console.log('klRegionIsLoading', kloudliteRegionsData); + + const klRegionData = kloudliteRegionsData?.map((d) => { + return { + label: d.displayName, + value: d.id, render: () => (
-
eu-west-2
+
{d.displayName}
), - }, - ]; + }; + }); const { values, handleChange, errors, isLoading, handleSubmit } = useForm({ initialValues: { name: '', displayName: '', - region: regions[0].value, + region: '', isNameError: false, }, validationSchema: Yup.object({ @@ -86,6 +68,7 @@ const NewAccount = () => { metadata: { name: v.name }, displayName: v.displayName, contactEmail: user.email, + kloudliteGatewayRegion: v.region, }, }); if (_errors) { @@ -151,18 +134,21 @@ const NewAccount = () => { handleChange={handleChange} nameErrorLabel="isNameError" /> - {/*