This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git


The following commit(s) were added to refs/heads/master by this push:
     new dbcd5e8  network: Adding pvlan option for l2 and fixing passing none 
for no pvlan type (#373)
dbcd5e8 is described below

commit dbcd5e8226bb9923dfa29e8410e6e40843894dc6
Author: davidjumani <[email protected]>
AuthorDate: Wed Jun 24 06:24:55 2020 +0000

    network: Adding pvlan option for l2 and fixing passing none for no pvlan 
type (#373)
    
    This adds the option to create PVLAN for L2 networks, as well as fixes the 
issue caused by passing 'none' as the PVLAN type when no secondary VLAN type is 
selected.
---
 src/locales/en.json                           |  4 +--
 src/views/network/CreateL2NetworkForm.vue     | 35 ++++++++++++++++++++++++++-
 src/views/network/CreateSharedNetworkForm.vue | 10 ++++----
 3 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/src/locales/en.json b/src/locales/en.json
index cfc8212..30d8c19 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -1030,8 +1030,8 @@
 "label.isoid": "ISO",
 "label.isolated": "Isolated",
 "label.isolated.networks": "Isolated networks",
-"label.isolatedpvlanid": "Secondary Isolated VLAN ID",
-"label.isolatedpvlantype": "Secondary Isolated VLAN Type",
+"label.isolatedpvlanid": "Secondary VLAN ID",
+"label.isolatedpvlantype": "Secondary VLAN Type",
 "label.isolation.method": "Isolation method",
 "label.isolation.mode": "Isolation Mode",
 "label.isolationmethods": "Isolation method",
diff --git a/src/views/network/CreateL2NetworkForm.vue 
b/src/views/network/CreateL2NetworkForm.vue
index a5abcb9..94fb077 100644
--- a/src/views/network/CreateL2NetworkForm.vue
+++ b/src/views/network/CreateL2NetworkForm.vue
@@ -109,6 +109,32 @@
           <a-form-item :label="$t('label.bypassvlanoverlapcheck')" 
v-if="!this.isObjectEmpty(this.selectedNetworkOffering) && 
this.selectedNetworkOffering.specifyvlan">
             <a-switch v-decorator="['bypassvlanoverlapcheck']" />
           </a-form-item>
+          <a-form-item :label="$t('label.isolatedpvlantype')" 
v-if="!this.isObjectEmpty(this.selectedNetworkOffering) && 
this.selectedNetworkOffering.specifyvlan">
+            <a-radio-group
+              v-decorator="['isolatedpvlantype', {
+                initialValue: this.isolatePvlanType
+              }]"
+              buttonStyle="solid"
+              @change="selected => { this.isolatePvlanType = 
selected.target.value }">
+              <a-radio-button value="none">
+                {{ $t('label.none') }}
+              </a-radio-button>
+              <a-radio-button value="community">
+                {{ $t('label.community') }}
+              </a-radio-button>
+              <a-radio-button value="isolated">
+                {{ $t('label.secondary.isolated.vlan.type.isolated') }}
+              </a-radio-button>
+              <a-radio-button value="promiscuous">
+                {{ $t('label.secondary.isolated.vlan.type.promiscuous') }}
+              </a-radio-button>
+            </a-radio-group>
+          </a-form-item>
+          <a-form-item :label="$t('label.isolatedpvlanid')" 
v-if="this.isolatePvlanType=='community' || this.isolatePvlanType=='isolated'">
+            <a-input
+              v-decorator="['isolatedpvlan', {}]"
+              :placeholder="this.$t('label.isolatedpvlanid')"/>
+          </a-form-item>
           <a-form-item :label="$t('label.account')" v-if="this.accountVisible">
             <a-input
               v-decorator="['account', {
@@ -164,7 +190,8 @@ export default {
       networkOfferings: [],
       networkOfferingLoading: false,
       selectedNetworkOffering: {},
-      accountVisible: this.isAdminOrDomainAdmin()
+      accountVisible: this.isAdminOrDomainAdmin(),
+      isolatePvlanType: 'none'
     }
   },
   beforeCreate () {
@@ -323,6 +350,12 @@ export default {
             params.account = values.account
           }
         }
+        if (this.isValidValueForKey(values, 'isolatedpvlantype') && 
values.isolatedpvlantype !== 'none') {
+          params.isolatedpvlantype = values.isolatedpvlantype
+          if (this.isValidValueForKey(values, 'isolatedpvlan')) {
+            params.isolatedpvlan = values.isolatedpvlan
+          }
+        }
         api('createNetwork', params).then(json => {
           this.$notification.success({
             message: 'Network',
diff --git a/src/views/network/CreateSharedNetworkForm.vue 
b/src/views/network/CreateSharedNetworkForm.vue
index 558ebbb..e92c3f9 100644
--- a/src/views/network/CreateSharedNetworkForm.vue
+++ b/src/views/network/CreateSharedNetworkForm.vue
@@ -86,7 +86,7 @@
           <a-form-item :label="$t('label.bypassvlanoverlapcheck')">
             <a-switch v-decorator="['bypassvlanoverlapcheck']" />
           </a-form-item>
-          <a-form-item :label="$t('label.isolatedpvlantype')">
+          <a-form-item :label="$t('label.isolatedpvlantype')" 
v-if="!this.isObjectEmpty(this.selectedNetworkOffering) && 
this.selectedNetworkOffering.specifyvlan">
             <a-radio-group
               v-decorator="['isolatedpvlantype', {
                 initialValue: this.isolatePvlanType
@@ -589,11 +589,11 @@ export default {
         if (this.isValidValueForKey(values, 'bypassvlanoverlapcheck')) {
           params.bypassvlanoverlapcheck = values.bypassvlanoverlapcheck
         }
-        if (this.isValidValueForKey(values, 'isolatedpvlantype')) {
+        if (this.isValidValueForKey(values, 'isolatedpvlantype') && 
values.isolatedpvlantype !== 'none') {
           params.isolatedpvlantype = values.isolatedpvlantype
-        }
-        if (this.isValidValueForKey(values, 'isolatedpvlan')) {
-          params.isolatedpvlan = values.isolatedpvlan
+          if (this.isValidValueForKey(values, 'isolatedpvlan')) {
+            params.isolatedpvlan = values.isolatedpvlan
+          }
         }
         if (this.scopeType !== 'all') {
           params.domainid = this.selectedDomain.id

Reply via email to