Browse Source

fix: field validation for sf

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/4645/head
mertmit 2 years ago
parent
commit
f82831eee3
  1. 17
      packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue
  2. 17
      packages/nc-gui/components/dashboard/settings/data-sources/EditBase.vue
  3. 17
      packages/nc-gui/pages/index/index/create-external.vue

17
packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue

@ -84,7 +84,14 @@ const validators = computed(() => {
'dataSource.connection.connection.filename': [fieldRequiredValidator()], 'dataSource.connection.connection.filename': [fieldRequiredValidator()],
} }
: formState.dataSource.client === ClientType.SNOWFLAKE : formState.dataSource.client === ClientType.SNOWFLAKE
? {} ? {
'dataSource.connection.account': [fieldRequiredValidator()],
'dataSource.connection.user': [fieldRequiredValidator()],
'dataSource.connection.password': [fieldRequiredValidator()],
'dataSource.connection.warehouse': [fieldRequiredValidator()],
'dataSource.connection.database': [fieldRequiredValidator()],
'dataSource.connection.schema': [fieldRequiredValidator()],
}
: { : {
'dataSource.connection.host': [fieldRequiredValidator()], 'dataSource.connection.host': [fieldRequiredValidator()],
'dataSource.connection.port': [fieldRequiredValidator()], 'dataSource.connection.port': [fieldRequiredValidator()],
@ -387,7 +394,7 @@ watch(
<template v-else-if="formState.dataSource.client === ClientType.SNOWFLAKE"> <template v-else-if="formState.dataSource.client === ClientType.SNOWFLAKE">
<!-- Account --> <!-- Account -->
<a-form-item label="Account"> <a-form-item label="Account" v-bind="validateInfos['dataSource.connection.account']">
<a-input v-model:value="formState.dataSource.connection.account" class="nc-extdb-account" /> <a-input v-model:value="formState.dataSource.connection.account" class="nc-extdb-account" />
</a-form-item> </a-form-item>
@ -397,12 +404,12 @@ watch(
</a-form-item> </a-form-item>
<!-- Password --> <!-- Password -->
<a-form-item :label="$t('labels.password')"> <a-form-item :label="$t('labels.password')" v-bind="validateInfos['dataSource.connection.password']">
<a-input-password v-model:value="formState.dataSource.connection.password" class="nc-extdb-host-password" /> <a-input-password v-model:value="formState.dataSource.connection.password" class="nc-extdb-host-password" />
</a-form-item> </a-form-item>
<!-- Warehouse --> <!-- Warehouse -->
<a-form-item label="Warehouse"> <a-form-item label="Warehouse" v-bind="validateInfos['dataSource.connection.warehouse']">
<a-input v-model:value="formState.dataSource.connection.warehouse" /> <a-input v-model:value="formState.dataSource.connection.warehouse" />
</a-form-item> </a-form-item>
@ -417,7 +424,7 @@ watch(
</a-form-item> </a-form-item>
<!-- Schema name --> <!-- Schema name -->
<a-form-item :label="$t('labels.schemaName')"> <a-form-item :label="$t('labels.schemaName')" v-bind="validateInfos['dataSource.connection.schema']">
<a-input v-model:value="formState.dataSource.connection.schema" /> <a-input v-model:value="formState.dataSource.connection.schema" />
</a-form-item> </a-form-item>
</template> </template>

17
packages/nc-gui/components/dashboard/settings/data-sources/EditBase.vue

@ -85,7 +85,14 @@ const validators = computed(() => {
'dataSource.connection.connection.filename': [fieldRequiredValidator()], 'dataSource.connection.connection.filename': [fieldRequiredValidator()],
} }
: formState.value.dataSource.client === ClientType.SNOWFLAKE : formState.value.dataSource.client === ClientType.SNOWFLAKE
? {} ? {
'dataSource.connection.account': [fieldRequiredValidator()],
'dataSource.connection.user': [fieldRequiredValidator()],
'dataSource.connection.password': [fieldRequiredValidator()],
'dataSource.connection.warehouse': [fieldRequiredValidator()],
'dataSource.connection.database': [fieldRequiredValidator()],
'dataSource.connection.schema': [fieldRequiredValidator()],
}
: { : {
'dataSource.connection.host': [fieldRequiredValidator()], 'dataSource.connection.host': [fieldRequiredValidator()],
'dataSource.connection.port': [fieldRequiredValidator()], 'dataSource.connection.port': [fieldRequiredValidator()],
@ -380,7 +387,7 @@ onMounted(async () => {
<template v-else-if="formState.dataSource.client === ClientType.SNOWFLAKE"> <template v-else-if="formState.dataSource.client === ClientType.SNOWFLAKE">
<!-- Account --> <!-- Account -->
<a-form-item label="Account"> <a-form-item label="Account" v-bind="validateInfos['dataSource.connection.account']">
<a-input v-model:value="formState.dataSource.connection.account" class="nc-extdb-account" /> <a-input v-model:value="formState.dataSource.connection.account" class="nc-extdb-account" />
</a-form-item> </a-form-item>
@ -390,12 +397,12 @@ onMounted(async () => {
</a-form-item> </a-form-item>
<!-- Password --> <!-- Password -->
<a-form-item :label="$t('labels.password')"> <a-form-item :label="$t('labels.password')" v-bind="validateInfos['dataSource.connection.password']">
<a-input-password v-model:value="formState.dataSource.connection.password" class="nc-extdb-host-password" /> <a-input-password v-model:value="formState.dataSource.connection.password" class="nc-extdb-host-password" />
</a-form-item> </a-form-item>
<!-- Warehouse --> <!-- Warehouse -->
<a-form-item label="Warehouse"> <a-form-item label="Warehouse" v-bind="validateInfos['dataSource.connection.warehouse']">
<a-input v-model:value="formState.dataSource.connection.warehouse" /> <a-input v-model:value="formState.dataSource.connection.warehouse" />
</a-form-item> </a-form-item>
@ -410,7 +417,7 @@ onMounted(async () => {
</a-form-item> </a-form-item>
<!-- Schema name --> <!-- Schema name -->
<a-form-item :label="$t('labels.schemaName')"> <a-form-item :label="$t('labels.schemaName')" v-bind="validateInfos['dataSource.connection.schema']">
<a-input v-model:value="formState.dataSource.connection.schema" /> <a-input v-model:value="formState.dataSource.connection.schema" />
</a-form-item> </a-form-item>
</template> </template>

17
packages/nc-gui/pages/index/index/create-external.vue

@ -80,7 +80,14 @@ const validators = computed(() => {
'dataSource.connection.connection.filename': [fieldRequiredValidator()], 'dataSource.connection.connection.filename': [fieldRequiredValidator()],
} }
: formState.dataSource.client === ClientType.SNOWFLAKE : formState.dataSource.client === ClientType.SNOWFLAKE
? {} ? {
'dataSource.connection.account': [fieldRequiredValidator()],
'dataSource.connection.user': [fieldRequiredValidator()],
'dataSource.connection.password': [fieldRequiredValidator()],
'dataSource.connection.warehouse': [fieldRequiredValidator()],
'dataSource.connection.database': [fieldRequiredValidator()],
'dataSource.connection.schema': [fieldRequiredValidator()],
}
: { : {
'dataSource.connection.host': [fieldRequiredValidator()], 'dataSource.connection.host': [fieldRequiredValidator()],
'dataSource.connection.port': [fieldRequiredValidator()], 'dataSource.connection.port': [fieldRequiredValidator()],
@ -389,7 +396,7 @@ onMounted(async () => {
<template v-else-if="formState.dataSource.client === ClientType.SNOWFLAKE"> <template v-else-if="formState.dataSource.client === ClientType.SNOWFLAKE">
<!-- Account --> <!-- Account -->
<a-form-item label="Account"> <a-form-item label="Account" v-bind="validateInfos['dataSource.connection.account']">
<a-input v-model:value="formState.dataSource.connection.account" class="nc-extdb-account" /> <a-input v-model:value="formState.dataSource.connection.account" class="nc-extdb-account" />
</a-form-item> </a-form-item>
@ -399,12 +406,12 @@ onMounted(async () => {
</a-form-item> </a-form-item>
<!-- Password --> <!-- Password -->
<a-form-item :label="$t('labels.password')"> <a-form-item :label="$t('labels.password')" v-bind="validateInfos['dataSource.connection.password']">
<a-input-password v-model:value="formState.dataSource.connection.password" class="nc-extdb-host-password" /> <a-input-password v-model:value="formState.dataSource.connection.password" class="nc-extdb-host-password" />
</a-form-item> </a-form-item>
<!-- Warehouse --> <!-- Warehouse -->
<a-form-item label="Warehouse"> <a-form-item label="Warehouse" v-bind="validateInfos['dataSource.connection.warehouse']">
<a-input v-model:value="formState.dataSource.connection.warehouse" /> <a-input v-model:value="formState.dataSource.connection.warehouse" />
</a-form-item> </a-form-item>
@ -419,7 +426,7 @@ onMounted(async () => {
</a-form-item> </a-form-item>
<!-- Schema name --> <!-- Schema name -->
<a-form-item :label="$t('labels.schemaName')"> <a-form-item :label="$t('labels.schemaName')" v-bind="validateInfos['dataSource.connection.schema']">
<a-input v-model:value="formState.dataSource.connection.schema" /> <a-input v-model:value="formState.dataSource.connection.schema" />
</a-form-item> </a-form-item>
</template> </template>

Loading…
Cancel
Save