diff --git a/packages/nc-gui-v2/components/monaco/index.vue b/packages/nc-gui-v2/components/monaco/Editor.vue similarity index 100% rename from packages/nc-gui-v2/components/monaco/index.vue rename to packages/nc-gui-v2/components/monaco/Editor.vue diff --git a/packages/nc-gui-v2/lib/types.ts b/packages/nc-gui-v2/lib/types.ts index 1dee9b2827..d68e7b9c55 100644 --- a/packages/nc-gui-v2/lib/types.ts +++ b/packages/nc-gui-v2/lib/types.ts @@ -33,7 +33,13 @@ export type ReadonlyState = Readonly> & Omit -export type ClientType = 'mysql2' | 'mssql' | 'pg' | 'sqlite3' | 'vitess' +export enum ClientType { + MYSQL = 'mysql2', + MSSQL = 'mssql', + PG = 'pg', + SQLITE = 'sqlite3', + VITESS = 'vitess', +} export interface ProjectCreateForm { title: string @@ -59,8 +65,8 @@ export interface ProjectCreateForm { } } inflection: { - inflection_column?: string - inflection_table?: string + inflectionColumn?: string + inflectionTable?: string } sslUse?: any } diff --git a/packages/nc-gui-v2/pages/project/index/[id].vue b/packages/nc-gui-v2/pages/project/index/[id].vue index b3b68fbc60..96851d9da5 100644 --- a/packages/nc-gui-v2/pages/project/index/[id].vue +++ b/packages/nc-gui-v2/pages/project/index/[id].vue @@ -6,7 +6,7 @@ import { ref } from 'vue' import { useToast } from 'vue-toastification' import { navigateTo, useNuxtApp, useRoute } from '#app' import { extractSdkResponseErrorMsg } from '~/utils/errorUtils' -import { projectTitleValidator } from '~/utils/projectCreateUtils' +import { projectTitleValidator } from '~/utils/validation' import MaterialSymbolsRocketLaunchOutline from '~icons/material-symbols/rocket-launch-outline' const loading = ref(false) diff --git a/packages/nc-gui-v2/pages/project/index/create-external.vue b/packages/nc-gui-v2/pages/project/index/create-external.vue index b9dbfe2fc6..593b04ea70 100644 --- a/packages/nc-gui-v2/pages/project/index/create-external.vue +++ b/packages/nc-gui-v2/pages/project/index/create-external.vue @@ -1,22 +1,22 @@ diff --git a/packages/nc-gui-v2/utils/projectCreateUtils.ts b/packages/nc-gui-v2/utils/projectCreateUtils.ts index ceb4505ccb..cade101656 100644 --- a/packages/nc-gui-v2/utils/projectCreateUtils.ts +++ b/packages/nc-gui-v2/utils/projectCreateUtils.ts @@ -175,23 +175,6 @@ export const getDefaultConnectionConfig = (client: ClientType): ProjectCreateFor } } -export const projectTitleValidator = { - validator: (rule: any, value: any, callback: (errMsg?: string) => void) => { - if (value?.length > 50) { - callback('Project name exceeds 50 characters') - } - if (value[0] === ' ') { - callback('Project name cannot start with space') - } - - callback() - }, -} -export const fieldRequiredValidator = { - required: true, - message: 'Field is required', -} - export const sslUsage = ['No', 'Preferred', 'Required', 'Required-CA', 'Required-IDENTITY'] export const generateUniqueName = () => { diff --git a/packages/nc-gui-v2/utils/validation.ts b/packages/nc-gui-v2/utils/validation.ts index 52c6052cbb..7bd40613d2 100644 --- a/packages/nc-gui-v2/utils/validation.ts +++ b/packages/nc-gui-v2/utils/validation.ts @@ -65,3 +65,20 @@ export function validateColumnName(v: string, isGQL = false) { return true } } + +export const projectTitleValidator = { + validator: (rule: any, value: any, callback: (errMsg?: string) => void) => { + if (value?.length > 50) { + callback('Project name exceeds 50 characters') + } + if (value[0] === ' ') { + callback('Project name cannot start with space') + } + + callback() + }, +} +export const fieldRequiredValidator = { + required: true, + message: 'Field is required', +}