Skip to content
18 changes: 12 additions & 6 deletions ui/src/views/tools/SelectVmwareVcenter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,17 @@
</div>
<div
v-if="selectedExistingVcenterId || (vcenterSelectedOption === 'new')">
<a-form-item :label="$t('label.vcenter.host')" ref="host" name="host" v-if="hosts.length > 0">
<a-form-item :label="$t('label.esx.host')" ref="host" name="host" v-if="hosts.length > 0">
<a-select
v-model:value="form.host"
:loading="loading"
optionFilterProp="label"
:filterOption="(input, option) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
}"
:placeholder="$t('label.vcenter.host')"
:placeholder="$t('label.esx.host')"
@change="onSelectExistingVmwareHost">
<a-select-option key="" label="">{{ }}</a-select-option>
<a-select-option v-for="opt in hosts" :key="opt.name">
{{ 'ESXi: ' + opt.name }}
</a-select-option>
Expand Down Expand Up @@ -283,7 +284,7 @@ export default {
this.loading = false
})
},
listZoneVmwareDcHosts () {
listZoneVmwareDcHosts (doNotify) {
this.loading = true
const params = {}
if (this.vcenterSelectedOption === 'new') {
Expand All @@ -299,18 +300,23 @@ export default {
this.hosts = response.listvmwaredchostsresponse.host
}
}).catch(error => {
this.$notifyError(error)
if (doNotify) {
this.$notifyError(error)
}
this.hosts = []
return false
}).finally(() => {
this.loading = false
return true
})
},
onSelectExistingVmwareDatacenter (value) {
this.selectedExistingVcenterId = value
this.listZoneVmwareDcHosts()
this.listZoneVmwareDcHosts(true)
},
onSelectExternalVmwareDatacenter (value) {
if (this.vcenterSelectedOption === 'new' && !(this.vcenter === '' || this.datacentername === '' || this.username === '' || this.password === '')) {
this.listZoneVmwareDcHosts()
this.listZoneVmwareDcHosts(false)
}
},
onSelectExistingVmwareHost (value) {
Expand Down
Loading