diff --git a/ui/src/views/offering/AddVpcOffering.vue b/ui/src/views/offering/AddVpcOffering.vue index 03b7288232d..9b9d576517f 100644 --- a/ui/src/views/offering/AddVpcOffering.vue +++ b/ui/src/views/offering/AddVpcOffering.vue @@ -94,6 +94,29 @@ + + + + + + + + {{ opt.name || opt.description }} + + + @@ -189,6 +212,9 @@ export default { loading: false, supportedServices: [], supportedServiceLoading: false, + serviceOfferings: [], + serviceOfferingLoading: false, + isVpcVirtualRouterForAtLeastOneService: false, connectivityServiceChecked: false, sourceNatServiceChecked: false, selectedServiceProviderMap: {}, @@ -366,6 +392,29 @@ export default { } else { delete this.selectedServiceProviderMap[service] } + this.isVpcVirtualRouterForAtLeastOneService = false + const providers = Object.values(this.selectedServiceProviderMap) + const self = this + providers.forEach(function (prvdr, idx) { + if (prvdr === 'VpcVirtualRouter') { + self.isVpcVirtualRouterForAtLeastOneService = true + } + }) + if (this.isVpcVirtualRouterForAtLeastOneService && this.serviceOfferings.length === 0) { + this.fetchServiceOfferingData() + } + }, + fetchServiceOfferingData () { + const params = {} + params.issystem = true + params.systemvmtype = 'domainrouter' + this.serviceOfferingLoading = true + api('listServiceOfferings', params).then(json => { + const listServiceOfferings = json.listserviceofferingsresponse.serviceoffering + this.serviceOfferings = this.serviceOfferings.concat(listServiceOfferings) + }).finally(() => { + this.serviceOfferingLoading = false + }) }, handleSubmit (e) { e.preventDefault() @@ -433,6 +482,9 @@ export default { params['serviceCapabilityList[' + serviceCapabilityIndex + '].capabilityvalue'] = true serviceCapabilityIndex++ } + if (values.serviceofferingid && this.isVpcVirtualRouterForAtLeastOneService) { + params.serviceofferingid = values.serviceofferingid + } } else { params.supportedservices = '' }