Browse Source

fix(gui-v2): fix project schema for pg and mssql

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/2970/head
mertmit 2 years ago
parent
commit
86bfebffd6
  1. 8
      packages/nc-gui-v2/pages/project/index/create-external.vue
  2. 9
      packages/nc-gui-v2/utils/projectCreateUtils.ts

8
packages/nc-gui-v2/pages/project/index/create-external.vue

@ -59,7 +59,7 @@ const validators = computed(() => {
'dataSource.connection.database': [fieldRequiredValidator],
...([ClientType.PG, ClientType.MSSQL].includes(formState.dataSource.client)
? {
'dataSource.connection.searchPath.0': [fieldRequiredValidator],
'dataSource.searchPath.0': [fieldRequiredValidator],
}
: {}),
}),
@ -288,11 +288,11 @@ onMounted(() => {
</a-form-item>
<!-- Schema name -->
<a-form-item
v-if="[ClientType.MSSQL, ClientType.PG].includes(formState.dataSource.client)"
v-if="[ClientType.MSSQL, ClientType.PG].includes(formState.dataSource.client) && formState.dataSource.searchPath"
:label="$t('labels.schemaName')"
v-bind="validateInfos['dataSource.connection.searchPath.0']"
v-bind="validateInfos['dataSource.searchPath.0']"
>
<a-input v-model:value="formState.dataSource.connection.searchPath[0]" size="small" />
<a-input v-model:value="formState.dataSource.searchPath[0]" size="small" />
</a-form-item>
<a-collapse ghost expand-icon-position="right" class="mt-6">

9
packages/nc-gui-v2/utils/projectCreateUtils.ts

@ -12,7 +12,6 @@ export interface ProjectCreateForm {
password: string
port: number | string
ssl?: Record<string, string>
searchPath?: string[]
}
| {
client?: ClientType.SQLITE
@ -22,6 +21,7 @@ export interface ProjectCreateForm {
}
useNullAsDefault?: boolean
}
searchPath?: string[]
}
inflection: {
inflectionColumn?: string
@ -73,7 +73,6 @@ const sampleConnectionData: Record<ClientType | string, ProjectCreateForm['dataS
user: 'postgres',
password: 'password',
database: '_test',
searchPath: ['public'],
ssl: {
ca: '',
key: '',
@ -110,7 +109,6 @@ const sampleConnectionData: Record<ClientType | string, ProjectCreateForm['dataS
user: 'sa',
password: 'Password123.',
database: '_test',
searchPath: ['dbo'],
ssl: {
ca: '',
key: '',
@ -203,6 +201,11 @@ export const getDefaultConnectionConfig = (client: ClientType): ProjectCreateFor
return {
client,
connection: sampleConnectionData[client],
searchPath: [ClientType.PG, ClientType.MSSQL].includes(client)
? client === ClientType.PG
? ['public']
: ['dbo']
: undefined,
}
}

Loading…
Cancel
Save