diff --git a/Taskfile.yaml b/Taskfile.yaml index 0ae03f4d6..86c957591 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -76,9 +76,7 @@ tasks: - | pnpm gql:parse cd src/generated && pnpm tsgen - - # cd src/generated/plugin && pnpm build - # cd ../ && pnpm tsgen + cd ../.. && pnpm fake storybook: cmds: @@ -96,6 +94,7 @@ tasks: BASE_URL=kloudlite.io URL_SUFFIX="" COOKIE_DOMAIN=".kloudlite.io" + GATEWAY_URL="http://gateway.karthik-testing.svc.cluster.local" case {{.app}} in "auth") @@ -136,7 +135,7 @@ tasks: ;; esac - URL_SUFFIX=$URL_SUFFIX COOKIE_DOMAIN=$COOKIE_DOMAIN BASE_URL=$BASE_URL PORT=$PORT APP={{.app}} pnpm serve + GATEWAY_URL=$GATEWAY_URL URL_SUFFIX=$URL_SUFFIX COOKIE_DOMAIN=$COOKIE_DOMAIN BASE_URL=$BASE_URL PORT=$PORT APP={{.app}} pnpm serve build: preconditions: diff --git a/fake-data-generator/gen.ts b/fake-data-generator/gen.ts index b0629d3bb..71563a97f 100644 --- a/fake-data-generator/gen.ts +++ b/fake-data-generator/gen.ts @@ -82,8 +82,10 @@ global.location = new URL( fs.writeFileSync( './fake-data-generator/fake.js', - `const fake = ${JSON.stringify(data, null, 2)}; - export default fake; -` + `// Generated file, Generated for skeletons + +const fake = ${JSON.stringify(data, null, 2)}; + +export default fake;` ); })(); diff --git a/gql-queries-generator/doc/queries.graphql b/gql-queries-generator/doc/queries.graphql index 94690d833..eeb98ec69 100644 --- a/gql-queries-generator/doc/queries.graphql +++ b/gql-queries-generator/doc/queries.graphql @@ -1242,7 +1242,31 @@ query consoleListRouters($projectName: String!, $envName: String!, $search: Sear projectName recordVersion spec { + backendProtocol + basicAuth { + enabled + secretName + username + } + cors { + allowCredentials + enabled + origins + } domains + https { + clusterIssuer + enabled + forceRedirect + } + ingressClass + maxBodySizeInMB + rateLimit { + connections + enabled + rpm + rps + } routes { app lambda @@ -1368,6 +1392,14 @@ mutation consoleUpdateConfig($projectName: String!, $envName: String!, $config: } } +mutation consoleDeleteConfig($projectName: String!, $envName: String!, $configName: String!) { + core_deleteConfig( + projectName: $projectName + envName: $envName + configName: $configName + ) +} + query consoleGetConfig($projectName: String!, $envName: String!, $name: String!) { core_getConfig(projectName: $projectName, envName: $envName, name: $name) { binaryData @@ -2814,6 +2846,7 @@ query consoleListBuildRuns($repoName: String!, $search: SearchBuildRuns, $pq: Cu edges { cursor node { + id clusterName creationTime markedForDeletion @@ -3671,7 +3704,7 @@ query consoleListConsoleVpnDevices($search: CoreSearchVPNDevices, $pq: CursorPag host target } - deviceNamespace + activeNamespace disabled nodeSelector ports { @@ -3707,7 +3740,7 @@ query consoleGetConsoleVpnDevice($name: String!) { host target } - deviceNamespace + activeNamespace disabled nodeSelector ports { @@ -3758,7 +3791,7 @@ query consoleListConsoleVpnDevicesForUser { host target } - deviceNamespace + activeNamespace disabled nodeSelector ports { @@ -3778,13 +3811,85 @@ mutation consoleDeleteConsoleVpnDevice($deviceName: String!) { core_deleteVPNDevice(deviceName: $deviceName) } -query authCli_CoreCheckNameAvailability($resType: ConsoleResType!, $name: String!) { - core_checkNameAvailability(resType: $resType, name: $name) { - result - suggestedNames +mutation consoleCreateImagePullSecret($projectName: String!, $envName: String!, $imagePullSecretIn: ImagePullSecretIn!) { + core_createImagePullSecret( + projectName: $projectName + envName: $envName + imagePullSecretIn: $imagePullSecretIn + ) { + id } } +query consoleListImagePullSecrets($projectName: String!, $envName: String!, $search: SearchImagePullSecrets, $pq: CursorPaginationIn) { + core_listImagePullSecrets( + projectName: $projectName + envName: $envName + search: $search + pq: $pq + ) { + edges { + cursor + node { + createdBy { + userEmail + userId + userName + } + creationTime + displayName + dockerConfigJson + environmentName + format + lastUpdatedBy { + userEmail + userId + userName + } + markedForDeletion + metadata { + generation + name + namespace + } + projectName + recordVersion + registryPassword + registryURL + registryUsername + syncStatus { + action + error + lastSyncedAt + recordVersion + state + syncScheduledAt + } + updateTime + } + } + pageInfo { + endCursor + hasNextPage + hasPreviousPage + startCursor + } + totalCount + } +} + +mutation authCli_CoreUpdateDevicePorts($deviceName: String!, $ports: [PortIn!]!) { + core_updateVPNDevicePorts(deviceName: $deviceName, ports: $ports) +} + +mutation authCli_CoreUpdateDeviceEnv($deviceName: String!, $projectName: String!, $envName: String!) { + core_updateVPNDeviceEnv( + deviceName: $deviceName + projectName: $projectName + envName: $envName + ) +} + query authCli_listCoreDevices { core_listVPNDevicesForUser { displayName @@ -3804,7 +3909,7 @@ query authCli_listCoreDevices { host target } - deviceNamespace + activeNamespace disabled ports { port @@ -3822,7 +3927,7 @@ query authCli_getCoreDevice($name: String!) { } projectName spec { - deviceNamespace + activeNamespace disabled ports { port @@ -3838,7 +3943,13 @@ query authCli_getCoreDevice($name: String!) { mutation authCli_createCoreDevice($vpnDevice: ConsoleVPNDeviceIn!) { core_createVPNDevice(vpnDevice: $vpnDevice) { - id + metadata { + name + } + wireguardConfig { + encoding + value + } } } @@ -3846,6 +3957,127 @@ 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 + suggestedNames + } +} + query authCli_getMresKeys($projectName: String!, $envName: String!, $name: String!) { core_getManagedResouceOutputKeys( projectName: $projectName @@ -3891,15 +4123,7 @@ query authCli_infraCheckNameAvailability($resType: ResType!, $name: String!, $cl } } -mutation authCli_createDevice($clusterName: String!, $vpnDevice: VPNDeviceIn!) { - infra_createVPNDevice(clusterName: $clusterName, vpnDevice: $vpnDevice) { - metadata { - name - } - } -} - -query authCli_getConfigSecretMap($projectName: String!, $envName: String!, $configQueries: [ConfigKeyRefIn], $secretQueries: [SecretKeyRefIn!]) { +query authCli_getConfigSecretMap($projectName: String!, $envName: String!, $configQueries: [ConfigKeyRefIn], $secretQueries: [SecretKeyRefIn!], $mresQueries: [ManagedResourceKeyRefIn]) { configs: core_getConfigValues( projectName: $projectName envName: $envName @@ -3918,6 +4142,15 @@ query authCli_getConfigSecretMap($projectName: String!, $envName: String!, $conf secretName value } + mreses: core_getManagedResouceOutputKeyValues( + keyrefs: $mresQueries + envName: $envName + projectName: $projectName + ) { + key + mresName + value + } } mutation authCli_interceptApp($projectName: String!, $envName: String!, $appname: String!, $deviceName: String!, $intercept: Boolean!) { @@ -3938,22 +4171,6 @@ query authCli_getEnvironment($projectName: String!, $name: String!) { } } -mutation authCli_updateDeviceNs($clusterName: String!, $deviceName: String!, $namespace: String!) { - infra_updateVPNDeviceNs( - clusterName: $clusterName - deviceName: $deviceName - namespace: $namespace - ) -} - -mutation authCli_updateDevicePort($clusterName: String!, $deviceName: String!, $ports: [PortIn!]!) { - infra_updateVPNDevicePorts( - clusterName: $clusterName - deviceName: $deviceName - ports: $ports - ) -} - query authCli_getSecret($projectName: String!, $envName: String!, $name: String!) { core_getSecret(projectName: $projectName, envName: $envName, name: $name) { displayName @@ -4159,96 +4376,6 @@ query authCli_listSecrets($projectName: String!, $envName: String!, $pq: CursorP } } -mutation authCli_updateDevice($clusterName: String!, $vpnDevice: VPNDeviceIn!) { - infra_updateVPNDevice(clusterName: $clusterName, vpnDevice: $vpnDevice) { - metadata { - name - } - spec { - deviceNamespace - cnameRecords { - target - host - } - ports { - targetPort - port - } - } - status { - message { - RawMessage - } - isReady - } - } -} - -query authCli_listDevices($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 - } - } - } - } -} - -query authCli_getDevice($clusterName: String!, $name: String!) { - infra_getVPNDevice(clusterName: $clusterName, name: $name) { - displayName - markedForDeletion - metadata { - name - namespace - } - spec { - cnameRecords { - host - target - } - deviceNamespace - nodeSelector - ports { - port - targetPort - } - } - status { - isReady - message { - RawMessage - } - } - wireguardConfig { - encoding - value - } - } -} - query authCli_listEnvironments($projectName: String!, $pq: CursorPaginationIn) { core_listEnvironments(projectName: $projectName, pq: $pq) { edges { diff --git a/src/apps/auth/routes/_providers+/_layout.tsx b/src/apps/auth/routes/_providers+/_layout.tsx index bdcc19e49..18cd857b8 100644 --- a/src/apps/auth/routes/_providers+/_layout.tsx +++ b/src/apps/auth/routes/_providers+/_layout.tsx @@ -28,14 +28,6 @@ export const restActions = async (ctx: IRemixCtx) => { logger.error(checkError); } - if (checkData.find((v) => !v.enabled)) { - return { - githubLoginUrl: '', - gitlabLoginUrl: '', - googleLoginUrl: '', - }; - } - const { data, errors } = await GQLServerHandler( ctx.request ).loginPageInitUrls(); @@ -51,9 +43,15 @@ export const restActions = async (ctx: IRemixCtx) => { } = data || {}; return { - githubLoginUrl, - gitlabLoginUrl, - googleLoginUrl, + githubLoginUrl: checkData.find((v) => v.provider === 'github' && !v.enabled) + ? '' + : githubLoginUrl, + gitlabLoginUrl: checkData.find((v) => v.provider === 'gitlab' && !v.enabled) + ? '' + : gitlabLoginUrl, + googleLoginUrl: checkData.find((v) => v.provider === 'google' && !v.enabled) + ? '' + : googleLoginUrl, }; }; diff --git a/src/apps/auth/server/gql/cli-queries.ts b/src/apps/auth/server/gql/cli-queries.ts index f56cee3cb..a060711e6 100644 --- a/src/apps/auth/server/gql/cli-queries.ts +++ b/src/apps/auth/server/gql/cli-queries.ts @@ -2,8 +2,10 @@ 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_getMresKeys: executor( gql` @@ -101,27 +103,6 @@ export const cliQueries = (executor: IExecutor) => ({ 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) => {}, - } - ), cli_getConfigSecretMap: executor( gql` @@ -130,6 +111,7 @@ export const cliQueries = (executor: IExecutor) => ({ $envName: String! $configQueries: [ConfigKeyRefIn] $secretQueries: [SecretKeyRefIn!] + $mresQueries: [ManagedResourceKeyRefIn] ) { configs: core_getConfigValues( projectName: $projectName @@ -149,6 +131,15 @@ export const cliQueries = (executor: IExecutor) => ({ secretName value } + mreses: core_getManagedResouceOutputKeyValues( + keyrefs: $mresQueries + envName: $envName + projectName: $projectName + ) { + key + mresName + value + } } `, { @@ -156,9 +147,9 @@ export const cliQueries = (executor: IExecutor) => ({ return { configs: data.configs, secrets: data.secrets, + mreses: data.mreses, }; }, - vars: (_: any) => {}, } ), @@ -200,44 +191,6 @@ export const cliQueries = (executor: IExecutor) => ({ 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_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_getSecret: executor( gql` query Core_getSecret( @@ -503,121 +456,6 @@ export const cliQueries = (executor: IExecutor) => ({ vars: (_: any) => {}, } ), - cli_updateDevice: executor( - gql` - mutation Mutation($clusterName: String!, $vpnDevice: VPNDeviceIn!) { - infra_updateVPNDevice( - clusterName: $clusterName - vpnDevice: $vpnDevice - ) { - metadata { - name - } - spec { - deviceNamespace - cnameRecords { - target - host - } - ports { - targetPort - port - } - } - status { - message { - RawMessage - } - isReady - } - } - } - `, - { - transformer: (data: any) => data.infra_updateVPNDevice, - vars: (_: any) => {}, - } - ), - cli_listDevices: executor( - gql` - 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.infra_listVPNDevices, - 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 - } - deviceNamespace - nodeSelector - ports { - port - targetPort - } - } - status { - isReady - message { - RawMessage - } - } - wireguardConfig { - encoding - value - } - } - } - `, - { - transformer: (data: any) => data.infra_getVPNDevice, - vars: (_: any) => {}, - } - ), cli_listEnvironments: executor( gql` diff --git a/src/apps/auth/server/gql/queries/device-queries.ts b/src/apps/auth/server/gql/queries/device-queries.ts new file mode 100644 index 000000000..d7bca0a14 --- /dev/null +++ b/src/apps/auth/server/gql/queries/device-queries.ts @@ -0,0 +1,315 @@ +import gql from 'graphql-tag'; +import { IExecutor } from '~/root/lib/server/helpers/execute-query-with-context'; + +export const vpnQueries = (executor: IExecutor) => ({ + cli_CoreUpdateDevicePorts: executor( + gql` + mutation Core_updateVPNDevicePorts( + $deviceName: String! + $ports: [PortIn!]! + ) { + core_updateVPNDevicePorts(deviceName: $deviceName, ports: $ports) + } + `, + { + transformer: (data: any) => data.core_updateVPNDevicePorts, + vars: (_: any) => {}, + } + ), + cli_CoreUpdateDeviceEnv: executor( + gql` + mutation Core_updateVPNDeviceEnv( + $deviceName: String! + $projectName: String! + $envName: String! + ) { + core_updateVPNDeviceEnv( + deviceName: $deviceName + projectName: $projectName + envName: $envName + ) + } + `, + { + transformer: (data: any) => data.core_updateVPNDeviceEnv, + vars: (_: any) => {}, + } + ), + + cli_listCoreDevices: executor( + gql` + query Core_listVPNDevicesForUser { + core_listVPNDevicesForUser { + displayName + environmentName + metadata { + name + } + projectName + status { + isReady + message { + RawMessage + } + } + spec { + cnameRecords { + host + target + } + activeNamespace + disabled + ports { + port + targetPort + } + } + } + } + `, + { + transformer: (data: any) => data.core_listVPNDevicesForUser, + vars: (_: any) => {}, + } + ), + cli_getCoreDevice: executor( + gql` + query Core_getVPNDevice($name: String!) { + core_getVPNDevice(name: $name) { + displayName + metadata { + name + } + projectName + spec { + activeNamespace + disabled + ports { + port + targetPort + } + } + wireguardConfig { + encoding + value + } + } + } + `, + { + transformer: (data: any) => data.core_getVPNDevice, + vars: (_: any) => {}, + } + ), + cli_createCoreDevice: executor( + gql` + mutation Core_createVPNDevice($vpnDevice: ConsoleVPNDeviceIn!) { + core_createVPNDevice(vpnDevice: $vpnDevice) { + metadata { + name + } + wireguardConfig { + encoding + value + } + } + } + `, + { + transformer: (data: any) => data.core_createVPNDevice, + vars: (_: any) => {}, + } + ), + + cli_updateCoreDevicePorts: executor( + gql` + mutation Mutation($deviceName: String!, $ports: [PortIn!]!) { + core_updateVPNDevicePorts(deviceName: $deviceName, ports: $ports) + } + `, + { + transformer: (data: any) => data.core_updateVPNDevicePorts, + 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 index 9942877e1..a53ea1479 100644 --- a/src/apps/auth/server/gql/queries/infra-queries.ts +++ b/src/apps/auth/server/gql/queries/infra-queries.ts @@ -19,94 +19,4 @@ export const infraQueries = (executor: IExecutor) => ({ vars: (_: any) => {}, } ), - cli_listCoreDevices: executor( - gql` - query Core_listVPNDevicesForUser { - core_listVPNDevicesForUser { - displayName - environmentName - metadata { - name - } - projectName - status { - isReady - message { - RawMessage - } - } - spec { - cnameRecords { - host - target - } - deviceNamespace - disabled - ports { - port - targetPort - } - } - } - } - `, - { - transformer: (data: any) => data.core_listVPNDevicesForUser, - vars: (_: any) => {}, - } - ), - cli_getCoreDevice: executor( - gql` - query Core_getVPNDevice($name: String!) { - core_getVPNDevice(name: $name) { - displayName - metadata { - name - } - projectName - spec { - deviceNamespace - disabled - ports { - port - targetPort - } - } - wireguardConfig { - encoding - value - } - } - } - `, - { - transformer: (data: any) => data.core_getVPNDevice, - vars: (_: any) => {}, - } - ), - cli_createCoreDevice: executor( - gql` - mutation Core_createVPNDevice($vpnDevice: ConsoleVPNDeviceIn!) { - core_createVPNDevice(vpnDevice: $vpnDevice) { - id - } - } - `, - { - transformer: (data: any) => data.core_createVPNDevice, - vars: (_: any) => {}, - } - ), - - cli_updateCoreDevicePorts: executor( - gql` - mutation Mutation($deviceName: String!, $ports: [PortIn!]!) { - core_updateVPNDevicePorts(deviceName: $deviceName, ports: $ports) - } - `, - { - transformer: (data: any) => data.core_updateVPNDevicePorts, - vars: (_: any) => {}, - } - ), }); diff --git a/src/apps/console/components/color-generator.tsx b/src/apps/console/components/color-generator.tsx index 600457511..ed534eadf 100644 --- a/src/apps/console/components/color-generator.tsx +++ b/src/apps/console/components/color-generator.tsx @@ -69,4 +69,8 @@ const generateColor = (str = '#', contrast: Contrast = 'dark') => { )}, ${generateColorFromName(`${str + str + str}`, cc, contrast)})`; }; +export const generatePlainColor = (str = '#') => { + const cc = colorCode(str); + return generateColorFromName(str, cc, 'dark'); +}; export default generateColor; diff --git a/src/apps/console/components/console-list-components.tsx b/src/apps/console/components/console-list-components.tsx index 464f75cb7..7135a10d0 100644 --- a/src/apps/console/components/console-list-components.tsx +++ b/src/apps/console/components/console-list-components.tsx @@ -109,6 +109,7 @@ const ListTitle = ({ {title && (