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>
This commit is contained in:
Abhishek Kumar 2021-08-06 20:19:12 +05:30 committed by GitHub
parent d8c407d94a
commit 766fc8031d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 26 deletions

View File

@ -243,7 +243,6 @@ export default {
},
filters: {
capitalise: val => {
if (val === 'all') return this.$t('label.all')
return val.toUpperCase()
}
},

View File

@ -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 => {

View File

@ -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 => {

View File

@ -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', {

View File

@ -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

View File

@ -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 => {