diff --git a/packages/nc-gui-v2/pages/index/index/create-external.vue b/packages/nc-gui-v2/pages/index/index/create-external.vue index ff7a915771..18e8d48b19 100644 --- a/packages/nc-gui-v2/pages/index/index/create-external.vue +++ b/packages/nc-gui-v2/pages/index/index/create-external.vue @@ -103,21 +103,21 @@ const onClientChange = () => { } const onSSLModeChange = ((mode: 'No' | 'Allow' | string) => { - switch (mode) { - case 'No': - delete formState.dataSource.connection.ssl - break - case 'Allowed': - formState.dataSource.connection.ssl = 'true' - break - default: - formState.dataSource.connection.ssl = { - ca: '', - cert: '', - key: '', - } - break - } + switch (mode) { + case 'No': + delete formState.dataSource.connection.ssl + break + case 'Allowed': + formState.dataSource.connection.ssl = 'true' + break + default: + formState.dataSource.connection.ssl = { + ca: '', + cert: '', + key: '', + } + break + } }) as unknown as SelectHandler const addNewParam = () => { @@ -129,7 +129,9 @@ const removeParam = (index: number) => { } const inflectionTypes = ['camelize', 'none'] +const importURL = ref('') const configEditDlg = ref(false) +const importURLDlg = ref(false) const caFileInput = ref() const keyFileInput = ref() @@ -251,6 +253,20 @@ const testConnection = async () => { } } +const handleImportURL = async () => { + if (!importURL.value || importURL.value === '') return + + const connectionConfig = await api.utils.urlToConfig({ url: importURL.value }) + + if (connectionConfig) { + formState.dataSource.client = connectionConfig.client + formState.dataSource.connection = { ...connectionConfig.connection } + } else { + message.error('Invalid URL') + } + importURLDlg.value = false +} + const handleEditJSON = () => { customFormState.value = { ...formState } configEditDlg.value = true @@ -373,7 +389,15 @@ onMounted(() => { - + + @@ -423,6 +447,8 @@ onMounted(() => { + +
@@ -441,16 +467,9 @@ onMounted(() => { -
- - - {{ $t('activity.editConnJson') }} - -
- {{ type }} @@ -463,6 +482,12 @@ onMounted(() => { +
+ + + {{ $t('activity.editConnJson') }} + +
@@ -483,6 +508,10 @@ onMounted(() => { + + + +