-
Notifications
You must be signed in to change notification settings - Fork 906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(provider/amazon) Enable & fix existing "Create LB" stage #4184
Changes from 4 commits
ad7d3ae
87be22a
ccbc32e
34abccc
5e88807
7225922
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,32 +11,48 @@ class AwsLoadBalancerChoiceCtrl implements IController { | |
|
||
constructor(private $uibModal: any, | ||
private $uibModalInstance: IModalInstanceService, | ||
private application: Application) { | ||
private application: Application, | ||
private loadBalancer: any, | ||
private isNew: boolean, | ||
private forPipelineConfig: boolean) { | ||
'ngInject'; | ||
} | ||
|
||
public $onInit(): void { | ||
this.choices = LoadBalancerTypes; | ||
this.choice = this.choices[0]; | ||
if (this.loadBalancer) { | ||
// If we're editing an existing LB, preset the choice based on config, | ||
const needed_type = this.loadBalancer.loadBalancerType; | ||
this.choice = LoadBalancerTypes.filter(function(el) { | ||
return el.type === needed_type; | ||
})[0]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whole thing can be simplified to: this.choice = LoadBalancerTypes.find(t => t.type === this.loadBalancer.loadBalancerType); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, this will solve the camelcase problem, too, so I'll see if it works. I was having trouble getting the scope to work (or at least, that's what I thought was the problem). |
||
} | ||
} | ||
|
||
public onChoiceSelection(choice: IAwsLoadBalancerConfig): void { | ||
this.choice = choice; | ||
} | ||
|
||
public choose(): void { | ||
this.$uibModalInstance.dismiss(); | ||
this.$uibModal.open({ | ||
templateUrl: this.choice.createTemplateUrl, | ||
controller: `${this.choice.controller} as ctrl`, | ||
size: 'lg', | ||
resolve: { | ||
application: () => this.application, | ||
loadBalancer: (): null => null, | ||
isNew: () => true, | ||
forPipelineConfig: () => false, | ||
} | ||
}); | ||
// NOTE: Can't just dismiss here, pipelineconfig is expecting the | ||
// result of the config to be passed back as a promise from | ||
// the initial modal, which we're closing here... | ||
this.$uibModalInstance.close( | ||
this.$uibModal.open({ | ||
templateUrl: this.choice.createTemplateUrl, | ||
controller: `${this.choice.controller} as ctrl`, | ||
size: 'lg', | ||
resolve: { | ||
application: () => this.application, | ||
loadBalancer: () => this.loadBalancer, | ||
isNew: () => this.isNew || (this.loadBalancer == null), | ||
forPipelineConfig: () => this.forPipelineConfig, | ||
} | ||
}).result.then(function(newLoadBalancer: any) { | ||
return newLoadBalancer; | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this last this.$uibModalInstance.close(
this.$uibModal.open({
templateUrl: this.choice.createTemplateUrl,
controller: `${this.choice.controller} as ctrl`,
size: 'lg',
resolve: {
application: () => this.application,
loadBalancer: () => this.loadBalancer,
isNew: () => this.isNew || (this.loadBalancer == null),
forPipelineConfig: () => this.forPipelineConfig,
}
}).result); (I could be reading this wrong, too) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I went through several permutations (this is my first attempt at doing Angular) so you may be right, I'll try it and see. Definitely cleaner if I can do without. |
||
); | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,21 +134,21 @@ export class AwsLoadBalancerTransformer { | |
isInternal: loadBalancer.isInternal, | ||
region: loadBalancer.region, | ||
cloudProvider: loadBalancer.cloudProvider, | ||
credentials: loadBalancer.account, | ||
listeners: [], | ||
credentials: loadBalancer.credentials, | ||
listeners: loadBalancer.listeners, | ||
loadBalancerType: 'classic', | ||
name: loadBalancer.name, | ||
regionZones: loadBalancer.availabilityZones, | ||
securityGroups: [], | ||
vpcId: undefined, | ||
securityGroups: loadBalancer.securityGroups, | ||
vpcId: loadBalancer.vpcId, | ||
healthCheck: undefined, | ||
healthTimeout: undefined, | ||
healthInterval: undefined, | ||
healthyThreshold: undefined, | ||
unhealthyThreshold: undefined, | ||
healthCheckProtocol: undefined, | ||
healthCheckPort: undefined, | ||
healthCheckPath: undefined, | ||
healthTimeout: loadBalancer.healthTimeout, | ||
healthInterval: loadBalancer.healthInterval, | ||
healthyThreshold: loadBalancer.healthyThreshold, | ||
unhealthyThreshold: loadBalancer.unhealthyThreshold, | ||
healthCheckProtocol: loadBalancer.healthCheckProtocol, | ||
healthCheckPort: loadBalancer.healthCheckPort, | ||
healthCheckPath: loadBalancer.healthCheckPath, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would like @jrsquared to take a look at this part - this seems reasonable to me (and if they're undefined, they'll get set further down in the method) but would like a little more validation from someone who's looked at this code more recently and is more familiar with it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks reasonable to me. I want to pull this down and test it first though. I should have time in the next couple of days. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These need to be set during the edit, or their values aren't carried over from what was previously set (they are set by default when you create the load balancer, so setting them back to undefined here would delete whatever config had been initially saved). |
||
subnetType: loadBalancer.subnetType, | ||
}; | ||
|
||
|
@@ -214,7 +214,7 @@ export class AwsLoadBalancerTransformer { | |
region: loadBalancer.region, | ||
loadBalancerType: 'application', | ||
cloudProvider: loadBalancer.cloudProvider, | ||
credentials: loadBalancer.account, | ||
credentials: loadBalancer.account || loadBalancer.credentials, | ||
listeners: [], | ||
targetGroups: [], | ||
name: loadBalancer.name, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor style nit: we typically use camelCase for variable names.