mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
ui: show VR offering when provider is VR (#4988)
* ui: show VR offering when provider is VR * send serviceofferingid not index
This commit is contained in:
parent
5b6ab3d248
commit
eb2e5f73d3
@ -23,7 +23,7 @@
|
|||||||
<a-form-item class="pair-select-container" :label="selectLabel" v-if="this.checked">
|
<a-form-item class="pair-select-container" :label="selectLabel" v-if="this.checked">
|
||||||
<a-select
|
<a-select
|
||||||
v-decorator="[selectDecorator, {
|
v-decorator="[selectDecorator, {
|
||||||
initialValue: this.getSelectInitialValue()
|
initialValue: selectedOption ? selectedOption : this.getSelectInitialValue()
|
||||||
}]"
|
}]"
|
||||||
showSearch
|
showSearch
|
||||||
optionFilterProp="children"
|
optionFilterProp="children"
|
||||||
@ -80,23 +80,16 @@ export default {
|
|||||||
return array !== null && array !== undefined && Array.isArray(array) && array.length > 0
|
return array !== null && array !== undefined && Array.isArray(array) && array.length > 0
|
||||||
},
|
},
|
||||||
getSelectInitialValue () {
|
getSelectInitialValue () {
|
||||||
if (this.arrayHasItems(this.selectOptions)) {
|
const provider = this.selectOptions?.filter(x => x.enabled)?.[0]?.name || ''
|
||||||
for (var i = 0; i < this.selectOptions.length; i++) {
|
this.handleSelectChange(provider)
|
||||||
if (this.selectOptions[i].enabled !== false) {
|
return provider
|
||||||
return this.selectOptions[i].name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ''
|
|
||||||
},
|
},
|
||||||
handleCheckChange (e) {
|
handleCheckChange (e) {
|
||||||
this.checked = e.target.checked
|
this.checked = e.target.checked
|
||||||
if (this.checked && this.arrayHasItems(this.selectOptions)) {
|
|
||||||
this.selectedOption = this.selectOptions[0].name
|
|
||||||
}
|
|
||||||
this.$emit('handle-checkpair-change', this.resourceKey, this.checked, '')
|
this.$emit('handle-checkpair-change', this.resourceKey, this.checked, '')
|
||||||
},
|
},
|
||||||
handleSelectChange (val) {
|
handleSelectChange (val) {
|
||||||
|
this.selectedOption = val
|
||||||
this.$emit('handle-checkpair-change', this.resourceKey, this.checked, val)
|
this.$emit('handle-checkpair-change', this.resourceKey, this.checked, val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -228,7 +228,7 @@
|
|||||||
message: `${this.$t('message.error.select')}`
|
message: `${this.$t('message.error.select')}`
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
initialValue: 0
|
initialValue: this.serviceOfferings.length > 0 ? this.serviceOfferings[0].id : ''
|
||||||
}]"
|
}]"
|
||||||
showSearch
|
showSearch
|
||||||
optionFilterProp="children"
|
optionFilterProp="children"
|
||||||
@ -237,7 +237,7 @@
|
|||||||
}"
|
}"
|
||||||
:loading="serviceOfferingLoading"
|
:loading="serviceOfferingLoading"
|
||||||
:placeholder="this.$t('label.serviceofferingid')">
|
:placeholder="this.$t('label.serviceofferingid')">
|
||||||
<a-select-option v-for="(opt, optIndex) in this.serviceOfferings" :key="optIndex">
|
<a-select-option v-for="(opt) in this.serviceOfferings" :key="opt.id">
|
||||||
{{ opt.name || opt.description }}
|
{{ opt.name || opt.description }}
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user