diff --git a/ui/src/views/infra/zone/StaticInputsForm.vue b/ui/src/views/infra/zone/StaticInputsForm.vue
index 0c23a3ad083..6604ba32c88 100644
--- a/ui/src/views/infra/zone/StaticInputsForm.vue
+++ b/ui/src/views/infra/zone/StaticInputsForm.vue
@@ -67,6 +67,26 @@
v-model:value="form[field.key]"
v-focus="index === 0"
/>
+
+
+
+ {{ $t(radioItem.label) }}
+
+
+
+
+
+
+
+
{
@@ -236,6 +264,27 @@ export default {
return false
}
return true
+ },
+ isDisplayItem (conditions) {
+ if (!conditions || Object.keys(conditions).length === 0) {
+ return true
+ }
+ let isShow = true
+ Object.keys(conditions).forEach(key => {
+ if (!isShow) return false
+
+ const condition = conditions[key]
+ const fieldVal = this.form[key]
+ ? this.form[key]
+ : (this.prefillContent?.[key] || null)
+ if (Array.isArray(condition) && !condition.includes(fieldVal)) {
+ isShow = false
+ } else if (!Array.isArray(condition) && fieldVal !== condition) {
+ isShow = false
+ }
+ })
+
+ return isShow
}
}
}
diff --git a/ui/src/views/infra/zone/ZoneWizardAddResources.vue b/ui/src/views/infra/zone/ZoneWizardAddResources.vue
index 8a52ec91007..ad16ef30aa1 100644
--- a/ui/src/views/infra/zone/ZoneWizardAddResources.vue
+++ b/ui/src/views/infra/zone/ZoneWizardAddResources.vue
@@ -284,6 +284,33 @@ export default {
hypervisor: ['VMware', 'BareMetal', 'Ovm', 'Hyperv', 'KVM', 'XenServer', 'LXC', 'Simulator']
}
},
+ {
+ title: 'label.authentication.method',
+ key: 'authmethod',
+ placeHolder: 'message.error.authmethod',
+ required: false,
+ radioGroup: true,
+ defaultValue: 'password',
+ radioOption: [{
+ label: 'label.password',
+ value: 'password'
+ }, {
+ label: 'label.authentication.sshkey',
+ value: 'sshkey',
+ condition: {
+ hypervisor: ['KVM']
+ }
+ }],
+ display: {
+ hypervisor: ['BareMetal', 'Ovm', 'Hyperv', 'KVM', 'XenServer', 'LXC', 'Simulator']
+ },
+ alert: {
+ message: 'message.add.host.sshkey',
+ display: {
+ authmethod: 'sshkey'
+ }
+ }
+ },
{
title: 'label.password',
key: 'hostPassword',
@@ -291,7 +318,8 @@ export default {
required: true,
password: true,
display: {
- hypervisor: ['VMware', 'BareMetal', 'Ovm', 'Hyperv', 'KVM', 'XenServer', 'LXC', 'Simulator']
+ hypervisor: ['VMware', 'BareMetal', 'Ovm', 'Hyperv', 'KVM', 'XenServer', 'LXC', 'Simulator'],
+ authmethod: 'password'
}
},
{
diff --git a/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue b/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue
index 432523c901a..7f23c3b643a 100644
--- a/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue
+++ b/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue
@@ -1211,6 +1211,7 @@ export default {
this.addStep('message.adding.host', 'hostResource')
const hostData = {}
+ const hostPassword = this.prefillContent?.authmethod !== 'password' ? '' : (this.prefillContent?.hostPassword || null)
hostData.zoneid = this.stepData.zoneReturned.id
hostData.podid = this.stepData.podReturned.id
hostData.clusterid = this.stepData.clusterReturned.id
@@ -1218,7 +1219,7 @@ export default {
hostData.clustertype = this.stepData.clusterReturned.clustertype
hostData.hosttags = this.prefillContent?.hostTags || null
hostData.username = this.prefillContent?.hostUserName || null
- hostData.password = this.prefillContent?.hostPassword || null
+ hostData.password = hostPassword
const hostname = this.prefillContent?.hostName || null
let url = null
if (hostname.indexOf('http://') === -1) {