Skip to content

Commit

Permalink
feat(dedicated.ip): select multiple countries for block ip
Browse files Browse the repository at this point in the history
ref: MANAGER-14569

Signed-off-by: Sachin Ramesh <[email protected]>
  • Loading branch information
sachinrameshn committed Sep 25, 2024
1 parent efc5ef3 commit 27e6f2d
Showing 1 changed file with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,17 @@ export default class AgoraIpV4OrderController {
)?.labels;
}

static getCountriesFromDatacenter(selectedServiceDatacenter, ipOffers) {
const ipOffer = ipOffers.find((offer) => {
return offer.details.product.configurations
.find((config) => config.name === 'datacenter')
?.values?.includes(selectedServiceDatacenter);
});
return ipOffer.details.product.configurations.find(
(config) => config.name === 'country',
)?.values;
}

loadPrivateCloudIpOffers(serviceName) {
const countries = this.orderableIpCountries.map((code) => {
return {
Expand Down Expand Up @@ -392,9 +403,15 @@ export default class AgoraIpV4OrderController {
get(this.model, 'selectedService.serviceName'),
);
} else if (this.isParkingIp) {
const countries = [
// Country for Single IP selection in parking
const country = [
DATACENTER_TO_COUNTRY[this.model.selectedRegion.datacenter],
];
// Multiple countries are available for block IP selection in parking and vrack
const countries = AgoraIpV4OrderController.getCountriesFromDatacenter(
this.model.selectedRegion.datacenter,
this.parkingIpOffers,
).map((value) => value.toLowerCase());
const ipOfferDetails = this.parkingIpOffers.map(
this.createOfferDto.bind(this),
);
Expand All @@ -414,7 +431,7 @@ export default class AgoraIpV4OrderController {
this.failoverIpOffers = this.getOfferDetails(
failoverIpOfferDetails,
ipOffersByDatacenter,
countries,
country,
);
this.blockIpOffers = this.getOfferDetails(
blockIpOfferDetails,
Expand Down

0 comments on commit 27e6f2d

Please sign in to comment.