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

nvazquez pushed a commit to branch 4.15
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.15 by this push:
     new 766fc80  ui: fix capitalise filter (#5269)
766fc80 is described below

commit 766fc8031d85509b1f5e5af8a4ba35e25f30d2ae
Author: Abhishek Kumar <[email protected]>
AuthorDate: Fri Aug 6 20:19:12 2021 +0530

    ui: fix capitalise filter (#5269)
    
    filters do not provide reference to global context and hence raise error.
    
    Fixes #5268
    
    Signed-off-by: Abhishek Kumar <[email protected]>
---
 ui/src/views/network/AclListRulesTab.vue            |  1 -
 ui/src/views/network/EgressRulesTab.vue             |  7 +++++--
 ui/src/views/network/FirewallRules.vue              | 12 +++++-------
 ui/src/views/network/IngressEgressRuleConfigure.vue |  7 +++++--
 ui/src/views/network/LoadBalancing.vue              | 12 +++++-------
 ui/src/views/network/PortForwarding.vue             | 12 +++++-------
 6 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/ui/src/views/network/AclListRulesTab.vue 
b/ui/src/views/network/AclListRulesTab.vue
index f59fe1a..7b67675 100644
--- a/ui/src/views/network/AclListRulesTab.vue
+++ b/ui/src/views/network/AclListRulesTab.vue
@@ -243,7 +243,6 @@ export default {
   },
   filters: {
     capitalise: val => {
-      if (val === 'all') return this.$t('label.all')
       return val.toUpperCase()
     }
   },
diff --git a/ui/src/views/network/EgressRulesTab.vue 
b/ui/src/views/network/EgressRulesTab.vue
index 6823a0b..a03ff84 100644
--- a/ui/src/views/network/EgressRulesTab.vue
+++ b/ui/src/views/network/EgressRulesTab.vue
@@ -69,7 +69,7 @@
       :pagination="false"
       :rowKey="record => record.id">
       <template slot="protocol" slot-scope="record">
-        {{ record.protocol | capitalise }}
+        {{ getCapitalise(record.protocol) }}
       </template>
       <template slot="startport" slot-scope="record">
         {{ record.icmptype || record.startport >= 0 ? record.icmptype || 
record.startport : 'All' }}
@@ -165,7 +165,6 @@ export default {
   },
   filters: {
     capitalise: val => {
-      if (val === 'all') return this.$t('label.all')
       return val.toUpperCase()
     }
   },
@@ -193,6 +192,10 @@ export default {
         this.loading = false
       })
     },
+    getCapitalise (val) {
+      if (val === 'all') return this.$t('label.all')
+      return val.toUpperCase()
+    },
     deleteRule (rule) {
       this.loading = true
       api('deleteEgressFirewallRule', { id: rule.id }).then(response => {
diff --git a/ui/src/views/network/FirewallRules.vue 
b/ui/src/views/network/FirewallRules.vue
index 0aac4ad..3122b0d 100644
--- a/ui/src/views/network/FirewallRules.vue
+++ b/ui/src/views/network/FirewallRules.vue
@@ -64,7 +64,7 @@
       :pagination="false"
       :rowKey="record => record.id">
       <template slot="protocol" slot-scope="record">
-        {{ record.protocol | capitalise }}
+        {{ getCapitalise(record.protocol) }}
       </template>
       <template slot="startport" slot-scope="record">
         {{ record.icmptype || record.startport >= 0 ? record.icmptype || 
record.startport : $t('label.all') }}
@@ -205,12 +205,6 @@ export default {
   created () {
     this.fetchData()
   },
-  filters: {
-    capitalise: val => {
-      if (val === 'all') return 'All'
-      return val.toUpperCase()
-    }
-  },
   watch: {
     resource: function (newItem, oldItem) {
       if (!newItem || !newItem.id) {
@@ -237,6 +231,10 @@ export default {
         this.loading = false
       })
     },
+    getCapitalise (val) {
+      if (val === 'all') return this.$t('label.all')
+      return val.toUpperCase()
+    },
     deleteRule (rule) {
       this.loading = true
       api('deleteFirewallRule', { id: rule.id }).then(response => {
diff --git a/ui/src/views/network/IngressEgressRuleConfigure.vue 
b/ui/src/views/network/IngressEgressRuleConfigure.vue
index c513404..9faa7b4 100644
--- a/ui/src/views/network/IngressEgressRuleConfigure.vue
+++ b/ui/src/views/network/IngressEgressRuleConfigure.vue
@@ -90,7 +90,7 @@
       :pagination="{ pageSizeOptions: ['10', '20', '40', '80', '100', '200'], 
showSizeChanger: true}"
       :rowKey="record => record.ruleid">
       <template slot="protocol" slot-scope="record">
-        {{ record.protocol | capitalise }}
+        {{ getCapitalise(record.protocol) }}
       </template>
       <template slot="account" slot-scope="record">
         <div v-if="record.account && record.securitygroupname">
@@ -261,7 +261,6 @@ export default {
   },
   filters: {
     capitalise: val => {
-      if (val === 'all') return this.$t('label.all')
       return val.toUpperCase()
     }
   },
@@ -273,6 +272,10 @@ export default {
       this.tabType = this.$parent.tab === this.$t('label.ingress.rule') ? 
'ingress' : 'egress'
       this.rules = this.tabType === 'ingress' ? this.resource.ingressrule : 
this.resource.egressrule
     },
+    getCapitalise (val) {
+      if (val === 'all') return this.$t('label.all')
+      return val.toUpperCase()
+    },
     handleAddRule () {
       this.parentToggleLoading()
       api(this.tabType === 'ingress' ? 'authorizeSecurityGroupIngress' : 
'authorizeSecurityGroupEgress', {
diff --git a/ui/src/views/network/LoadBalancing.vue 
b/ui/src/views/network/LoadBalancing.vue
index 66dd0d8..c47ec47 100644
--- a/ui/src/views/network/LoadBalancing.vue
+++ b/ui/src/views/network/LoadBalancing.vue
@@ -75,7 +75,7 @@
         {{ returnAlgorithmName(record.algorithm) }}
       </template>
       <template slot="protocol" slot-scope="record">
-        {{ record.protocol | capitalise }}
+        {{ getCapitalise(record.protocol) }}
       </template>
       <template slot="stickiness" slot-scope="record">
         <a-button @click="() => openStickinessModal(record.id)">
@@ -535,12 +535,6 @@ export default {
       this.fetchData()
     }
   },
-  filters: {
-    capitalise: val => {
-      if (val === 'all') return this.$t('label.all')
-      return val.toUpperCase()
-    }
-  },
   methods: {
     fetchData () {
       this.fetchListTiers()
@@ -639,6 +633,10 @@ export default {
       }
       return 'Configure'
     },
+    getCapitalise (val) {
+      if (val === 'all') return this.$t('label.all')
+      return val.toUpperCase()
+    },
     openTagsModal (id) {
       this.tagsModalLoading = true
       this.tagsModalVisible = true
diff --git a/ui/src/views/network/PortForwarding.vue 
b/ui/src/views/network/PortForwarding.vue
index 1808309..14afb77 100644
--- a/ui/src/views/network/PortForwarding.vue
+++ b/ui/src/views/network/PortForwarding.vue
@@ -87,7 +87,7 @@
         {{ record.publicport }} - {{ record.publicendport }}
       </template>
       <template slot="protocol" slot-scope="record">
-        {{ record.protocol | capitalise }}
+        {{ getCapitalise(record.protocol) }}
       </template>
       <template slot="vm" slot-scope="record">
         <div><a-icon type="desktop"/>
@@ -381,12 +381,6 @@ export default {
       this.fetchData()
     }
   },
-  filters: {
-    capitalise: val => {
-      if (val === 'all') return this.$t('label.all')
-      return val.toUpperCase()
-    }
-  },
   methods: {
     fetchData () {
       this.fetchListTiers()
@@ -429,6 +423,10 @@ export default {
         this.loading = false
       })
     },
+    getCapitalise (val) {
+      if (val === 'all') return this.$t('label.all')
+      return val.toUpperCase()
+    },
     deleteRule (rule) {
       this.loading = true
       api('deletePortForwardingRule', { id: rule.id }).then(response => {

Reply via email to