diff --git a/gql-queries-generator/doc/queries.graphql b/gql-queries-generator/doc/queries.graphql index eeb98ec69..a5e66599b 100644 --- a/gql-queries-generator/doc/queries.graphql +++ b/gql-queries-generator/doc/queries.graphql @@ -3878,6 +3878,14 @@ query consoleListImagePullSecrets($projectName: String!, $envName: String!, $sea } } +mutation authCli_updateDeviceCluster($deviceName: String!, $clusterName: String!) { + core_updateVpnClusterName(deviceName: $deviceName, clusterName: $clusterName) +} + +mutation authCli_UpdateDeviceNs($deviceName: String!, $ns: String!) { + core_updateVpnDeviceNs(deviceName: $deviceName, ns: $ns) +} + mutation authCli_CoreUpdateDevicePorts($deviceName: String!, $ports: [PortIn!]!) { core_updateVPNDevicePorts(deviceName: $deviceName, ports: $ports) } @@ -3957,120 +3965,6 @@ mutation authCli_updateCoreDevicePorts($deviceName: String!, $ports: [PortIn!]!) core_updateVPNDevicePorts(deviceName: $deviceName, ports: $ports) } -query authCli_getDevice($clusterName: String!, $name: String!) { - infra_getVPNDevice(clusterName: $clusterName, name: $name) { - displayName - markedForDeletion - metadata { - name - namespace - } - spec { - cnameRecords { - host - target - } - activeNamespace - nodeSelector - ports { - port - targetPort - } - } - status { - isReady - message { - RawMessage - } - } - wireguardConfig { - encoding - value - } - } -} - -query authCli_listDevices($pq: CursorPaginationIn, $clusterName: String) { - infra_listVPNDevices(clusterName: $clusterName, pq: $pq) { - edges { - node { - displayName - metadata { - name - } - spec { - activeNamespace - disabled - nodeSelector - ports { - port - targetPort - } - } - status { - isReady - message { - RawMessage - } - } - wireguardConfig { - encoding - value - } - } - } - } -} - -mutation authCli_updateDevice($clusterName: String!, $vpnDevice: VPNDeviceIn!) { - infra_updateVPNDevice(clusterName: $clusterName, vpnDevice: $vpnDevice) { - metadata { - name - } - spec { - activeNamespace - cnameRecords { - target - host - } - ports { - targetPort - port - } - } - status { - message { - RawMessage - } - isReady - } - } -} - -mutation authCli_updateDevicePort($clusterName: String!, $deviceName: String!, $ports: [PortIn!]!) { - infra_updateVPNDevicePorts( - clusterName: $clusterName - deviceName: $deviceName - ports: $ports - ) -} - -mutation authCli_updateDeviceNs($clusterName: String!, $deviceName: String!, $namespace: String!) { - infra_updateVPNDeviceNs( - clusterName: $clusterName - deviceName: $deviceName - namespace: $namespace - ) -} - -mutation authCli_createDevice($clusterName: String!, $vpnDevice: VPNDeviceIn!) { - infra_createVPNDevice(clusterName: $clusterName, vpnDevice: $vpnDevice) { - metadata { - name - } - } -} - query authCli_CoreCheckNameAvailability($resType: ConsoleResType!, $name: String!) { core_checkNameAvailability(resType: $resType, name: $name) { result diff --git a/src/apps/auth/server/gql/cli-queries.ts b/src/apps/auth/server/gql/cli-queries.ts index a060711e6..7479f72bd 100644 --- a/src/apps/auth/server/gql/cli-queries.ts +++ b/src/apps/auth/server/gql/cli-queries.ts @@ -1,12 +1,29 @@ /* eslint-disable camelcase */ import gql from 'graphql-tag'; import { IExecutor } from '~/root/lib/server/helpers/execute-query-with-context'; -import { infraQueries } from './queries/infra-queries'; import { vpnQueries } from './queries/device-queries'; export const cliQueries = (executor: IExecutor) => ({ ...vpnQueries(executor), - ...infraQueries(executor), + + cli_coreCheckNameAvailability: executor( + gql` + query Core_checkNameAvailability( + $resType: ConsoleResType! + $name: String! + ) { + core_checkNameAvailability(resType: $resType, name: $name) { + result + suggestedNames + } + } + `, + { + transformer: (data: any) => data.core_checkNameAvailability, + vars: (_: any) => {}, + } + ), + cli_getMresKeys: executor( gql` query Core_getManagedResouceOutputKeyValues( @@ -251,35 +268,17 @@ export const cliQueries = (executor: IExecutor) => ({ edges { cursor node { - createdBy { - userEmail - userId - userName - } - creationTime displayName - enabled environmentName - kind - lastUpdatedBy { - userEmail - userId - userName - } markedForDeletion metadata { annotations - creationTimestamp - deletionTimestamp - generation - labels name namespace } projectName spec { displayName - freeze containers { args command @@ -296,62 +295,13 @@ export const cliQueries = (executor: IExecutor) => ({ type } image - imagePullPolicy - livenessProbe { - failureThreshold - httpGet { - httpHeaders - path - port - } - initialDelay - interval - shell { - command - } - tcp { - port - } - type - } name - readinessProbe { - failureThreshold - initialDelay - interval - type - } - resourceCpu { - max - min - } - resourceMemory { - max - min - } - volumes { - items { - fileName - key - } - mountPath - refName - type - } - } - hpa { - enabled - maxReplicas - minReplicas - thresholdCpu - thresholdMemory } intercept { enabled toDevice } nodeSelector - region replicas serviceAccount services { @@ -360,39 +310,16 @@ export const cliQueries = (executor: IExecutor) => ({ targetPort type } - tolerations { - effect - key - operator - tolerationSeconds - value - } } status { checks isReady - lastReadyGeneration - lastReconcileTime message { RawMessage } - resources { - apiVersion - kind - name - namespace - } } - updateTime } } - pageInfo { - endCursor - hasNextPage - hasPreviousPage - startCursor - } - totalCount } } `, diff --git a/src/apps/auth/server/gql/queries/device-queries.ts b/src/apps/auth/server/gql/queries/device-queries.ts index d7bca0a14..0e21a7fb1 100644 --- a/src/apps/auth/server/gql/queries/device-queries.ts +++ b/src/apps/auth/server/gql/queries/device-queries.ts @@ -2,7 +2,35 @@ import gql from 'graphql-tag'; import { IExecutor } from '~/root/lib/server/helpers/execute-query-with-context'; export const vpnQueries = (executor: IExecutor) => ({ - cli_CoreUpdateDevicePorts: executor( + cli_updateDeviceCluster: executor( + gql` + mutation Core_updateVpnClusterName( + $deviceName: String! + $clusterName: String! + ) { + core_updateVpnClusterName( + deviceName: $deviceName + clusterName: $clusterName + ) + } + `, + { + transformer: (data: any) => data.core_updateVpnClusterName, + vars: (_: any) => {}, + } + ), + cli_updateDeviceNs: executor( + gql` + mutation Core_updateVpnDeviceNs($deviceName: String!, $ns: String!) { + core_updateVpnDeviceNs(deviceName: $deviceName, ns: $ns) + } + `, + { + transformer: (data: any) => data.core_updateVpnDeviceNs, + vars: (_: any) => {}, + } + ), + cli_coreUpdateDevicePorts: executor( gql` mutation Core_updateVPNDevicePorts( $deviceName: String! @@ -16,7 +44,7 @@ export const vpnQueries = (executor: IExecutor) => ({ vars: (_: any) => {}, } ), - cli_CoreUpdateDeviceEnv: executor( + cli_coreUpdateDeviceEnv: executor( gql` mutation Core_updateVPNDeviceEnv( $deviceName: String! @@ -46,6 +74,7 @@ export const vpnQueries = (executor: IExecutor) => ({ name } projectName + clusterName status { isReady message { @@ -80,6 +109,7 @@ export const vpnQueries = (executor: IExecutor) => ({ metadata { name } + clusterName projectName spec { activeNamespace @@ -132,184 +162,4 @@ export const vpnQueries = (executor: IExecutor) => ({ vars: (_: any) => {}, } ), - - cli_getDevice: executor( - gql` - query Infra_getVPNDevice($clusterName: String!, $name: String!) { - infra_getVPNDevice(clusterName: $clusterName, name: $name) { - displayName - markedForDeletion - metadata { - name - namespace - } - spec { - cnameRecords { - host - target - } - activeNamespace - nodeSelector - ports { - port - targetPort - } - } - status { - isReady - message { - RawMessage - } - } - wireguardConfig { - encoding - value - } - } - } - `, - { - transformer: (data: any) => data.infra_getVPNDevice, - vars: (_: any) => {}, - } - ), - - cli_listDevices: executor( - gql` - query Infra_listVPNDevices( - $pq: CursorPaginationIn - $clusterName: String - ) { - infra_listVPNDevices(clusterName: $clusterName, pq: $pq) { - edges { - node { - displayName - metadata { - name - } - spec { - activeNamespace - disabled - nodeSelector - ports { - port - targetPort - } - } - status { - isReady - message { - RawMessage - } - } - wireguardConfig { - encoding - value - } - } - } - } - } - `, - { - transformer: (data: any) => data.infra_listVPNDevices, - vars: (_: any) => {}, - } - ), - - cli_updateDevice: executor( - gql` - mutation Mutation($clusterName: String!, $vpnDevice: VPNDeviceIn!) { - infra_updateVPNDevice( - clusterName: $clusterName - vpnDevice: $vpnDevice - ) { - metadata { - name - } - spec { - activeNamespace - cnameRecords { - target - host - } - ports { - targetPort - port - } - } - status { - message { - RawMessage - } - isReady - } - } - } - `, - { - transformer: (data: any) => data.infra_updateVPNDevice, - vars: (_: any) => {}, - } - ), - - cli_updateDevicePort: executor( - gql` - mutation Mutation( - $clusterName: String! - $deviceName: String! - $ports: [PortIn!]! - ) { - infra_updateVPNDevicePorts( - clusterName: $clusterName - deviceName: $deviceName - ports: $ports - ) - } - `, - { - transformer: (data: any) => data.infra_updateVPNDevicePorts, - vars: (_: any) => {}, - } - ), - cli_updateDeviceNs: executor( - gql` - mutation Infra_updateVPNDeviceNs( - $clusterName: String! - $deviceName: String! - $namespace: String! - ) { - infra_updateVPNDeviceNs( - clusterName: $clusterName - deviceName: $deviceName - namespace: $namespace - ) - } - `, - { - transformer: (data: any) => data.infra_updateVPNDeviceNs, - vars: (_: any) => {}, - } - ), - cli_createDevice: executor( - gql` - mutation Infra_createVPNDevice( - $clusterName: String! - $vpnDevice: VPNDeviceIn! - ) { - infra_createVPNDevice( - clusterName: $clusterName - vpnDevice: $vpnDevice - ) { - metadata { - name - } - } - } - `, - { - transformer: (data: any) => data.infra_createVPNDevice, - vars: (_: any) => {}, - } - ), }); diff --git a/src/apps/auth/server/gql/queries/infra-queries.ts b/src/apps/auth/server/gql/queries/infra-queries.ts deleted file mode 100644 index a53ea1479..000000000 --- a/src/apps/auth/server/gql/queries/infra-queries.ts +++ /dev/null @@ -1,22 +0,0 @@ -import gql from 'graphql-tag'; -import { IExecutor } from '~/root/lib/server/helpers/execute-query-with-context'; - -export const infraQueries = (executor: IExecutor) => ({ - cli_CoreCheckNameAvailability: executor( - gql` - query Core_checkNameAvailability( - $resType: ConsoleResType! - $name: String! - ) { - core_checkNameAvailability(resType: $resType, name: $name) { - result - suggestedNames - } - } - `, - { - transformer: (data: any) => data.core_checkNameAvailability, - vars: (_: any) => {}, - } - ), -}); diff --git a/src/apps/console/components/logger.tsx b/src/apps/console/components/logger.tsx index b0756937e..f62a8cf0f 100644 --- a/src/apps/console/components/logger.tsx +++ b/src/apps/console/components/logger.tsx @@ -14,7 +14,6 @@ import { useSearch, } from '~/root/lib/client/helpers/search-filter'; import useClass from '~/root/lib/client/hooks/use-class'; -import logger from '~/root/lib/client/helpers/log'; import { socketUrl } from '~/root/lib/configs/base-url.cjs'; import { generatePlainColor } from './color-generator'; import Pulsable from './pulsable'; @@ -403,13 +402,19 @@ const LogBlock = ({ ); const [showAll, setShowAll] = useState(true); + const ref = useRef(null); + // const listRef = useRef(null); useEffect(() => { + console.log('data', ref.current); + (async () => { if (follow && ref.current) { // @ts-ignore - ref.current.scrollTo(0, ref.current.scrollHeight); + ref.current.scrollToIndex({ + index: data.length - 1, + }); } })(); }, [data, maxLines]); @@ -470,11 +475,15 @@ const LogBlock = ({ >