@@ -146,26 +146,24 @@ export default {
146146 // VPC IPs don't have firewall
147147 const tabs = this .$route .meta .tabs .filter (tab => tab .name !== ' firewall' )
148148
149- console . log ( this .resource . networkofferingconservemode )
150- if (this . resource .networkofferingconservemode ) {
149+ const network = await this .fetchNetwork ( )
150+ if (network && network .networkofferingconservemode ) {
151151 this .tabs = tabs
152152 return
153153 }
154154
155155 this .portFWRuleCount = await this .fetchPortFWRule ()
156156 this .loadBalancerRuleCount = await this .fetchLoadBalancerRule ()
157- console .log (this .portFWRuleCount )
158- console .log (this .loadBalancerRuleCount )
159157
160158 // VPC IPs with PF only have PF
161- // if (this.portFWRuleCount > 0) {
162- // tabs = tabs.filter(tab => tab.name !== 'loadbalancing')
163- // }
159+ if (this .portFWRuleCount > 0 ) {
160+ tabs = tabs .filter (tab => tab .name !== ' loadbalancing' )
161+ }
164162
165- // // VPC IPs with LB rules only have LB
166- // if (this.loadBalancerRuleCount > 0) {
167- // tabs = tabs.filter(tab => tab.name !== 'portforwarding')
168- // }
163+ // VPC IPs with LB rules only have LB
164+ if (this .loadBalancerRuleCount > 0 ) {
165+ tabs = tabs .filter (tab => tab .name !== ' portforwarding' )
166+ }
169167 this .tabs = tabs
170168 return
171169 }
@@ -189,6 +187,20 @@ export default {
189187 fetchAction () {
190188 this .actions = this .$route .meta .actions || []
191189 },
190+ fetchNetwork () {
191+ return new Promise ((resolve , reject ) => {
192+ api (' listNetworks' , {
193+ listAll: true ,
194+ projectid: this .resource .projectid ,
195+ id: this .resource .associatednetworkid
196+ }).then (json => {
197+ const network = json .listnetworksresponse ? .network ? .[0 ] || null
198+ resolve (network)
199+ }).catch (e => {
200+ reject (e)
201+ })
202+ })
203+ },
192204 fetchPortFWRule () {
193205 return new Promise ((resolve , reject ) => {
194206 api (' listPortForwardingRules' , {
0 commit comments