Skip to content

Commit 045fa5a

Browse files
committed
Update PR#5684: add radio group on UI
1 parent a2ab99b commit 045fa5a

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

ui/public/locales/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,8 @@
468468
"label.associatednetworkid": "Associated Network ID",
469469
"label.associatednetworkname": "Network Name",
470470
"label.asyncbackup": "Async Backup",
471+
"label.authentication.method": "Authentication Method",
472+
"label.authentication.sshkey": "System SSH Key",
471473
"label.author.email": "Author e-mail",
472474
"label.author.name": "Author name",
473475
"label.auto.assign.diskoffering.disk.size": "Automatically assign offering matching the disk size",
@@ -2588,6 +2590,7 @@
25882590
"message.add.firewall.rule.processing": "Adding new Firewall rule...",
25892591
"message.add.guest.network": "Please confirm that you would like to add a guest network",
25902592
"message.add.host": "Please specify the following parameters to add a new host",
2593+
"message.add.host.sshkey": "WARNING: In order to add a host with SSH key, you must ensure your hypervisor host has been configured correctly.",
25912594
"message.add.ip.range": "Add an IP range to public network in zone",
25922595
"message.add.ip.range.direct.network": "Add an IP range to direct network <b><span id=\"directnetwork_name\"></span></b> in zone <b><span id=\"zone_name\"></span></b>",
25932596
"message.add.ip.range.to.pod": "<p>Add an IP range to pod: <b><span id=\"pod_name_label\"></span></b></p>",

ui/src/views/infra/HostAdd.vue

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,31 @@
9595
</div>
9696

9797
<div class="form__item" v-if="selectedClusterHyperVisorType !== 'VMware'">
98-
<div class="form__label">{{ $t('label.password') }}</div>
98+
<div class="form__label"><span class="required">* </span>{{ $t('label.authentication.method') }}</div>
99+
<a-radio-group
100+
v-decorator="['authmethod', {
101+
initialValue: authMethod
102+
}]"
103+
buttonStyle="solid"
104+
:defaultValue="authMethod"
105+
@change="selected => { handleAuthMethodChange(selected.target.value) }">
106+
<a-radio-button value="password">
107+
{{ $t('label.password') }}
108+
</a-radio-button>
109+
<a-radio-button value="sshkey" v-if="selectedClusterHyperVisorType === 'KVM'">
110+
{{ $t('label.authentication.sshkey') }}
111+
</a-radio-button>
112+
</a-radio-group>
113+
<span v-if="authMethod === 'sshkey'">
114+
<a-alert type="warning">
115+
<span style="display:block;width:300px;word-wrap:break-word;" slot="message" v-html="$t('message.add.host.sshkey')" />
116+
</a-alert>
117+
</span>
118+
</div>
119+
120+
<div class="form__item required-field" v-if="selectedClusterHyperVisorType !== 'VMware' && authMethod === 'password'">
121+
<div class="form__label"><span class="required">* </span>{{ $t('label.password') }}</div>
122+
<span class="required required-label">{{ $t('label.required') }}</span>
99123
<a-input :placeholder="placeholder.password" type="password" v-model="password"></a-input>
100124
</div>
101125

@@ -189,6 +213,7 @@ export default {
189213
agentusername: null,
190214
agentpassword: null,
191215
agentport: null,
216+
authMethod: 'password',
192217
selectedCluster: null,
193218
selectedClusterHyperVisorType: null,
194219
showDedicated: false,
@@ -279,6 +304,9 @@ export default {
279304
this.dedicatedAccount = null
280305
this.showDedicated = !this.showDedicated
281306
},
307+
handleAuthMethodChange (val) {
308+
this.authMethod = val
309+
},
282310
handleSubmitForm () {
283311
if (this.loading) return
284312
const requiredFields = document.querySelectorAll('.required-field')
@@ -305,6 +333,10 @@ export default {
305333
this.url = this.hostname
306334
}
307335
336+
if (this.authMethod !== 'password') {
337+
this.password = ''
338+
}
339+
308340
const args = {
309341
zoneid: this.zoneId,
310342
podid: this.podId,

0 commit comments

Comments
 (0)