ui: Allow edit source CIDR on load balancer rule (#11766)

This commit is contained in:
CodeBleu 2025-10-14 02:30:28 -04:00 committed by GitHub
parent 5e7ae227d3
commit c9ce6e305c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 37 additions and 3 deletions

View File

@ -365,7 +365,10 @@ public class CommandSetupHelper {
final List<LbDestination> destinations = rule.getDestinations();
final List<LbStickinessPolicy> stickinessPolicies = rule.getStickinessPolicies();
final LoadBalancerTO lb = new LoadBalancerTO(uuid, srcIp, srcPort, protocol, algorithm, revoked, false, inline, destinations, stickinessPolicies);
lb.setCidrList(rule.getCidrList());
String cidrList = rule.getCidrList();
if (cidrList != null && !cidrList.isEmpty()) {
lb.setCidrList(String.join(" ", cidrList.split(",")));
}
lb.setLbProtocol(lb_protocol);
lb.setLbSslCert(rule.getLbSslCert());
lbs[i++] = lb;

View File

@ -451,6 +451,22 @@
<a-select-option value="ssl" :label="$t('label.ssl')">{{ $t('label.ssl') }}</a-select-option>
</a-select>
</div>
<div v-if="lbProvider !== 'Netris'" class="edit-rule__item">
<p class="edit-rule__label">
{{ $t('label.sourcecidrlist') }}
<tooltip-label
:title="''"
bold
:tooltip="createLoadBalancerRuleParams.cidrlist.description || 'Enter a comma-separated list of CIDR blocks.'"
:tooltip-placement="'right'"
style="display: inline; margin-left: 5px;"
/>
</p>
<a-input
v-model:value="editRuleDetails.cidrlist"
:placeholder="$t('label.sourcecidrlist')"
/>
</div>
<div :span="24" class="action-button">
<a-button @click="() => editRuleModalVisible = false">{{ $t('label.cancel') }}</a-button>
<a-button type="primary" @click="handleSubmitEditForm">{{ $t('label.ok') }}</a-button>
@ -837,7 +853,8 @@ export default {
editRuleDetails: {
name: '',
algorithm: '',
protocol: ''
protocol: '',
cidrlist: ''
},
newRule: {
algorithm: 'roundrobin',
@ -1625,14 +1642,28 @@ export default {
this.editRuleDetails.name = this.selectedRule.name
this.editRuleDetails.algorithm = this.lbProvider !== 'Netris' ? this.selectedRule.algorithm : undefined
this.editRuleDetails.protocol = this.selectedRule.protocol
// Normalize cidrlist: replace spaces with commas and clean up
this.editRuleDetails.cidrlist = (this.selectedRule.cidrlist || '')
.split(/[\s,]+/) // Split on spaces or commas
.map(c => c.trim())
.filter(c => c)
.join(',') || ''
},
handleSubmitEditForm () {
if (this.editRuleModalLoading) return
this.loading = true
this.editRuleModalLoading = true
const payload = {
...this.editRuleDetails,
id: this.selectedRule.id,
...(this.editRuleDetails.cidrlist && {
cidrList: (this.editRuleDetails.cidrlist || '').split(',').map(c => c.trim()).filter(c => c)
})
}
postAPI('updateLoadBalancerRule', {
...this.editRuleDetails,
id: this.selectedRule.id
id: this.selectedRule.id,
...payload
}).then(response => {
this.$pollJob({
jobId: response.updateloadbalancerruleresponse.jobid,