mirror of https://github.com/apache/cloudstack.git
ui: Allow edit source CIDR on load balancer rule (#11766)
This commit is contained in:
parent
5e7ae227d3
commit
c9ce6e305c
|
|
@ -365,7 +365,10 @@ public class CommandSetupHelper {
|
||||||
final List<LbDestination> destinations = rule.getDestinations();
|
final List<LbDestination> destinations = rule.getDestinations();
|
||||||
final List<LbStickinessPolicy> stickinessPolicies = rule.getStickinessPolicies();
|
final List<LbStickinessPolicy> stickinessPolicies = rule.getStickinessPolicies();
|
||||||
final LoadBalancerTO lb = new LoadBalancerTO(uuid, srcIp, srcPort, protocol, algorithm, revoked, false, inline, destinations, stickinessPolicies);
|
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.setLbProtocol(lb_protocol);
|
||||||
lb.setLbSslCert(rule.getLbSslCert());
|
lb.setLbSslCert(rule.getLbSslCert());
|
||||||
lbs[i++] = lb;
|
lbs[i++] = lb;
|
||||||
|
|
|
||||||
|
|
@ -451,6 +451,22 @@
|
||||||
<a-select-option value="ssl" :label="$t('label.ssl')">{{ $t('label.ssl') }}</a-select-option>
|
<a-select-option value="ssl" :label="$t('label.ssl')">{{ $t('label.ssl') }}</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</div>
|
</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">
|
<div :span="24" class="action-button">
|
||||||
<a-button @click="() => editRuleModalVisible = false">{{ $t('label.cancel') }}</a-button>
|
<a-button @click="() => editRuleModalVisible = false">{{ $t('label.cancel') }}</a-button>
|
||||||
<a-button type="primary" @click="handleSubmitEditForm">{{ $t('label.ok') }}</a-button>
|
<a-button type="primary" @click="handleSubmitEditForm">{{ $t('label.ok') }}</a-button>
|
||||||
|
|
@ -837,7 +853,8 @@ export default {
|
||||||
editRuleDetails: {
|
editRuleDetails: {
|
||||||
name: '',
|
name: '',
|
||||||
algorithm: '',
|
algorithm: '',
|
||||||
protocol: ''
|
protocol: '',
|
||||||
|
cidrlist: ''
|
||||||
},
|
},
|
||||||
newRule: {
|
newRule: {
|
||||||
algorithm: 'roundrobin',
|
algorithm: 'roundrobin',
|
||||||
|
|
@ -1625,14 +1642,28 @@ export default {
|
||||||
this.editRuleDetails.name = this.selectedRule.name
|
this.editRuleDetails.name = this.selectedRule.name
|
||||||
this.editRuleDetails.algorithm = this.lbProvider !== 'Netris' ? this.selectedRule.algorithm : undefined
|
this.editRuleDetails.algorithm = this.lbProvider !== 'Netris' ? this.selectedRule.algorithm : undefined
|
||||||
this.editRuleDetails.protocol = this.selectedRule.protocol
|
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 () {
|
handleSubmitEditForm () {
|
||||||
if (this.editRuleModalLoading) return
|
if (this.editRuleModalLoading) return
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.editRuleModalLoading = 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', {
|
postAPI('updateLoadBalancerRule', {
|
||||||
...this.editRuleDetails,
|
...this.editRuleDetails,
|
||||||
id: this.selectedRule.id
|
id: this.selectedRule.id,
|
||||||
|
...payload
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
this.$pollJob({
|
this.$pollJob({
|
||||||
jobId: response.updateloadbalancerruleresponse.jobid,
|
jobId: response.updateloadbalancerruleresponse.jobid,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue