1818<template >
1919 <a-spin :spinning =" componentLoading" >
2020 <a-alert
21- v-if =" this.resource.ip4routing || this.resource.ip6routing "
21+ v-if =" isIpRoutingEnabled() "
2222 type =" info" >
2323 <template #message >
2424 <div v-html =" $t('message.bgp.peers.null')" />
2525 </template >
2626 </a-alert >
2727 <br >
2828 <a-button
29- v-if =" !(this.resource.ip4routing || this.resource.ip6routing )"
29+ v-if =" !isIpRoutingEnabled( )"
3030 :disabled =" !('createBgpPeer' in $store.getters.apis)"
3131 type =" primary"
3232 style =" margin-bottom : 20px ; width : 100% "
5656 <template v-if =" column .key === ' project' " >
5757 {{ record.project }}
5858 </template >
59- <template v-if =" column .key === ' actions' && ! ( this . resource . ip4routing || this . resource . ip6routing )" >
59+ <template v-if =" column .key === ' actions' && ! isIpRoutingEnabled ( )" >
6060 <div
6161 class =" actions"
6262 style =" text-align : right " >
103103 </template >
104104 </a-table >
105105 <a-pagination
106- v-if =" !(this.resource.ip4routing || this.resource.ip6routing )"
106+ v-if =" !isIpRoutingEnabled( )"
107107 class =" row-element pagination"
108108 size =" small"
109109 :current =" bgpPeersPage"
318318
319319 <br >
320320 <a-button
321- v-if =" (this.resource.ip4routing || this.resource.ip6routing ) && this.$route.meta.name === 'guestnetwork'"
321+ v-if =" isIpRoutingEnabled( ) && this.$route.meta.name === 'guestnetwork'"
322322 type =" primary"
323323 style =" margin-bottom : 20px ; width : 100% "
324324 @click =" () => { changeBgpPeersForNetworkModal = true }"
327327 {{ $t('label.change.bgp.peers') }}
328328 </a-button >
329329 <a-button
330- v-if =" (this.resource.ip4routing || this.resource.ip6routing ) && this.$route.meta.name === 'vpc'"
330+ v-if =" isIpRoutingEnabled( ) && this.$route.meta.name === 'vpc'"
331331 type =" primary"
332332 style =" margin-bottom : 20px ; width : 100% "
333333 @click =" () => { changeBgpPeersForVpcModal = true }"
@@ -456,6 +456,9 @@ export default {
456456 asnumber: [{ required: true , message: this .$t (' label.required' ) }]
457457 })
458458 },
459+ isIpRoutingEnabled () {
460+ return !! (this .resource && (this .resource .ip4routing || this .resource .ip6routing ))
461+ },
459462 fetchDomains () {
460463 this .domainsLoading = true
461464 getAPI (' listDomains' , {
@@ -474,7 +477,7 @@ export default {
474477 })
475478 },
476479 fetchData () {
477- if (this .resource . ip4routing || this . resource . ip6routing ) {
480+ if (this .isIpRoutingEnabled () ) {
478481 this .bgpPeers = this .resource .bgppeers
479482 } else {
480483 this .fetchZoneBgpPeer ()
0 commit comments