Skip to content

Commit 03bfe9a

Browse files
author
Hoang Nguyen
authored
ui: FIX error in "Port forward" and "Load Balancing" (#4746)
* fix error show in fetching port forwarding tab * clear all list vm when tier empty
1 parent f511bab commit 03bfe9a

4 files changed

Lines changed: 18 additions & 2 deletions

File tree

ui/src/core/lazy_lib/components_use.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ import {
6565
Tree,
6666
Calendar,
6767
Slider,
68-
AutoComplete
68+
AutoComplete,
69+
Collapse
6970
} from 'ant-design-vue'
7071

7172
Vue.use(ConfigProvider)
@@ -114,6 +115,7 @@ Vue.use(Tree)
114115
Vue.use(Calendar)
115116
Vue.use(Slider)
116117
Vue.use(AutoComplete)
118+
Vue.use(Collapse)
117119

118120
Vue.prototype.$confirm = Modal.confirm
119121
Vue.prototype.$message = message

ui/src/views/network/LoadBalancing.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,10 @@ export default {
10231023
this.vms = []
10241024
this.addVmModalLoading = true
10251025
const networkId = ('vpcid' in this.resource && !('associatednetworkid' in this.resource)) ? this.selectedTier : this.resource.associatednetworkid
1026+
if (!networkId) {
1027+
this.addVmModalLoading = false
1028+
return
1029+
}
10261030
api('listVirtualMachines', {
10271031
listAll: true,
10281032
keyword: this.searchQuery,

ui/src/views/network/PortForwarding.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ export default {
391391
if ('vpcid' in this.resource && 'associatednetworkid' in this.resource) {
392392
return
393393
}
394+
this.selectedTier = null
394395
this.tiers.loading = true
395396
api('listNetworks', {
396397
account: this.resource.account,
@@ -399,7 +400,9 @@ export default {
399400
vpcid: this.resource.vpcid
400401
}).then(json => {
401402
this.tiers.data = json.listnetworksresponse.network || []
402-
this.selectedTier = this.tiers.data && this.tiers.data[0].id ? this.tiers.data[0].id : null
403+
if (this.tiers.data && this.tiers.data.length > 0) {
404+
this.selectedTier = this.tiers.data[0].id
405+
}
403406
this.$forceUpdate()
404407
}).catch(error => {
405408
this.$notifyError(error)
@@ -615,6 +618,10 @@ export default {
615618
this.vms = []
616619
this.addVmModalLoading = true
617620
const networkId = ('vpcid' in this.resource && !('associatednetworkid' in this.resource)) ? this.selectedTier : this.resource.associatednetworkid
621+
if (!networkId) {
622+
this.addVmModalLoading = false
623+
return
624+
}
618625
api('listVirtualMachines', {
619626
listAll: true,
620627
keyword: this.searchQuery,

ui/src/views/network/VpcTiersTab.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,9 @@ export default {
390390
},
391391
fetchData () {
392392
this.networks = this.resource.network
393+
if (!this.networks || this.networks.length === 0) {
394+
return
395+
}
393396
for (const network of this.networks) {
394397
this.fetchLoadBalancers(network.id)
395398
this.fetchVMs(network.id)

0 commit comments

Comments
 (0)