Skip to content

Commit f452671

Browse files
authored
ui: list only accessible networks during import (apache#9194)
* ui: list only accessible networks during import Fixes apache#8612 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * fix Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * space Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com> * changes --------- Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent 78ace3a commit f452671

2 files changed

Lines changed: 33 additions & 5 deletions

File tree

ui/src/views/compute/wizard/MultiNetworkSelection.vue

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ export default {
9999
type: String,
100100
default: () => ''
101101
},
102+
domainid: {
103+
type: String,
104+
default: ''
105+
},
106+
account: {
107+
type: String,
108+
default: ''
109+
},
102110
selectionEnabled: {
103111
type: Boolean,
104112
default: true
@@ -144,7 +152,8 @@ export default {
144152
ipAddressesEnabled: {},
145153
ipAddresses: {},
146154
indexNum: 1,
147-
sendValuesTimer: null
155+
sendValuesTimer: null,
156+
accountNetworkUpdateTimer: null
148157
}
149158
},
150159
computed: {
@@ -184,6 +193,14 @@ export default {
184193
},
185194
zoneId () {
186195
this.fetchNetworks()
196+
},
197+
account () {
198+
clearTimeout(this.accountNetworkUpdateTimer)
199+
this.accountNetworkUpdateTimer = setTimeout(() => {
200+
if (this.account) {
201+
this.fetchNetworks()
202+
}
203+
}, 750)
187204
}
188205
},
189206
created () {
@@ -196,13 +213,20 @@ export default {
196213
return
197214
}
198215
this.loading = true
199-
api('listNetworks', {
216+
var params = {
200217
zoneid: this.zoneId,
201218
listall: true
202-
}).then(response => {
219+
}
220+
if (this.domainid && this.account) {
221+
params.domainid = this.domainid
222+
params.account = this.account
223+
}
224+
api('listNetworks', params).then(response => {
203225
this.networks = response.listnetworksresponse.network || []
204-
this.orderNetworks()
226+
}).catch(() => {
227+
this.networks = []
205228
}).finally(() => {
229+
this.orderNetworks()
206230
this.loading = false
207231
})
208232
},

ui/src/views/tools/ImportUnmanagedInstance.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@
297297
<multi-network-selection
298298
:items="nics"
299299
:zoneId="cluster.zoneid"
300+
:domainid="form.domainid"
301+
:account="form.account"
300302
:selectionEnabled="false"
301303
:filterUnimplementedNetworks="true"
302304
:hypervisor="this.cluster.hypervisortype"
@@ -693,7 +695,9 @@ export default {
693695
this.form = reactive({
694696
rootdiskid: 0,
695697
migrateallowed: this.switches.migrateAllowed,
696-
forced: this.switches.forced
698+
forced: this.switches.forced,
699+
domainid: null,
700+
account: null
697701
})
698702
this.rules = reactive({
699703
displayname: [{ required: true, message: this.$t('message.error.input.value') }],

0 commit comments

Comments
 (0)