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 dc10f6a  network: Add protocol number support for security group rules 
(#429)
dc10f6a is described below

commit dc10f6a1abea94b2db125d121c968ade652e766d
Author: Hoang Nguyen <[email protected]>
AuthorDate: Wed Jun 17 17:23:28 2020 +0700

    network: Add protocol number support for security group rules (#429)
    
    Fixes #406
---
 src/views/network/IngressEgressRuleConfigure.vue | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/views/network/IngressEgressRuleConfigure.vue 
b/src/views/network/IngressEgressRuleConfigure.vue
index c078f7c..52bcb89 100644
--- a/src/views/network/IngressEgressRuleConfigure.vue
+++ b/src/views/network/IngressEgressRuleConfigure.vue
@@ -34,6 +34,8 @@
             <a-select-option value="tcp">{{ $t('label.tcp') | capitalise 
}}</a-select-option>
             <a-select-option value="udp">{{ $t('label.udp') | capitalise 
}}</a-select-option>
             <a-select-option value="icmp">{{ $t('label.icmp') | capitalise 
}}</a-select-option>
+            <a-select-option value="all">{{ $t('label.all') | capitalise 
}}</a-select-option>
+            <a-select-option value="protocolnumber">{{ 
$t('label.protocol.number') | capitalise }}</a-select-option>
           </a-select>
         </div>
         <div v-show="newRule.protocol === 'tcp' || newRule.protocol === 'udp'" 
class="form__item">
@@ -44,6 +46,10 @@
           <div class="form__label">{{ $t('label.endport') }}</div>
           <a-input v-model="newRule.endport"></a-input>
         </div>
+        <div v-show="newRule.protocol === 'protocolnumber'" class="form__item">
+          <div class="form__label">{{ $t('label.protocol.number') }}</div>
+          <a-input v-model="newRule.protocolnumber"></a-input>
+        </div>
         <div v-show="newRule.protocol === 'icmp'" class="form__item">
           <div class="form__label">{{ $t('label.icmptype') }}</div>
           <a-input v-model="newRule.icmptype"></a-input>
@@ -84,6 +90,14 @@
           {{ record.account }} - {{ record.securitygroupname }}
         </div>
       </template>
+      <template slot="startport" slot-scope="text, record">
+        <div v-if="!['tcp', 'udp', 'icmp'].includes(record.protocol)">{{ 
$t('label.all') }}</div>
+        <div v-else>{{ text }}</div>
+      </template>
+      <template slot="endport" slot-scope="text, record">
+        <div v-if="!['tcp', 'udp', 'icmp'].includes(record.protocol)">{{ 
$t('label.all') }}</div>
+        <div v-else>{{ text }}</div>
+      </template>
       <template slot="actions" slot-scope="record">
         <a-button shape="circle" icon="tag" class="rule-action" @click="() => 
openTagsModal(record)" />
         <a-popconfirm
@@ -153,6 +167,7 @@ export default {
         protocol: 'tcp',
         startport: null,
         endport: null,
+        protocolnumber: null,
         cidrlist: null,
         icmptype: null,
         icmpcode: null,
@@ -179,11 +194,13 @@ export default {
         },
         {
           title: this.$t('label.startport'),
-          dataIndex: 'startport'
+          dataIndex: 'startport',
+          scopedSlots: { customRender: 'startport' }
         },
         {
           title: this.$t('label.endport'),
-          dataIndex: 'endport'
+          dataIndex: 'endport',
+          scopedSlots: { customRender: 'endport' }
         },
         {
           title: 'ICMP Type',
@@ -237,7 +254,7 @@ export default {
         securitygroupid: this.resource.id,
         domainid: this.resource.domainid,
         account: this.resource.account,
-        protocol: this.newRule.protocol,
+        protocol: this.newRule.protocol === 'protocolnumber' ? 
this.newRule.protocolnumber : this.newRule.protocol,
         startport: this.newRule.startport,
         endport: this.newRule.endport,
         cidrlist: this.newRule.cidrlist,

Reply via email to