fix: SSH 设置显示问题

This commit is contained in:
taojinlong 2024-07-24 15:19:25 +08:00
parent 931da60ce5
commit 707ff507be
2 changed files with 50 additions and 44 deletions

View File

@ -159,21 +159,22 @@ const authMethodList = [
]
const validateSshHost = (_: any, value: any, callback: any) => {
if ((value === null || value === '') && form.value.configuration.useSSH) {
console.log(value)
if ((value === undefined || 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) {
if ((value === undefined || 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) {
if ((value === undefined || value === null || value === '') && form.value.configuration.useSSH) {
callback(new Error('SSH用户名不能为空'))
}
return callback()
@ -181,7 +182,7 @@ const validateSshUserName = (_: any, value: any, callback: any) => {
const validateSshPassword = (_: any, value: any, callback: any) => {
if (
(value === null || value === '') &&
(value === undefined || value === null || value === '') &&
form.value.configuration.useSSH &&
form.value.configuration.sshType === 'password'
) {

View File

@ -1299,17 +1299,51 @@ const getMenuList = (val: boolean) => {
}}</BaseInfoItem>
</el-col>
</el-row>
<span
v-if="!['es', 'api'].includes(nodeInfo.type.toLowerCase())"
class="de-expand"
@click="showPriority = !showPriority"
>{{ t('datasource.priority') }}
<el-icon>
<Icon
:name="showPriority ? 'icon_down_outlined' : 'icon_down_outlined-1'"
></Icon>
</el-icon>
</span>
<el-row :gutter="24">
<span
v-if="
!['es', 'api'].includes(nodeInfo.type.toLowerCase()) &&
nodeInfo.configuration.urlType !== 'jdbcUrl'
"
class="de-expand"
@click="showSSH = !showSSH"
>SSH 设置
<el-icon>
<Icon :name="showSSH ? 'icon_down_outlined' : 'icon_down_outlined-1'"></Icon>
</el-icon>
</span>
</el-row>
<template v-if="showSSH">
<el-row :gutter="24" v-if="nodeInfo.configuration.useSSH">
<el-col :span="12">
<BaseInfoItem label="主机">{{ nodeInfo.configuration.sshHost }}</BaseInfoItem>
</el-col>
<el-col :span="12">
<BaseInfoItem label="端口">{{ nodeInfo.configuration.sshPort }}</BaseInfoItem>
</el-col>
</el-row>
<el-row :gutter="24" v-if="nodeInfo.configuration.useSSH">
<el-col :span="12">
<BaseInfoItem label="用户名">{{
nodeInfo.configuration.sshUserName
}}</BaseInfoItem>
</el-col>
</el-row>
</template>
<el-row :gutter="24">
<span
v-if="!['es', 'api'].includes(nodeInfo.type.toLowerCase())"
class="de-expand"
@click="showPriority = !showPriority"
>{{ t('datasource.priority') }}
<el-icon>
<Icon
:name="showPriority ? 'icon_down_outlined' : 'icon_down_outlined-1'"
></Icon>
</el-icon>
</span>
</el-row>
<template v-if="showPriority">
<el-row :gutter="24">
<el-col :span="12">
@ -1339,35 +1373,6 @@ const getMenuList = (val: boolean) => {
</el-col>
</el-row>
</template>
<span
v-if="
!['es', 'api'].includes(nodeInfo.type.toLowerCase()) &&
nodeInfo.configuration.urlType !== 'jdbcUrl'
"
class="de-expand"
@click="showSSH = !showSSH"
>SSH 设置
<el-icon>
<Icon :name="showSSH ? 'icon_down_outlined' : 'icon_down_outlined-1'"></Icon>
</el-icon>
</span>
<template v-if="showSSH">
<el-row :gutter="24" v-if="nodeInfo.configuration.useSSH">
<el-col :span="12">
<BaseInfoItem label="主机">{{ nodeInfo.configuration.sshHost }}</BaseInfoItem>
</el-col>
<el-col :span="12">
<BaseInfoItem label="端口">{{ nodeInfo.configuration.sshPort }}</BaseInfoItem>
</el-col>
</el-row>
<el-row :gutter="24" v-if="nodeInfo.configuration.useSSH">
<el-col :span="12">
<BaseInfoItem label="用户名">{{
nodeInfo.configuration.sshUserName
}}</BaseInfoItem>
</el-col>
</el-row>
</template>
</template>
</template>
</BaseInfoContent>