Skip to content

Commit 440d780

Browse files
JoaoJandreJoão Jandre
andauthored
Support for parameter cidrlist added to the UI (#6869)
Co-authored-by: João Jandre <joao@scclouds.com.br>
1 parent cc676cb commit 440d780

File tree

4 files changed

+39
-11
lines changed

4 files changed

+39
-11
lines changed

ui/src/components/view/BulkActionProgress.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@
8080
<template #vm="{record}">
8181
<div><desktop-outlined /> {{ record.virtualmachinename }} ({{ record.vmguestip }})</div>
8282
</template>
83+
<template #cidrlist="{ record }">
84+
<span style="white-space: pre-line"> {{ record.cidrlist.replaceAll(" ", "\n") }}</span>
85+
</template>
8386
</a-table>
8487
<br/>
8588
</div>

ui/src/components/view/BulkActionView.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@
8282
<template #endport="{record}">
8383
{{ record.icmpcode || record.endport >= 0 ? record.icmpcode || record.endport : $t('label.all') }}
8484
</template>
85+
<template #cidrlist="{record}">
86+
<span style="white-space: pre-line"> {{ record.cidrlist.replaceAll(" ", "\n") }}</span>
87+
</template>
8588
</a-table>
8689
<a-divider />
8790
<br/>
@@ -149,12 +152,6 @@ export default {
149152
default: () => {}
150153
}
151154
},
152-
filters: {
153-
capitalise: val => {
154-
if (val === 'all') return 'All'
155-
return val.toUpperCase()
156-
}
157-
},
158155
inject: ['parentFetchData'],
159156
data () {
160157
return {
@@ -164,6 +161,10 @@ export default {
164161
}
165162
},
166163
methods: {
164+
capitalise (val) {
165+
if (val === 'all') return 'All'
166+
return val.toUpperCase()
167+
},
167168
handleCancel () {
168169
this.$emit('handle-cancel')
169170
},

ui/src/components/widgets/TooltipLabel.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717

1818
<template>
1919
<span>
20-
{{ title }}
20+
<b v-if="bold">
21+
{{ title }}
22+
</b>
23+
<span v-else>
24+
{{ title }}
25+
</span>
2126
<a-tooltip v-if="tooltip" :title="tooltip" :placement="tooltipPlacement">
2227
<info-circle-outlined class="tooltip-icon" />
2328
</a-tooltip>
@@ -40,7 +45,8 @@ export default {
4045
tooltipPlacement: {
4146
type: String,
4247
default: 'top'
43-
}
48+
},
49+
bold: Boolean
4450
}
4551
}
4652
</script>

ui/src/views/network/LoadBalancing.vue

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
</div>
3737
</div>
3838
<div class="form">
39+
<div class="form__item" ref="newCidrList">
40+
<tooltip-label :title="$t('label.cidrlist')" bold :tooltip="createLoadBalancerRuleParams.cidrlist.description" :tooltip-placement="'right'"/>
41+
<a-input v-model:value="newRule.cidrlist"></a-input>
42+
</div>
3943
<div class="form__item">
4044
<div class="form__label">{{ $t('label.algorithm') }}</div>
4145
<a-select
@@ -114,6 +118,9 @@
114118
:pagination="false"
115119
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
116120
:rowKey="record => record.id">
121+
<template #cidrlist="{ record }">
122+
<span style="white-space: pre-line"> {{ record.cidrlist.replaceAll(" ", "\n") }}</span>
123+
</template>
117124
<template #algorithm="{ record }">
118125
{{ returnAlgorithmName(record.algorithm) }}
119126
</template>
@@ -532,14 +539,16 @@ import Status from '@/components/widgets/Status'
532539
import TooltipButton from '@/components/widgets/TooltipButton'
533540
import BulkActionView from '@/components/view/BulkActionView'
534541
import eventBus from '@/config/eventBus'
542+
import TooltipLabel from '@/components/widgets/TooltipLabel'
535543
536544
export default {
537545
name: 'LoadBalancing',
538546
mixins: [mixinForm],
539547
components: {
540548
Status,
541549
TooltipButton,
542-
BulkActionView
550+
BulkActionView,
551+
TooltipLabel
543552
},
544553
props: {
545554
resource: {
@@ -586,7 +595,8 @@ export default {
586595
publicport: '',
587596
protocol: 'tcp',
588597
virtualmachineid: [],
589-
vmguestip: []
598+
vmguestip: [],
599+
cidrlist: ''
590600
},
591601
addVmModalVisible: false,
592602
addVmModalLoading: false,
@@ -609,6 +619,10 @@ export default {
609619
title: this.$t('label.privateport'),
610620
dataIndex: 'privateport'
611621
},
622+
{
623+
title: this.$t('label.cidrlist'),
624+
slots: { customRender: 'cidrlist' }
625+
},
612626
{
613627
title: this.$t('label.algorithm'),
614628
slots: { customRender: 'algorithm' }
@@ -684,6 +698,9 @@ export default {
684698
return this.selectedRowKeys.length > 0
685699
}
686700
},
701+
beforeCreate () {
702+
this.createLoadBalancerRuleParams = this.$getApiParams('createLoadBalancerRule')
703+
},
687704
created () {
688705
this.initForm()
689706
this.fetchData()
@@ -1403,7 +1420,8 @@ export default {
14031420
name: this.newRule.name,
14041421
privateport: this.newRule.privateport,
14051422
protocol: this.newRule.protocol,
1406-
publicport: this.newRule.publicport
1423+
publicport: this.newRule.publicport,
1424+
cidrlist: this.newRule.cidrlist
14071425
}).then(response => {
14081426
this.addVmModalVisible = false
14091427
this.handleAssignToLBRule(response.createloadbalancerruleresponse.id)

0 commit comments

Comments
 (0)