Skip to content

Commit 766fc80

Browse files
authored
ui: fix capitalise filter (#5269)
filters do not provide reference to global context and hence raise error. Fixes #5268 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent d8c407d commit 766fc80

6 files changed

Lines changed: 25 additions & 26 deletions

File tree

ui/src/views/network/AclListRulesTab.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ export default {
243243
},
244244
filters: {
245245
capitalise: val => {
246-
if (val === 'all') return this.$t('label.all')
247246
return val.toUpperCase()
248247
}
249248
},

ui/src/views/network/EgressRulesTab.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
:pagination="false"
7070
:rowKey="record => record.id">
7171
<template slot="protocol" slot-scope="record">
72-
{{ record.protocol | capitalise }}
72+
{{ getCapitalise(record.protocol) }}
7373
</template>
7474
<template slot="startport" slot-scope="record">
7575
{{ record.icmptype || record.startport >= 0 ? record.icmptype || record.startport : 'All' }}
@@ -165,7 +165,6 @@ export default {
165165
},
166166
filters: {
167167
capitalise: val => {
168-
if (val === 'all') return this.$t('label.all')
169168
return val.toUpperCase()
170169
}
171170
},
@@ -193,6 +192,10 @@ export default {
193192
this.loading = false
194193
})
195194
},
195+
getCapitalise (val) {
196+
if (val === 'all') return this.$t('label.all')
197+
return val.toUpperCase()
198+
},
196199
deleteRule (rule) {
197200
this.loading = true
198201
api('deleteEgressFirewallRule', { id: rule.id }).then(response => {

ui/src/views/network/FirewallRules.vue

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
:pagination="false"
6565
:rowKey="record => record.id">
6666
<template slot="protocol" slot-scope="record">
67-
{{ record.protocol | capitalise }}
67+
{{ getCapitalise(record.protocol) }}
6868
</template>
6969
<template slot="startport" slot-scope="record">
7070
{{ record.icmptype || record.startport >= 0 ? record.icmptype || record.startport : $t('label.all') }}
@@ -205,12 +205,6 @@ export default {
205205
created () {
206206
this.fetchData()
207207
},
208-
filters: {
209-
capitalise: val => {
210-
if (val === 'all') return 'All'
211-
return val.toUpperCase()
212-
}
213-
},
214208
watch: {
215209
resource: function (newItem, oldItem) {
216210
if (!newItem || !newItem.id) {
@@ -237,6 +231,10 @@ export default {
237231
this.loading = false
238232
})
239233
},
234+
getCapitalise (val) {
235+
if (val === 'all') return this.$t('label.all')
236+
return val.toUpperCase()
237+
},
240238
deleteRule (rule) {
241239
this.loading = true
242240
api('deleteFirewallRule', { id: rule.id }).then(response => {

ui/src/views/network/IngressEgressRuleConfigure.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
:pagination="{ pageSizeOptions: ['10', '20', '40', '80', '100', '200'], showSizeChanger: true}"
9191
:rowKey="record => record.ruleid">
9292
<template slot="protocol" slot-scope="record">
93-
{{ record.protocol | capitalise }}
93+
{{ getCapitalise(record.protocol) }}
9494
</template>
9595
<template slot="account" slot-scope="record">
9696
<div v-if="record.account && record.securitygroupname">
@@ -261,7 +261,6 @@ export default {
261261
},
262262
filters: {
263263
capitalise: val => {
264-
if (val === 'all') return this.$t('label.all')
265264
return val.toUpperCase()
266265
}
267266
},
@@ -273,6 +272,10 @@ export default {
273272
this.tabType = this.$parent.tab === this.$t('label.ingress.rule') ? 'ingress' : 'egress'
274273
this.rules = this.tabType === 'ingress' ? this.resource.ingressrule : this.resource.egressrule
275274
},
275+
getCapitalise (val) {
276+
if (val === 'all') return this.$t('label.all')
277+
return val.toUpperCase()
278+
},
276279
handleAddRule () {
277280
this.parentToggleLoading()
278281
api(this.tabType === 'ingress' ? 'authorizeSecurityGroupIngress' : 'authorizeSecurityGroupEgress', {

ui/src/views/network/LoadBalancing.vue

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
{{ returnAlgorithmName(record.algorithm) }}
7676
</template>
7777
<template slot="protocol" slot-scope="record">
78-
{{ record.protocol | capitalise }}
78+
{{ getCapitalise(record.protocol) }}
7979
</template>
8080
<template slot="stickiness" slot-scope="record">
8181
<a-button @click="() => openStickinessModal(record.id)">
@@ -535,12 +535,6 @@ export default {
535535
this.fetchData()
536536
}
537537
},
538-
filters: {
539-
capitalise: val => {
540-
if (val === 'all') return this.$t('label.all')
541-
return val.toUpperCase()
542-
}
543-
},
544538
methods: {
545539
fetchData () {
546540
this.fetchListTiers()
@@ -639,6 +633,10 @@ export default {
639633
}
640634
return 'Configure'
641635
},
636+
getCapitalise (val) {
637+
if (val === 'all') return this.$t('label.all')
638+
return val.toUpperCase()
639+
},
642640
openTagsModal (id) {
643641
this.tagsModalLoading = true
644642
this.tagsModalVisible = true

ui/src/views/network/PortForwarding.vue

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
{{ record.publicport }} - {{ record.publicendport }}
8888
</template>
8989
<template slot="protocol" slot-scope="record">
90-
{{ record.protocol | capitalise }}
90+
{{ getCapitalise(record.protocol) }}
9191
</template>
9292
<template slot="vm" slot-scope="record">
9393
<div><a-icon type="desktop"/>
@@ -381,12 +381,6 @@ export default {
381381
this.fetchData()
382382
}
383383
},
384-
filters: {
385-
capitalise: val => {
386-
if (val === 'all') return this.$t('label.all')
387-
return val.toUpperCase()
388-
}
389-
},
390384
methods: {
391385
fetchData () {
392386
this.fetchListTiers()
@@ -429,6 +423,10 @@ export default {
429423
this.loading = false
430424
})
431425
},
426+
getCapitalise (val) {
427+
if (val === 'all') return this.$t('label.all')
428+
return val.toUpperCase()
429+
},
432430
deleteRule (rule) {
433431
this.loading = true
434432
api('deletePortForwardingRule', { id: rule.id }).then(response => {

0 commit comments

Comments
 (0)