Skip to content

Commit 1925040

Browse files
authored
ui: fix create k8s cluster multiple listing (apache#8539)
Fixes apache#8536 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent 80bbb29 commit 1925040

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

ui/src/views/compute/CreateKubernetesCluster.vue

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -259,18 +259,12 @@ export default {
259259
this.apiParams = this.$getApiParams('createKubernetesCluster')
260260
},
261261
created () {
262-
this.networks = [
263-
{
264-
id: null,
265-
name: ''
266-
}
267-
]
268-
this.keyPairs = [
269-
{
270-
id: null,
271-
name: ''
272-
}
273-
]
262+
this.emptyEntry = {
263+
id: null,
264+
name: ''
265+
}
266+
this.networks = [this.emptyEntry]
267+
this.keyPairs = [this.emptyEntry]
274268
this.initForm()
275269
this.fetchData()
276270
},
@@ -322,7 +316,6 @@ export default {
322316
},
323317
fetchData () {
324318
this.fetchZoneData()
325-
this.fetchNetworkData()
326319
this.fetchKeyPairData()
327320
},
328321
isValidValueForKey (obj, key) {
@@ -417,14 +410,16 @@ export default {
417410
params.zoneid = this.selectedZone.id
418411
}
419412
this.networkLoading = true
413+
this.networks = []
420414
api('listNetworks', params).then(json => {
421415
var listNetworks = json.listnetworksresponse.network
422416
if (this.arrayHasItems(listNetworks)) {
423417
listNetworks = listNetworks.filter(n => n.type !== 'L2')
424-
this.networks = this.networks.concat(listNetworks)
418+
this.networks = listNetworks
425419
}
426420
}).finally(() => {
427421
this.networkLoading = false
422+
this.networks = [this.emptyEntry].concat(this.networks)
428423
if (this.arrayHasItems(this.networks)) {
429424
this.form.networkid = 0
430425
}

0 commit comments

Comments
 (0)