diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/_layout.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/_layout.tsx index a4e2a832c..2e94c38d7 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/_layout.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/_layout.tsx @@ -1,5 +1,5 @@ import { - BackingServices, + // BackingServices, CirclesFour, GearSix, // Plus, @@ -103,16 +103,16 @@ const tabs = [ to: '/cs/configs', value: '/cs', }, - { - label: ( - - - Managed resources - - ), - to: '/managed-resources', - value: '/managed-resources', - }, + // { + // label: ( + // + // + // Managed resources + // + // ), + // to: '/managed-resources', + // value: '/managed-resources', + // }, // { // label: 'Jobs & Crons', // to: '/jc/task', diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/config.$config/handle.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/config.$config/handle.tsx index 441a698d1..735a0b022 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/config.$config/handle.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/config.$config/handle.tsx @@ -4,6 +4,7 @@ import Popup from '~/components/molecule/popup'; import { IDialog, IModifiedItem } from '~/console/components/types.d'; import { ConsoleApiType } from '~/console/server/gql/saved-queries'; import { parseName } from '~/console/server/r-utils/common'; +import { constants } from '~/console/server/utils/constants'; import useForm from '~/lib/client/hooks/use-form'; import Yup from '~/lib/server/helpers/yup'; import { handleError } from '~/lib/utils/common'; @@ -75,6 +76,7 @@ const Handle = ({ validationSchema: Yup.object({ key: Yup.string() .required() + .matches(constants.keyFormatRegex, 'Invalid key format') .test('is-valid', 'Key already exists.', (value) => { if (isUpdate) { return true; diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/cs+/configs._index/handle-config.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/cs+/configs._index/handle-config.tsx index a4512e4ad..e973eabdc 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/cs+/configs._index/handle-config.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/cs+/configs._index/handle-config.tsx @@ -25,13 +25,13 @@ const HandleConfig = ({ show, setShow }: IDialog) => { name: Yup.string().required(), }), onSubmit: async (val) => { - if ( !environment) { + if (!environment) { throw new Error('Project and Environment is required!.'); } try { const { errors: e } = await api.createConfig({ envName: environment, - + config: { metadata: { name: val.name, diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/secret.$secret/handle.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/secret.$secret/handle.tsx index fcbacb710..c18f649ce 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/secret.$secret/handle.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/secret.$secret/handle.tsx @@ -4,6 +4,7 @@ import Popup from '~/components/molecule/popup'; import { IDialog, IModifiedItem } from '~/console/components/types.d'; import { ConsoleApiType } from '~/console/server/gql/saved-queries'; import { parseName } from '~/console/server/r-utils/common'; +import { constants } from '~/console/server/utils/constants'; import useForm from '~/lib/client/hooks/use-form'; import Yup from '~/lib/server/helpers/yup'; import { handleError } from '~/lib/utils/common'; @@ -72,6 +73,7 @@ const Handle = ({ validationSchema: Yup.object({ key: Yup.string() .required() + .matches(constants.keyFormatRegex, 'Invalid key format') .test('is-valid', 'Key already exists.', (value) => { if (isUpdate) { return true; diff --git a/src/apps/console/routes/_main+/_layout/_layout.tsx b/src/apps/console/routes/_main+/_layout/_layout.tsx index 2f70a78cc..32bce5690 100644 --- a/src/apps/console/routes/_main+/_layout/_layout.tsx +++ b/src/apps/console/routes/_main+/_layout/_layout.tsx @@ -36,7 +36,7 @@ import { InfraAsCode, GearSix, Project, - BackingServices, + // BackingServices, BellFill, Sliders, } from '~/console/components/icons'; @@ -86,16 +86,16 @@ const AccountTabs = () => { to: '/environments', value: '/environments', }, - { - label: ( - - - Managed Services - - ), - to: '/managed-services', - value: '/managed-services', - }, + // { + // label: ( + // + // + // Managed Services + // + // ), + // to: '/managed-services', + // value: '/managed-services', + // }, { label: ( diff --git a/src/apps/console/server/gql/queries/config-queries.ts b/src/apps/console/server/gql/queries/config-queries.ts index 6e645e532..c130b1bf7 100644 --- a/src/apps/console/server/gql/queries/config-queries.ts +++ b/src/apps/console/server/gql/queries/config-queries.ts @@ -20,50 +20,32 @@ export type IConfigs = NN; export const configQueries = (executor: IExecutor) => ({ updateConfig: executor( gql` - mutation Core_updateConfig( - $envName: String! - $config: ConfigIn! - ) { - core_updateConfig( - envName: $envName - config: $config - ) { + mutation Core_updateConfig($envName: String!, $config: ConfigIn!) { + core_updateConfig(envName: $envName, config: $config) { id } } `, { transformer: (data: ConsoleUpdateConfigMutation) => data, - vars(_: ConsoleUpdateConfigMutationVariables) { }, + vars(_: ConsoleUpdateConfigMutationVariables) {}, } ), deleteConfig: executor( gql` - mutation Core_deleteConfig( - $envName: String! - $configName: String! - ) { - core_deleteConfig( - envName: $envName - configName: $configName - ) + mutation Core_deleteConfig($envName: String!, $configName: String!) { + core_deleteConfig(envName: $envName, configName: $configName) } `, { transformer: (data: ConsoleDeleteConfigMutation) => data, - vars(_: ConsoleDeleteConfigMutationVariables) { }, + vars(_: ConsoleDeleteConfigMutationVariables) {}, } ), getConfig: executor( gql` - query Core_getConfig( - $envName: String! - $name: String! - ) { - core_getConfig( - envName: $envName - name: $name - ) { + query Core_getConfig($envName: String!, $name: String!) { + core_getConfig(envName: $envName, name: $name) { binaryData data displayName @@ -83,7 +65,7 @@ export const configQueries = (executor: IExecutor) => ({ `, { transformer: (data: ConsoleGetConfigQuery) => data.core_getConfig, - vars(_: ConsoleGetConfigQueryVariables) { }, + vars(_: ConsoleGetConfigQueryVariables) {}, } ), listConfigs: executor( @@ -93,11 +75,7 @@ export const configQueries = (executor: IExecutor) => ({ $search: SearchConfigs $pq: CursorPaginationIn ) { - core_listConfigs( - envName: $envName - search: $search - pq: $pq - ) { + core_listConfigs(envName: $envName, search: $search, pq: $pq) { edges { cursor node { @@ -141,19 +119,13 @@ export const configQueries = (executor: IExecutor) => ({ `, { transformer: (data: ConsoleListConfigsQuery) => data.core_listConfigs, - vars(_: ConsoleListConfigsQueryVariables) { }, + vars(_: ConsoleListConfigsQueryVariables) {}, } ), createConfig: executor( gql` - mutation Core_createConfig( - $envName: String! - $config: ConfigIn! - ) { - core_createConfig( - envName: $envName - config: $config - ) { + mutation Core_createConfig($envName: String!, $config: ConfigIn!) { + core_createConfig(envName: $envName, config: $config) { id } } @@ -161,7 +133,7 @@ export const configQueries = (executor: IExecutor) => ({ { transformer: (data: ConsoleCreateConfigMutation) => data.core_createConfig, - vars(_: ConsoleCreateConfigMutationVariables) { }, + vars(_: ConsoleCreateConfigMutationVariables) {}, } ), }); diff --git a/src/apps/console/server/utils/constants.ts b/src/apps/console/server/utils/constants.ts index 0c7b19033..1a2bd8b69 100644 --- a/src/apps/console/server/utils/constants.ts +++ b/src/apps/console/server/utils/constants.ts @@ -10,4 +10,5 @@ export const constants = { metadot: 'ยท', dockerImageFormatRegex: /^(([a-zA-Z0-9]+(-[a-zA-Z0-9]+)*\.)+[a-zA-Z]{2,}(:[0-9]+)?\/)?([a-z0-9]+(-[a-z0-9]+)*\/)*[a-z0-9]+([._-][a-z0-9]+)*(:[a-zA-Z0-9_][a-zA-Z0-9._-]{0,127}[a-zA-Z0-9])?(@[A-Za-z][A-Za-z0-9]*(?:[._-][A-Za-z0-9]+)?:[A-Fa-f0-9]{32,})?$/, + keyFormatRegex: /^[A-Za-z0-9_]+([./-][A-Za-z0-9_]+)*$/, }; diff --git a/src/generated/gql/sdl.graphql b/src/generated/gql/sdl.graphql index 2939e4473..0f1d6e720 100644 --- a/src/generated/gql/sdl.graphql +++ b/src/generated/gql/sdl.graphql @@ -2074,7 +2074,8 @@ type GlobalVPN { creationTime: Date! displayName: String! id: ID! - kloudliteDevice: GlobalVPNKloudliteDevice! + kloudliteClusterLocalDevice: GlobalVPNKloudliteClusterLocalDevice! + kloudliteGatewayDevice: GlobalVPNKloudliteGatewayDevice! lastUpdatedBy: Github__com___kloudlite___api___common__CreatedOrUpdatedBy! markedForDeletion: Boolean metadata: Metadata! @@ -2134,7 +2135,8 @@ input GlobalVPNIn { allocatableCIDRSuffix: Int! CIDR: String! displayName: String! - kloudliteDevice: GlobalVPNKloudliteDeviceIn! + kloudliteClusterLocalDevice: GlobalVPNKloudliteClusterLocalDeviceIn! + kloudliteGatewayDevice: GlobalVPNKloudliteGatewayDeviceIn! metadata: MetadataIn! nonClusterUseAllowedIPs: [String!]! numAllocatedClusterCIDRs: Int! @@ -2143,12 +2145,22 @@ input GlobalVPNIn { wgInterface: String! } -type GlobalVPNKloudliteDevice { +type GlobalVPNKloudliteClusterLocalDevice { ipAddr: String! name: String! } -input GlobalVPNKloudliteDeviceIn { +input GlobalVPNKloudliteClusterLocalDeviceIn { + ipAddr: String! + name: String! +} + +type GlobalVPNKloudliteGatewayDevice { + ipAddr: String! + name: String! +} + +input GlobalVPNKloudliteGatewayDeviceIn { ipAddr: String! name: String! } diff --git a/src/generated/gql/server.ts b/src/generated/gql/server.ts index a16dee36c..c24fbe013 100644 --- a/src/generated/gql/server.ts +++ b/src/generated/gql/server.ts @@ -1048,7 +1048,8 @@ export type GlobalVpnIn = { allocatableCIDRSuffix: Scalars['Int']['input']; CIDR: Scalars['String']['input']; displayName: Scalars['String']['input']; - kloudliteDevice: GlobalVpnKloudliteDeviceIn; + kloudliteClusterLocalDevice: GlobalVpnKloudliteClusterLocalDeviceIn; + kloudliteGatewayDevice: GlobalVpnKloudliteGatewayDeviceIn; metadata: MetadataIn; nonClusterUseAllowedIPs: Array; numAllocatedClusterCIDRs: Scalars['Int']['input']; @@ -1057,7 +1058,12 @@ export type GlobalVpnIn = { wgInterface: Scalars['String']['input']; }; -export type GlobalVpnKloudliteDeviceIn = { +export type GlobalVpnKloudliteClusterLocalDeviceIn = { + ipAddr: Scalars['String']['input']; + name: Scalars['String']['input']; +}; + +export type GlobalVpnKloudliteGatewayDeviceIn = { ipAddr: Scalars['String']['input']; name: Scalars['String']['input']; };