diff --git a/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue b/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue
index b434e6a059..269614a408 100644
--- a/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue
+++ b/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue
@@ -157,6 +157,50 @@ const authMethodList = [
label: 'Kerberos'
}
]
+
+const validateSshHost = (_: any, value: any, callback: any) => {
+ if ((value === null || value === '') && form.value.configuration.useSSH) {
+ callback(new Error('SSH主机不能为空'))
+ }
+ return callback()
+}
+
+const validateSshPort = (_: any, value: any, callback: any) => {
+ if ((value === null || value === '') && form.value.configuration.useSSH) {
+ callback(new Error('SSH端口不能为空'))
+ }
+ return callback()
+}
+
+const validateSshUserName = (_: any, value: any, callback: any) => {
+ if ((value === null || value === '') && form.value.configuration.useSSH) {
+ callback(new Error('SSH用户名不能为空'))
+ }
+ return callback()
+}
+
+const validateSshPassword = (_: any, value: any, callback: any) => {
+ if (
+ (value === null || value === '') &&
+ form.value.configuration.useSSH &&
+ form.value.configuration.sshType === 'password'
+ ) {
+ callback(new Error('SSH密码不能为空'))
+ }
+ return callback()
+}
+
+const validateSshkey = (_: any, value: any, callback: any) => {
+ if (
+ (value === null || value === '' || value === undefined) &&
+ form.value.configuration.useSSH &&
+ form.value.configuration.sshType === 'sshkey'
+ ) {
+ callback(new Error('SSH key不能为空'))
+ }
+ return callback()
+}
+
const setRules = () => {
const configRules = {
'configuration.jdbcUrl': [
@@ -242,7 +286,12 @@ const setRules = () => {
message: t('common.inputText') + t('datasource.query_timeout'),
trigger: 'blur'
}
- ]
+ ],
+ 'configuration.sshHost': [{ validator: validateSshHost, trigger: 'blur' }],
+ 'configuration.sshPort': [{ validator: validateSshPort, trigger: 'blur' }],
+ 'configuration.sshUserName': [{ validator: validateSshUserName, trigger: 'blur' }],
+ 'configuration.sshPassword': [{ validator: validateSshPassword, trigger: 'blur' }],
+ 'configuration.sshKey': [{ validator: validateSshkey, trigger: 'blur' }]
}
if (['oracle', 'sqlServer', 'pg', 'redshift', 'db2'].includes(form.value.type)) {
configRules['configuration.schema'] = [
@@ -1016,17 +1065,19 @@ defineExpose({
autocomplete="off"
/>
- SSH 设置
-
-
-
-
+
+ SSH 设置
+
+
+
+
+
-
+
启用SSH
@@ -1048,7 +1099,7 @@ defineExpose({
controls-position="right"
/>
-
+
-
+
密码
ssh key
@@ -1065,6 +1116,7 @@ defineExpose({
- {{ t('datasource.priority') }}
-
-
-
-
+
+ {{ t('datasource.priority') }}
+
+
+
+
+
+
diff --git a/core/core-frontend/src/views/visualized/data/datasource/index.vue b/core/core-frontend/src/views/visualized/data/datasource/index.vue
index 1fbc401bc7..17704912b4 100644
--- a/core/core-frontend/src/views/visualized/data/datasource/index.vue
+++ b/core/core-frontend/src/views/visualized/data/datasource/index.vue
@@ -110,6 +110,7 @@ const dsName = ref('')
const userDrawer = ref(false)
const rawDatasourceList = ref([])
const showPriority = ref(true)
+const showSSH = ref(true)
const datasourceEditor = ref()
const activeTab = ref('')
const menuList = [
@@ -1338,6 +1339,35 @@ const getMenuList = (val: boolean) => {
+ SSH 设置
+
+
+
+
+
+
+
+ {{ nodeInfo.configuration.sshHost }}
+
+
+ {{ nodeInfo.configuration.sshPort }}
+
+
+
+
+ {{
+ nodeInfo.configuration.sshUserName
+ }}
+
+
+