ui: list only accessible networks during import (#9194)

* ui: list only accessible networks during import

Fixes #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>
This commit is contained in:
Abhishek Kumar 2024-06-13 11:58:36 +05:30 committed by GitHub
parent 78ace3a750
commit f45267174a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 5 deletions

View File

@ -99,6 +99,14 @@ export default {
type: String,
default: () => ''
},
domainid: {
type: String,
default: ''
},
account: {
type: String,
default: ''
},
selectionEnabled: {
type: Boolean,
default: true
@ -144,7 +152,8 @@ export default {
ipAddressesEnabled: {},
ipAddresses: {},
indexNum: 1,
sendValuesTimer: null
sendValuesTimer: null,
accountNetworkUpdateTimer: null
}
},
computed: {
@ -184,6 +193,14 @@ export default {
},
zoneId () {
this.fetchNetworks()
},
account () {
clearTimeout(this.accountNetworkUpdateTimer)
this.accountNetworkUpdateTimer = setTimeout(() => {
if (this.account) {
this.fetchNetworks()
}
}, 750)
}
},
created () {
@ -196,13 +213,20 @@ export default {
return
}
this.loading = true
api('listNetworks', {
var params = {
zoneid: this.zoneId,
listall: true
}).then(response => {
}
if (this.domainid && this.account) {
params.domainid = this.domainid
params.account = this.account
}
api('listNetworks', params).then(response => {
this.networks = response.listnetworksresponse.network || []
this.orderNetworks()
}).catch(() => {
this.networks = []
}).finally(() => {
this.orderNetworks()
this.loading = false
})
},

View File

@ -297,6 +297,8 @@
<multi-network-selection
:items="nics"
:zoneId="cluster.zoneid"
:domainid="form.domainid"
:account="form.account"
:selectionEnabled="false"
:filterUnimplementedNetworks="true"
:hypervisor="this.cluster.hypervisortype"
@ -693,7 +695,9 @@ export default {
this.form = reactive({
rootdiskid: 0,
migrateallowed: this.switches.migrateAllowed,
forced: this.switches.forced
forced: this.switches.forced,
domainid: null,
account: null
})
this.rules = reactive({
displayname: [{ required: true, message: this.$t('message.error.input.value') }],