Skip to content

Commit

Permalink
Support for parameter cidrlist added to the UI (#6869)
Browse files Browse the repository at this point in the history
Co-authored-by: João Jandre <[email protected]>
  • Loading branch information
JoaoJandre and João Jandre committed Dec 20, 2022
1 parent cc676cb commit 440d780
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 11 deletions.
3 changes: 3 additions & 0 deletions ui/src/components/view/BulkActionProgress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
<template #vm="{record}">
<div><desktop-outlined /> {{ record.virtualmachinename }} ({{ record.vmguestip }})</div>
</template>
<template #cidrlist="{ record }">
<span style="white-space: pre-line"> {{ record.cidrlist.replaceAll(" ", "\n") }}</span>
</template>
</a-table>
<br/>
</div>
Expand Down
13 changes: 7 additions & 6 deletions ui/src/components/view/BulkActionView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
<template #endport="{record}">
{{ record.icmpcode || record.endport >= 0 ? record.icmpcode || record.endport : $t('label.all') }}
</template>
<template #cidrlist="{record}">
<span style="white-space: pre-line"> {{ record.cidrlist.replaceAll(" ", "\n") }}</span>
</template>
</a-table>
<a-divider />
<br/>
Expand Down Expand Up @@ -149,12 +152,6 @@ export default {
default: () => {}
}
},
filters: {
capitalise: val => {
if (val === 'all') return 'All'
return val.toUpperCase()
}
},
inject: ['parentFetchData'],
data () {
return {
Expand All @@ -164,6 +161,10 @@ export default {
}
},
methods: {
capitalise (val) {
if (val === 'all') return 'All'
return val.toUpperCase()
},
handleCancel () {
this.$emit('handle-cancel')
},
Expand Down
10 changes: 8 additions & 2 deletions ui/src/components/widgets/TooltipLabel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@

<template>
<span>
{{ title }}
<b v-if="bold">
{{ title }}
</b>
<span v-else>
{{ title }}
</span>
<a-tooltip v-if="tooltip" :title="tooltip" :placement="tooltipPlacement">
<info-circle-outlined class="tooltip-icon" />
</a-tooltip>
Expand All @@ -40,7 +45,8 @@ export default {
tooltipPlacement: {
type: String,
default: 'top'
}
},
bold: Boolean
}
}
</script>
Expand Down
24 changes: 21 additions & 3 deletions ui/src/views/network/LoadBalancing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
</div>
</div>
<div class="form">
<div class="form__item" ref="newCidrList">
<tooltip-label :title="$t('label.cidrlist')" bold :tooltip="createLoadBalancerRuleParams.cidrlist.description" :tooltip-placement="'right'"/>
<a-input v-model:value="newRule.cidrlist"></a-input>
</div>
<div class="form__item">
<div class="form__label">{{ $t('label.algorithm') }}</div>
<a-select
Expand Down Expand Up @@ -114,6 +118,9 @@
:pagination="false"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
:rowKey="record => record.id">
<template #cidrlist="{ record }">
<span style="white-space: pre-line"> {{ record.cidrlist.replaceAll(" ", "\n") }}</span>
</template>
<template #algorithm="{ record }">
{{ returnAlgorithmName(record.algorithm) }}
</template>
Expand Down Expand Up @@ -532,14 +539,16 @@ import Status from '@/components/widgets/Status'
import TooltipButton from '@/components/widgets/TooltipButton'
import BulkActionView from '@/components/view/BulkActionView'
import eventBus from '@/config/eventBus'
import TooltipLabel from '@/components/widgets/TooltipLabel'
export default {
name: 'LoadBalancing',
mixins: [mixinForm],
components: {
Status,
TooltipButton,
BulkActionView
BulkActionView,
TooltipLabel
},
props: {
resource: {
Expand Down Expand Up @@ -586,7 +595,8 @@ export default {
publicport: '',
protocol: 'tcp',
virtualmachineid: [],
vmguestip: []
vmguestip: [],
cidrlist: ''
},
addVmModalVisible: false,
addVmModalLoading: false,
Expand All @@ -609,6 +619,10 @@ export default {
title: this.$t('label.privateport'),
dataIndex: 'privateport'
},
{
title: this.$t('label.cidrlist'),
slots: { customRender: 'cidrlist' }
},
{
title: this.$t('label.algorithm'),
slots: { customRender: 'algorithm' }
Expand Down Expand Up @@ -684,6 +698,9 @@ export default {
return this.selectedRowKeys.length > 0
}
},
beforeCreate () {
this.createLoadBalancerRuleParams = this.$getApiParams('createLoadBalancerRule')
},
created () {
this.initForm()
this.fetchData()
Expand Down Expand Up @@ -1403,7 +1420,8 @@ export default {
name: this.newRule.name,
privateport: this.newRule.privateport,
protocol: this.newRule.protocol,
publicport: this.newRule.publicport
publicport: this.newRule.publicport,
cidrlist: this.newRule.cidrlist
}).then(response => {
this.addVmModalVisible = false
this.handleAssignToLBRule(response.createloadbalancerruleresponse.id)
Expand Down

0 comments on commit 440d780

Please sign in to comment.