Skip to content

Commit

Permalink
minor ui changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nxtcoder19 committed Jun 25, 2024
1 parent 3e571ef commit 3f43f46
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 72 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
BackingServices,
// BackingServices,
CirclesFour,
GearSix,
// Plus,
Expand Down Expand Up @@ -103,16 +103,16 @@ const tabs = [
to: '/cs/configs',
value: '/cs',
},
{
label: (
<span className="flex flex-row items-center gap-lg">
<BackingServices size={tabIconSize} />
Managed resources
</span>
),
to: '/managed-resources',
value: '/managed-resources',
},
// {
// label: (
// <span className="flex flex-row items-center gap-lg">
// <BackingServices size={tabIconSize} />
// Managed resources
// </span>
// ),
// to: '/managed-resources',
// value: '/managed-resources',
// },
// {
// label: 'Jobs & Crons',
// to: '/jc/task',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down
22 changes: 11 additions & 11 deletions src/apps/console/routes/_main+/_layout/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
InfraAsCode,
GearSix,
Project,
BackingServices,
// BackingServices,
BellFill,
Sliders,
} from '~/console/components/icons';
Expand Down Expand Up @@ -86,16 +86,16 @@ const AccountTabs = () => {
to: '/environments',
value: '/environments',
},
{
label: (
<span className="flex flex-row items-center gap-lg">
<BackingServices size={iconSize} />
Managed Services
</span>
),
to: '/managed-services',
value: '/managed-services',
},
// {
// label: (
// <span className="flex flex-row items-center gap-lg">
// <BackingServices size={iconSize} />
// Managed Services
// </span>
// ),
// to: '/managed-services',
// value: '/managed-services',
// },
{
label: (
<span className="flex flex-row items-center gap-lg">
Expand Down
56 changes: 14 additions & 42 deletions src/apps/console/server/gql/queries/config-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,50 +20,32 @@ export type IConfigs = NN<ConsoleListConfigsQuery['core_listConfigs']>;
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
Expand All @@ -83,7 +65,7 @@ export const configQueries = (executor: IExecutor) => ({
`,
{
transformer: (data: ConsoleGetConfigQuery) => data.core_getConfig,
vars(_: ConsoleGetConfigQueryVariables) { },
vars(_: ConsoleGetConfigQueryVariables) {},
}
),
listConfigs: executor(
Expand All @@ -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 {
Expand Down Expand Up @@ -141,27 +119,21 @@ 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
}
}
`,
{
transformer: (data: ConsoleCreateConfigMutation) =>
data.core_createConfig,
vars(_: ConsoleCreateConfigMutationVariables) { },
vars(_: ConsoleCreateConfigMutationVariables) {},
}
),
});
1 change: 1 addition & 0 deletions src/apps/console/server/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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_]+)*$/,
};
20 changes: 16 additions & 4 deletions src/generated/gql/sdl.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -2134,7 +2135,8 @@ input GlobalVPNIn {
allocatableCIDRSuffix: Int!
CIDR: String!
displayName: String!
kloudliteDevice: GlobalVPNKloudliteDeviceIn!
kloudliteClusterLocalDevice: GlobalVPNKloudliteClusterLocalDeviceIn!
kloudliteGatewayDevice: GlobalVPNKloudliteGatewayDeviceIn!
metadata: MetadataIn!
nonClusterUseAllowedIPs: [String!]!
numAllocatedClusterCIDRs: Int!
Expand All @@ -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!
}
Expand Down
10 changes: 8 additions & 2 deletions src/generated/gql/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Scalars['String']['input']>;
numAllocatedClusterCIDRs: Scalars['Int']['input'];
Expand All @@ -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'];
};
Expand Down

0 comments on commit 3f43f46

Please sign in to comment.