UI - Add Network: shows "Offering for Isolated networks with no Source Nat service" on Network Offering for normal users (#5904)

* shows "Offering for Isolated networks with no Source Nat service" for normal users

* fixes roles

* fix selected tabs
This commit is contained in:
Hoang Nguyen 2022-02-09 15:43:31 +07:00 committed by GitHub
parent ce81a8e708
commit b275c29709
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -344,7 +344,6 @@ export default {
var params = {
zoneid: this.selectedZone.id,
guestiptype: 'Isolated',
supportedServices: 'SourceNat',
state: 'Enabled'
}
if (isAdminOrDomainAdmin() && this.selectedDomain.id !== '-1') { // domain is visible only for admins

View File

@ -17,7 +17,7 @@
<template>
<a-spin :spinning="loading" class="form-layout">
<a-tabs defaultActiveKey="1" :animated="false" v-if="!loading">
<a-tabs :default-active-key="defaultNetworkTypeTabKey" :animated="false" v-if="!loading">
<a-tab-pane :tab="$t('label.isolated')" key="1" v-if="isAdvancedZoneWithoutSGAvailable">
<CreateIsolatedNetworkForm
:loading="loading"
@ -68,7 +68,7 @@ export default {
},
data () {
return {
isAdvancedZoneWithoutSGAvailable: true,
isAdvancedZoneWithoutSGAvailable: false,
defaultNetworkTypeTabKey: '1',
loading: false,
actionZones: [],
@ -79,14 +79,17 @@ export default {
const promises = []
promises.push(this.fetchActionZoneData())
Promise.all(promises).then(() => {
this.isAdvancedZoneWithoutSGAvailable = false
this.defaultNetworkTypeTabKey = '2'
for (const i in this.actionZones) {
const zone = this.actionZones[i]
if (zone.networktype === 'Advanced' && zone.securitygroupsenabled !== true) {
this.isAdvancedZoneWithoutSGAvailable = true
this.defaultNetworkTypeTabKey = '1'
return
}
}
this.isAdvancedZoneWithoutSGAvailable = false
})
},
methods: {