ui: Show traffic type in physical networks tab (#4952)

This commit is contained in:
davidjumani 2021-04-26 14:24:20 +05:30 committed by GitHub
parent f8ba33d570
commit 96ccd6d3e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,6 +47,14 @@
</div>
<div>{{ network.vlan }}</div>
</div>
<div class="list__col">
<div class="list__label">
{{ $t('label.traffictype') }}
</div>
<div>
{{ network.traffictype }}
</div>
</div>
<div class="list__col">
<div class="list__label">
{{ $t('label.broadcastdomainrange') }}
@ -101,9 +109,25 @@ export default {
this.fetchLoading = true
api('listPhysicalNetworks', { zoneid: this.resource.id }).then(json => {
this.networks = json.listphysicalnetworksresponse.physicalnetwork || []
this.fetchTrafficLabels()
}).catch(error => {
this.$notifyError(error)
}).finally(() => {
})
},
fetchTrafficLabels () {
const promises = []
for (const network of this.networks) {
promises.push(new Promise((resolve, reject) => {
api('listTrafficTypes', { physicalnetworkid: network.id }).then(json => {
network.traffictype = json.listtraffictypesresponse.traffictype.filter(e => { return e.traffictype }).map(e => { return e.traffictype }).join(', ')
resolve()
}).catch(error => {
this.$notifyError(error)
reject(error)
})
}))
}
Promise.all(promises).finally(() => {
this.fetchLoading = false
})
}