|
|
|
@ -7,7 +7,7 @@ import {
|
|
|
|
|
Form, |
|
|
|
|
Modal, |
|
|
|
|
SSLUsage, |
|
|
|
|
clientTypes, |
|
|
|
|
clientTypes as _clientTypes, |
|
|
|
|
computed, |
|
|
|
|
extractSdkResponseErrorMsg, |
|
|
|
|
fieldRequiredValidator, |
|
|
|
@ -28,6 +28,8 @@ import {
|
|
|
|
|
watch, |
|
|
|
|
} from '#imports' |
|
|
|
|
|
|
|
|
|
const { appInfo } = useGlobal() |
|
|
|
|
|
|
|
|
|
const useForm = Form.useForm |
|
|
|
|
|
|
|
|
|
const testSuccess = ref(false) |
|
|
|
@ -64,23 +66,29 @@ const customFormState = ref<ProjectCreateForm>({
|
|
|
|
|
extraParameters: [], |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const clientTypes = computed(() => { |
|
|
|
|
return _clientTypes.filter((type) => { |
|
|
|
|
return appInfo.value?.ee || type.value !== ClientType.SNOWFLAKE |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const validators = computed(() => { |
|
|
|
|
return { |
|
|
|
|
'title': [ |
|
|
|
|
{ |
|
|
|
|
required: true, |
|
|
|
|
message: 'Project name is required', |
|
|
|
|
}, |
|
|
|
|
projectTitleValidator, |
|
|
|
|
], |
|
|
|
|
'extraParameters': [extraParameterValidator], |
|
|
|
|
'dataSource.client': [fieldRequiredValidator()], |
|
|
|
|
...(formState.dataSource.client === ClientType.SQLITE |
|
|
|
|
? { |
|
|
|
|
let clientValidations: Record<string, any[]> = { |
|
|
|
|
'dataSource.connection.host': [fieldRequiredValidator()], |
|
|
|
|
'dataSource.connection.port': [fieldRequiredValidator()], |
|
|
|
|
'dataSource.connection.user': [fieldRequiredValidator()], |
|
|
|
|
'dataSource.connection.password': [fieldRequiredValidator()], |
|
|
|
|
'dataSource.connection.database': [fieldRequiredValidator()], |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch (formState.dataSource.client) { |
|
|
|
|
case ClientType.SQLITE: |
|
|
|
|
clientValidations = { |
|
|
|
|
'dataSource.connection.connection.filename': [fieldRequiredValidator()], |
|
|
|
|
} |
|
|
|
|
: formState.dataSource.client === ClientType.SNOWFLAKE |
|
|
|
|
? { |
|
|
|
|
break |
|
|
|
|
case ClientType.SNOWFLAKE: |
|
|
|
|
clientValidations = { |
|
|
|
|
'dataSource.connection.account': [fieldRequiredValidator()], |
|
|
|
|
'dataSource.connection.username': [fieldRequiredValidator()], |
|
|
|
|
'dataSource.connection.password': [fieldRequiredValidator()], |
|
|
|
@ -88,18 +96,24 @@ const validators = computed(() => {
|
|
|
|
|
'dataSource.connection.database': [fieldRequiredValidator()], |
|
|
|
|
'dataSource.connection.schema': [fieldRequiredValidator()], |
|
|
|
|
} |
|
|
|
|
: { |
|
|
|
|
'dataSource.connection.host': [fieldRequiredValidator()], |
|
|
|
|
'dataSource.connection.port': [fieldRequiredValidator()], |
|
|
|
|
'dataSource.connection.user': [fieldRequiredValidator()], |
|
|
|
|
'dataSource.connection.password': [fieldRequiredValidator()], |
|
|
|
|
'dataSource.connection.database': [fieldRequiredValidator()], |
|
|
|
|
...([ClientType.PG, ClientType.MSSQL].includes(formState.dataSource.client) |
|
|
|
|
? { |
|
|
|
|
'dataSource.searchPath.0': [fieldRequiredValidator()], |
|
|
|
|
break |
|
|
|
|
case ClientType.PG: |
|
|
|
|
case ClientType.MSSQL: |
|
|
|
|
clientValidations['dataSource.searchPath.0'] = [fieldRequiredValidator()] |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
: {}), |
|
|
|
|
}), |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
'title': [ |
|
|
|
|
{ |
|
|
|
|
required: true, |
|
|
|
|
message: 'Project name is required', |
|
|
|
|
}, |
|
|
|
|
projectTitleValidator, |
|
|
|
|
], |
|
|
|
|
'extraParameters': [extraParameterValidator], |
|
|
|
|
'dataSource.client': [fieldRequiredValidator()], |
|
|
|
|
...clientValidations, |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
@ -547,7 +561,9 @@ onMounted(async () => {
|
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<a-button type="dashed" class="w-full caption mt-2" @click="addNewParam"> |
|
|
|
|
<div class="flex items-center justify-center"><MdiPlus /></div> |
|
|
|
|
<div class="flex items-center justify-center"> |
|
|
|
|
<MdiPlus /> |
|
|
|
|
</div> |
|
|
|
|
</a-button> |
|
|
|
|
</a-card> |
|
|
|
|
</a-form-item> |
|
|
|
|