From a59be3e58908478c5faada6fac078003026dfbba Mon Sep 17 00:00:00 2001 From: nxtcoder36 Date: Mon, 23 Sep 2024 18:23:36 +0530 Subject: [PATCH] kl cli update for listing of clusters --- gql-queries-generator/doc/queries.graphql | 39 +++++++------- src/apps/auth/server/gql/cli-queries.ts | 54 ++++++++----------- .../images/handle-image-discovery.tsx | 5 +- .../gql/queries/registry-image-queries.ts | 12 ++--- src/generated/codegen-sdl.yml | 2 +- src/generated/codegen.yml | 2 +- src/generated/gql/sdl.graphql | 7 ++- src/generated/gql/server.ts | 41 +++++++------- 8 files changed, 74 insertions(+), 88 deletions(-) diff --git a/gql-queries-generator/doc/queries.graphql b/gql-queries-generator/doc/queries.graphql index 6cca06b27..80f53a71e 100644 --- a/gql-queries-generator/doc/queries.graphql +++ b/gql-queries-generator/doc/queries.graphql @@ -4482,8 +4482,8 @@ query consoleGetRegistryImage($image: String!) { } } -query consoleGetRegistryImageUrl($image: String!, $meta: Map!) { - core_getRegistryImageURL(image: $image, meta: $meta) { +query consoleGetRegistryImageUrl { + core_getRegistryImageURL { scriptUrl url } @@ -6482,6 +6482,22 @@ query authCli_getRemoteLogin($loginId: String!, $secret: String!) { } } +query authCli_listAccountClusters($pagination: CursorPaginationIn) { + infra_listBYOKClusters(pagination: $pagination) { + edges { + node { + clusterToken + displayName + id + metadata { + name + labels + } + } + } + } +} + mutation authCli_createClusterReference($cluster: BYOKClusterIn!) { infra_createBYOKCluster(cluster: $cluster) { id @@ -6626,25 +6642,6 @@ query authCli_listImportedManagedResources($envName: String!, $search: SearchImp } } -query authCli_listByokClusters($search: SearchCluster, $pagination: CursorPaginationIn) { - infra_listBYOKClusters(search: $search, pagination: $pagination) { - edges { - cursor - node { - clusterToken - displayName - id - metadata { - name - namespace - } - updateTime - } - } - totalCount - } -} - mutation authSetRemoteAuthHeader($loginId: String!, $authHeader: String) { auth_setRemoteAuthHeader(loginId: $loginId, authHeader: $authHeader) } diff --git a/src/apps/auth/server/gql/cli-queries.ts b/src/apps/auth/server/gql/cli-queries.ts index a8f77899c..970a20bfa 100644 --- a/src/apps/auth/server/gql/cli-queries.ts +++ b/src/apps/auth/server/gql/cli-queries.ts @@ -717,6 +717,29 @@ export const cliQueries = (executor: IExecutor) => ({ vars: (_: any) => {}, } ), + cli_listAccountClusters: executor( + gql` + query Infra_listBYOKClusters($pagination: CursorPaginationIn) { + infra_listBYOKClusters(pagination: $pagination) { + edges { + node { + clusterToken + displayName + id + metadata { + name + labels + } + } + } + } + } + `, + { + transformer: (data: any) => data.infra_listBYOKClusters, + vars(_: any) {}, + } + ), cli_createClusterReference: executor( gql` mutation Infra_createBYOKCluster($cluster: BYOKClusterIn!) { @@ -905,35 +928,4 @@ export const cliQueries = (executor: IExecutor) => ({ vars(_: any) {}, } ), - cli_listByokClusters: executor( - gql` - query Infra_listBYOKClusters( - $search: SearchCluster - $pagination: CursorPaginationIn - ) { - infra_listBYOKClusters(search: $search, pagination: $pagination) { - edges { - cursor - node { - clusterToken - displayName - id - metadata { - name - namespace - } - updateTime - } - } - totalCount - } - } - `, - { - transformer: (data: any) => { - return data.infra_listBYOKClusters; - }, - vars(_: any) {}, - } - ), }); diff --git a/src/apps/console/routes/_main+/$account+/settings+/images/handle-image-discovery.tsx b/src/apps/console/routes/_main+/$account+/settings+/images/handle-image-discovery.tsx index 62992487d..c3a6f851b 100644 --- a/src/apps/console/routes/_main+/$account+/settings+/images/handle-image-discovery.tsx +++ b/src/apps/console/routes/_main+/$account+/settings+/images/handle-image-discovery.tsx @@ -21,10 +21,7 @@ export const RegistryImageInstruction = ({ const { data, isLoading, error } = useCustomSwr( 'registry-image-instructions', async () => { - return api.getRegistryImageUrl({ - image: '', - meta: {}, - }); + return api.getRegistryImageUrl(); } ); diff --git a/src/apps/console/server/gql/queries/registry-image-queries.ts b/src/apps/console/server/gql/queries/registry-image-queries.ts index 569d11363..90c59a8bd 100644 --- a/src/apps/console/server/gql/queries/registry-image-queries.ts +++ b/src/apps/console/server/gql/queries/registry-image-queries.ts @@ -29,7 +29,7 @@ export const registryImagesQueries = (executor: IExecutor) => ({ { transformer: (data: ConsoleDeleteRegistryImageMutation) => data.core_deleteRegistryImage, - vars(_: ConsoleDeleteRegistryImageMutationVariables) { }, + vars(_: ConsoleDeleteRegistryImageMutationVariables) {}, } ), getRegistryImage: executor( @@ -51,13 +51,13 @@ export const registryImagesQueries = (executor: IExecutor) => ({ { transformer: (data: ConsoleGetRegistryImageQuery) => data.core_getRegistryImage, - vars(_: ConsoleGetRegistryImageQueryVariables) { }, + vars(_: ConsoleGetRegistryImageQueryVariables) {}, } ), getRegistryImageUrl: executor( gql` - query Core_getRegistryImageURL($image: String!, $meta: Map!) { - core_getRegistryImageURL(image: $image, meta: $meta) { + query Core_getRegistryImageURL { + core_getRegistryImageURL { scriptUrl url } @@ -66,7 +66,7 @@ export const registryImagesQueries = (executor: IExecutor) => ({ { transformer: (data: ConsoleGetRegistryImageUrlQuery) => data.core_getRegistryImageURL, - vars(_: ConsoleGetRegistryImageUrlQueryVariables) { }, + vars(_: ConsoleGetRegistryImageUrlQueryVariables) {}, } ), listRegistryImages: executor( @@ -101,7 +101,7 @@ export const registryImagesQueries = (executor: IExecutor) => ({ transformer: (data: ConsoleListRegistryImagesQuery) => { return data.core_listRegistryImages; }, - vars(_: ConsoleListRegistryImagesQueryVariables) { }, + vars(_: ConsoleListRegistryImagesQueryVariables) {}, } ), }); diff --git a/src/generated/codegen-sdl.yml b/src/generated/codegen-sdl.yml index f8de57b98..abfed7f3a 100644 --- a/src/generated/codegen-sdl.yml +++ b/src/generated/codegen-sdl.yml @@ -1,5 +1,5 @@ overwrite: true -schema: "http://gateway.kloudlite.svc.cluster.local:3000" +schema: "http://gateway-api.kloudlite.svc.cluster.local:3000" generates: gql/sdl.graphql: plugins: diff --git a/src/generated/codegen.yml b/src/generated/codegen.yml index 5288f88d4..684ed9663 100644 --- a/src/generated/codegen.yml +++ b/src/generated/codegen.yml @@ -1,5 +1,5 @@ overwrite: true -schema: "http://gateway.kloudlite.svc.cluster.local:3000" +schema: "http://gateway-api.kloudlite.svc.cluster.local:3000" generates: gql/server.ts: documents: diff --git a/src/generated/gql/sdl.graphql b/src/generated/gql/sdl.graphql index cba9001f5..5e339025b 100644 --- a/src/generated/gql/sdl.graphql +++ b/src/generated/gql/sdl.graphql @@ -1,3 +1,8 @@ +""" +Indicates exactly one field must be supplied and this field must not be `null`. +""" +directive @oneOf on INPUT_OBJECT + """Exposes a URL that specifies the behavior of this scalar.""" directive @specifiedBy( """The URL that specifies the behavior of this scalar.""" @@ -3951,7 +3956,7 @@ type Query { core_getManagedResouceOutputKeyValues(envName: String, keyrefs: [ManagedResourceKeyRefIn], msvcName: String): [ManagedResourceKeyValueRef!]! core_getManagedResource(envName: String, msvcName: String, name: String!): ManagedResource core_getRegistryImage(image: String!): RegistryImage - core_getRegistryImageURL(image: String!, meta: Map!): RegistryImageURL! + core_getRegistryImageURL: RegistryImageURL! core_getRouter(envName: String!, name: String!): Router core_getSecret(envName: String!, name: String!): Secret core_getSecretValues(envName: String!, queries: [SecretKeyRefIn!]): [SecretKeyValueRef!] diff --git a/src/generated/gql/server.ts b/src/generated/gql/server.ts index d732b6784..892312215 100644 --- a/src/generated/gql/server.ts +++ b/src/generated/gql/server.ts @@ -6114,8 +6114,7 @@ export type ConsoleGetRegistryImageQuery = { }; export type ConsoleGetRegistryImageUrlQueryVariables = Exact<{ - image: Scalars['String']['input']; - meta: Scalars['Map']['input']; + [key: string]: never; }>; export type ConsoleGetRegistryImageUrlQuery = { @@ -8133,6 +8132,23 @@ export type AuthCli_GetRemoteLoginQuery = { auth_getRemoteLogin?: { authHeader?: string; status: string }; }; +export type AuthCli_ListAccountClustersQueryVariables = Exact<{ + pagination?: InputMaybe; +}>; + +export type AuthCli_ListAccountClustersQuery = { + infra_listBYOKClusters?: { + edges: Array<{ + node: { + clusterToken: string; + displayName: string; + id: string; + metadata: { name: string; labels?: any }; + }; + }>; + }; +}; + export type AuthCli_CreateClusterReferenceMutationVariables = Exact<{ cluster: ByokClusterIn; }>; @@ -8276,27 +8292,6 @@ export type AuthCli_ListImportedManagedResourcesQuery = { }; }; -export type AuthCli_ListByokClustersQueryVariables = Exact<{ - search?: InputMaybe; - pagination?: InputMaybe; -}>; - -export type AuthCli_ListByokClustersQuery = { - infra_listBYOKClusters?: { - totalCount: number; - edges: Array<{ - cursor: string; - node: { - clusterToken: string; - displayName: string; - id: string; - updateTime: any; - metadata: { name: string; namespace?: string }; - }; - }>; - }; -}; - export type AuthSetRemoteAuthHeaderMutationVariables = Exact<{ loginId: Scalars['String']['input']; authHeader?: InputMaybe;