From 3447c9d0f7f384f0b5443ccbbf79bfcb9291daa9 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 14 Feb 2020 17:31:46 +0530 Subject: [PATCH] fix function scope Signed-off-by: Abhishek Kumar Signed-off-by: Rohit Yadav --- ui/src/views/offering/AddNetworkOffering.vue | 13 ++++++++----- ui/src/views/offering/AddVpcOffering.vue | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ui/src/views/offering/AddNetworkOffering.vue b/ui/src/views/offering/AddNetworkOffering.vue index b84886fd5d2..cd30a22410d 100644 --- a/ui/src/views/offering/AddNetworkOffering.vue +++ b/ui/src/views/offering/AddNetworkOffering.vue @@ -568,6 +568,7 @@ export default { }) }, handleForVpcChange (forVpc) { + var self = this this.forVpc = forVpc this.supportedServices.forEach(function (svc, index) { if (svc === 'Connectivity') { @@ -589,7 +590,7 @@ export default { providers[providerIndex] = provider }) svc.provider = providers - this.supportedServices[index] = svc + self.supportedServices[index] = svc } }) }, @@ -631,11 +632,12 @@ export default { var providers = Object.values(this.selectedServiceProviderMap) this.isVirtualRouterForAtLeastOneService = false this.isVpcVirtualRouterForAtLeastOneService = false + var self = this providers.forEach(function (prvdr, idx) { if (prvdr === 'VirtualRouter') { - this.isVirtualRouterForAtLeastOneService = true - if (this.serviceOfferings.length === 0) { - this.fetchServiceOfferingData() + self.isVirtualRouterForAtLeastOneService = true + if (self.serviceOfferings.length === 0) { + self.fetchServiceOfferingData() } } if (prvdr === 'VpcVirtualRouter') { @@ -652,11 +654,12 @@ export default { console.log(values) var params = {} + var self = this var selectedServices = null var keys = Object.keys(values) var ignoredKeys = ['state', 'status', 'allocationstate', 'forvpc', 'specifyvlan', 'ispublic', 'domainid', 'zoneid', 'egressdefaultpolicy', 'promiscuousmode', 'macaddresschanges', 'forgedtransmits'] keys.forEach(function (key, keyIndex) { - if (this.isSupportedServiceObject(values[key])) { + if (self.isSupportedServiceObject(values[key])) { if (selectedServices == null) { selectedServices = {} } diff --git a/ui/src/views/offering/AddVpcOffering.vue b/ui/src/views/offering/AddVpcOffering.vue index a9259909177..0a3010f87c2 100644 --- a/ui/src/views/offering/AddVpcOffering.vue +++ b/ui/src/views/offering/AddVpcOffering.vue @@ -353,8 +353,9 @@ export default { } var selectedServices = null var keys = Object.keys(values) + var self = this keys.forEach(function (key, keyIndex) { - if (this.isSupportedServiceObject(values[key])) { + if (self.isSupportedServiceObject(values[key])) { if (selectedServices == null) { selectedServices = {} }