Skip to content

Commit 504e267

Browse files
João JandreJoaoJandre
authored andcommitted
Support for parameter cidrlist added to the UI
1 parent fa39e61 commit 504e267

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
@@ -93,6 +97,9 @@
9397
:pagination="false"
9498
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
9599
:rowKey="record => record.id">
100+
<template #cidrlist="{ record }">
101+
<span style="white-space: pre-line"> {{ record.cidrlist.replaceAll(" ", "\n") }}</span>
102+
</template>
96103
<template #algorithm="{ record }">
97104
{{ returnAlgorithmName(record.algorithm) }}
98105
</template>
@@ -500,14 +507,16 @@ import Status from '@/components/widgets/Status'
500507
import TooltipButton from '@/components/widgets/TooltipButton'
501508
import BulkActionView from '@/components/view/BulkActionView'
502509
import eventBus from '@/config/eventBus'
510+
import TooltipLabel from '@/components/widgets/TooltipLabel'
503511
504512
export default {
505513
name: 'LoadBalancing',
506514
mixins: [mixinForm],
507515
components: {
508516
Status,
509517
TooltipButton,
510-
BulkActionView
518+
BulkActionView,
519+
TooltipLabel
511520
},
512521
props: {
513522
resource: {
@@ -554,7 +563,8 @@ export default {
554563
publicport: '',
555564
protocol: 'tcp',
556565
virtualmachineid: [],
557-
vmguestip: []
566+
vmguestip: [],
567+
cidrlist: ''
558568
},
559569
addVmModalVisible: false,
560570
addVmModalLoading: false,
@@ -577,6 +587,10 @@ export default {
577587
title: this.$t('label.privateport'),
578588
dataIndex: 'privateport'
579589
},
590+
{
591+
title: this.$t('label.cidrlist'),
592+
slots: { customRender: 'cidrlist' }
593+
},
580594
{
581595
title: this.$t('label.algorithm'),
582596
slots: { customRender: 'algorithm' }
@@ -648,6 +662,9 @@ export default {
648662
return this.selectedRowKeys.length > 0
649663
}
650664
},
665+
beforeCreate () {
666+
this.createLoadBalancerRuleParams = this.$getApiParams('createLoadBalancerRule')
667+
},
651668
created () {
652669
this.initForm()
653670
this.fetchData()
@@ -1321,7 +1338,8 @@ export default {
13211338
name: this.newRule.name,
13221339
privateport: this.newRule.privateport,
13231340
protocol: this.newRule.protocol,
1324-
publicport: this.newRule.publicport
1341+
publicport: this.newRule.publicport,
1342+
cidrlist: this.newRule.cidrlist
13251343
}).then(response => {
13261344
this.addVmModalVisible = false
13271345
this.handleAssignToLBRule(response.createloadbalancerruleresponse.id)

0 commit comments

Comments
 (0)