compute: fix list host, cluster not filtered in VM deployment form (#378)

Fixes #376

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Hoang Nguyen 2020-06-04 09:38:57 +07:00 committed by Rohit Yadav
parent 27292228be
commit 23fc8bbb90
1 changed files with 21 additions and 1 deletions

View File

@ -51,6 +51,7 @@
v-decorator="['podid']"
:options="podSelectOptions"
:loading="loading.pods"
@change="onSelectPodId"
></a-select>
</a-form-item>
<a-form-item
@ -60,6 +61,7 @@
v-decorator="['clusterid']"
:options="clusterSelectOptions"
:loading="loading.clusters"
@change="onSelectClusterId"
></a-select>
</a-form-item>
<a-form-item
@ -348,6 +350,8 @@ export default {
data () {
return {
zoneId: '',
podId: null,
clusterId: null,
zoneSelected: false,
vm: {},
options: {
@ -529,7 +533,8 @@ export default {
list: 'listClusters',
isLoad: !this.isNormalAndDomainUser,
options: {
zoneid: _.get(this.zone, 'id')
zoneid: _.get(this.zone, 'id'),
podid: this.podId
},
field: 'clusterid'
},
@ -538,6 +543,8 @@ export default {
isLoad: !this.isNormalAndDomainUser,
options: {
zoneid: _.get(this.zone, 'id'),
podid: this.podId,
clusterid: this.clusterId,
state: 'Up',
type: 'Routing'
},
@ -1092,6 +1099,8 @@ export default {
onSelectZoneId (value) {
this.dataPreFill = {}
this.zoneId = value
this.podId = null
this.clusterId = null
this.zone = _.find(this.options.zones, (option) => option.id === value)
this.zoneSelected = true
this.form.setFieldsValue({
@ -1109,6 +1118,17 @@ export default {
})
this.fetchAllTemplates()
},
onSelectPodId (value) {
this.podId = value
this.fetchOptions(this.params.clusters, 'clusters')
this.fetchOptions(this.params.hosts, 'hosts')
},
onSelectClusterId (value) {
this.clusterId = value
this.fetchOptions(this.params.hosts, 'hosts')
},
handleSearchFilter (name, options) {
this.params[name].options = { ...this.params[name].options, ...options }
this.fetchOptions(this.params[name], name)