From f8548ad537521873d69df657089bd7830cc16aa1 Mon Sep 17 00:00:00 2001 From: Abdhesh Nayak Date: Sun, 14 Jan 2024 15:54:00 +0530 Subject: [PATCH 1/3] :art: Cli queries updated --- gql-queries-generator/doc/queries.graphql | 58 ++++--------------- .../auth/server/gql/queries/infra-queries.ts | 7 +-- .../routes/_main+/$account+/_layout.tsx | 6 +- src/generated/gql/sdl.graphql | 1 - src/generated/gql/server.ts | 57 +++++------------- 5 files changed, 32 insertions(+), 97 deletions(-) diff --git a/gql-queries-generator/doc/queries.graphql b/gql-queries-generator/doc/queries.graphql index 98b5449ca..de3b666df 100644 --- a/gql-queries-generator/doc/queries.graphql +++ b/gql-queries-generator/doc/queries.graphql @@ -3686,29 +3686,6 @@ query consoleListConsoleVpnDevices($search: CoreSearchVPNDevices, $pq: CursorPag targetPort } } - status { - checks - isReady - lastReadyGeneration - lastReconcileTime - message { - RawMessage - } - resources { - apiVersion - kind - name - namespace - } - } - syncStatus { - action - error - lastSyncedAt - recordVersion - state - syncScheduledAt - } updateTime } } @@ -3754,6 +3731,8 @@ query consoleGetConsoleVpnDevice($name: String!) { query consoleListConsoleVpnDevicesForUser { core_listVPNDevicesForUser { + accountName + apiVersion createdBy { userEmail userId @@ -3762,6 +3741,8 @@ query consoleListConsoleVpnDevicesForUser { creationTime displayName environmentName + id + kind lastUpdatedBy { userEmail userId @@ -3769,7 +3750,11 @@ query consoleListConsoleVpnDevicesForUser { } markedForDeletion metadata { + annotations + creationTimestamp + deletionTimestamp generation + labels name namespace } @@ -3788,30 +3773,11 @@ query consoleListConsoleVpnDevicesForUser { targetPort } } - status { - checks - isReady - lastReadyGeneration - lastReconcileTime - message { - RawMessage - } - resources { - apiVersion - kind - name - namespace - } - } - syncStatus { - action - error - lastSyncedAt - recordVersion - state - syncScheduledAt - } updateTime + wireguardConfig { + encoding + value + } } } diff --git a/src/apps/auth/server/gql/queries/infra-queries.ts b/src/apps/auth/server/gql/queries/infra-queries.ts index efb015342..7e77e903a 100644 --- a/src/apps/auth/server/gql/queries/infra-queries.ts +++ b/src/apps/auth/server/gql/queries/infra-queries.ts @@ -5,15 +5,10 @@ export const infraQueries = (executor: IExecutor) => ({ cli_CoreCheckNameAvailability: executor( gql` query Core_checkNameAvailability( - $projectName: String! $resType: ConsoleResType! $name: String! ) { - core_checkNameAvailability( - projectName: $projectName - resType: $resType - name: $name - ) { + core_checkNameAvailability(resType: $resType, name: $name) { result suggestedNames } diff --git a/src/apps/console/routes/_main+/$account+/_layout.tsx b/src/apps/console/routes/_main+/$account+/_layout.tsx index b905670f5..fdcc66b0c 100644 --- a/src/apps/console/routes/_main+/$account+/_layout.tsx +++ b/src/apps/console/routes/_main+/$account+/_layout.tsx @@ -26,7 +26,10 @@ import { } from '~/console/server/gql/queries/account-queries'; import { parseName, parseNodes } from '~/console/server/r-utils/common'; -import { ensureAccountClientSide } from '~/console/server/utils/auth-utils'; +import { + ensureAccountClientSide, + ensureAccountSet, +} from '~/console/server/utils/auth-utils'; import { GQLServerHandler } from '~/console/server/gql/saved-queries'; import MenuSelect from '~/console/components/menu-select'; import { BreadcrumButtonContent } from '~/console/utils/commons'; @@ -169,6 +172,7 @@ export const loader = async (ctx: IRemixCtx) => { let acccountData: IAccount; try { + ensureAccountSet(ctx); const { data, errors } = await GQLServerHandler(ctx.request).getAccount({ accountName: account, }); diff --git a/src/generated/gql/sdl.graphql b/src/generated/gql/sdl.graphql index 85e37a6d7..71b6645f5 100644 --- a/src/generated/gql/sdl.graphql +++ b/src/generated/gql/sdl.graphql @@ -392,7 +392,6 @@ type ConsoleVPNDevice { recordVersion: Int! spec: Github__com___kloudlite___operator___apis___wireguard___v1__DeviceSpec status: Github__com___kloudlite___operator___pkg___operator__Status - syncStatus: Github__com___kloudlite___api___pkg___types__SyncStatus! updateTime: Date! wireguardConfig: Github__com___kloudlite___api___pkg___types__EncodedString } diff --git a/src/generated/gql/server.ts b/src/generated/gql/server.ts index 96e537293..7ae07135e 100644 --- a/src/generated/gql/server.ts +++ b/src/generated/gql/server.ts @@ -4926,27 +4926,6 @@ export type ConsoleListConsoleVpnDevicesQuery = { cnameRecords?: Array<{ host?: string; target?: string }>; ports?: Array<{ port?: number; targetPort?: number }>; }; - status?: { - checks?: any; - isReady: boolean; - lastReadyGeneration?: number; - lastReconcileTime?: any; - message?: { RawMessage?: any }; - resources?: Array<{ - apiVersion: string; - kind: string; - name: string; - namespace: string; - }>; - }; - syncStatus: { - action: Github__Com___Kloudlite___Api___Pkg___Types__SyncAction; - error?: string; - lastSyncedAt?: any; - recordVersion: number; - state: Github__Com___Kloudlite___Api___Pkg___Types__SyncState; - syncScheduledAt?: any; - }; }; }>; pageInfo: { @@ -4986,16 +4965,28 @@ export type ConsoleListConsoleVpnDevicesForUserQueryVariables = Exact<{ export type ConsoleListConsoleVpnDevicesForUserQuery = { core_listVPNDevicesForUser?: Array<{ + accountName: string; + apiVersion: string; creationTime: any; displayName: string; environmentName?: string; + id: string; + kind: string; markedForDeletion?: boolean; projectName?: string; recordVersion: number; updateTime: any; createdBy: { userEmail: string; userId: string; userName: string }; lastUpdatedBy: { userEmail: string; userId: string; userName: string }; - metadata?: { generation: number; name: string; namespace?: string }; + metadata?: { + annotations?: any; + creationTimestamp: any; + deletionTimestamp?: any; + generation: number; + labels?: any; + name: string; + namespace?: string; + }; spec?: { deviceNamespace?: string; disabled?: boolean; @@ -5003,27 +4994,7 @@ export type ConsoleListConsoleVpnDevicesForUserQuery = { cnameRecords?: Array<{ host?: string; target?: string }>; ports?: Array<{ port?: number; targetPort?: number }>; }; - status?: { - checks?: any; - isReady: boolean; - lastReadyGeneration?: number; - lastReconcileTime?: any; - message?: { RawMessage?: any }; - resources?: Array<{ - apiVersion: string; - kind: string; - name: string; - namespace: string; - }>; - }; - syncStatus: { - action: Github__Com___Kloudlite___Api___Pkg___Types__SyncAction; - error?: string; - lastSyncedAt?: any; - recordVersion: number; - state: Github__Com___Kloudlite___Api___Pkg___Types__SyncState; - syncScheduledAt?: any; - }; + wireguardConfig?: { encoding: string; value: string }; }>; }; From ba092f260962f0fa299d9fc976eea7f8d6b3a74c Mon Sep 17 00:00:00 2001 From: Abdhesh Nayak Date: Sun, 14 Jan 2024 16:09:33 +0530 Subject: [PATCH 2/3] :art: Updated cli queries --- src/apps/auth/server/gql/cli-queries.ts | 49 +++++++++++-------- .../auth/server/gql/queries/infra-queries.ts | 40 ++++++++------- 2 files changed, 49 insertions(+), 40 deletions(-) diff --git a/src/apps/auth/server/gql/cli-queries.ts b/src/apps/auth/server/gql/cli-queries.ts index 014eb3ce0..f56cee3cb 100644 --- a/src/apps/auth/server/gql/cli-queries.ts +++ b/src/apps/auth/server/gql/cli-queries.ts @@ -540,33 +540,40 @@ export const cliQueries = (executor: IExecutor) => ({ ), cli_listDevices: executor( gql` - query Core_listVPNDevicesForUser { - core_listVPNDevicesForUser { - displayName - environmentName - markedForDeletion - metadata { - name - namespace - } - projectName - spec { - cnameRecords { - host - target - } - deviceNamespace - disabled - ports { - port - targetPort + query Infra_listVPNDevices($pq: CursorPaginationIn) { + infra_listVPNDevices(pq: $pq) { + edges { + node { + displayName + metadata { + name + } + spec { + deviceNamespace + disabled + nodeSelector + ports { + port + targetPort + } + } + status { + isReady + message { + RawMessage + } + } + wireguardConfig { + encoding + value + } } } } } `, { - transformer: (data: any) => data.core_listVPNDevicesForUser, + transformer: (data: any) => data.infra_listVPNDevices, vars: (_: any) => {}, } ), diff --git a/src/apps/auth/server/gql/queries/infra-queries.ts b/src/apps/auth/server/gql/queries/infra-queries.ts index 7e77e903a..565cd03d8 100644 --- a/src/apps/auth/server/gql/queries/infra-queries.ts +++ b/src/apps/auth/server/gql/queries/infra-queries.ts @@ -21,31 +21,33 @@ export const infraQueries = (executor: IExecutor) => ({ ), cli_listCoreDevices: executor( gql` - query Core_listVPNDevices($pq: CursorPaginationIn) { - core_listVPNDevices(pq: $pq) { - edges { - cursor - node { - displayName - environmentName - metadata { - name - } - projectName - spec { - disabled - ports { - port - targetPort - } - } + query Core_listVPNDevicesForUser { + core_listVPNDevicesForUser { + displayName + environmentName + markedForDeletion + metadata { + name + namespace + } + projectName + spec { + cnameRecords { + host + target + } + deviceNamespace + disabled + ports { + port + targetPort } } } } `, { - transformer: (data: any) => data.core_listVPNDevices, + transformer: (data: any) => data.core_listVPNDevicesForUser, vars: (_: any) => {}, } ), From 8de1ad26b8e04b8e252c65c4b81ddcc837464b6d Mon Sep 17 00:00:00 2001 From: Abdhesh Nayak Date: Sun, 14 Jan 2024 16:12:49 +0530 Subject: [PATCH 3/3] :art: Updated cli queries --- src/apps/auth/server/gql/queries/infra-queries.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/apps/auth/server/gql/queries/infra-queries.ts b/src/apps/auth/server/gql/queries/infra-queries.ts index 565cd03d8..9942877e1 100644 --- a/src/apps/auth/server/gql/queries/infra-queries.ts +++ b/src/apps/auth/server/gql/queries/infra-queries.ts @@ -25,12 +25,16 @@ export const infraQueries = (executor: IExecutor) => ({ core_listVPNDevicesForUser { displayName environmentName - markedForDeletion metadata { name - namespace } projectName + status { + isReady + message { + RawMessage + } + } spec { cnameRecords { host