-
Notifications
You must be signed in to change notification settings - Fork 903
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cf): Map/Unmap LBs and UI cleanup (#6737)
* fix(cf): Map/Unmap LBs and UI cleanup - added 'preventSave' to all required fields in Map / Unmap Load Balancers pipeline stages - corrected pluralization - repaired minor UI glitches in map / unmap - optionality of route fields in mapping / unmapping screens removed - removed some Angular wrapping on map / unmap pipeline stages - repaired minor bugs in AccountRegionClusterSelector in which: a) the region was not being cleared when a new account is selected; and b) the cluster list was not being properly initialized for a new stage when the AccountRegionClusterSelector was specified as single-region - repaired Rollback Cluster Stage, which was not displaying any of its CF-specific fields spinnaker/spinnaker#4146 spinnaker/spinnaker#4147 spinnaker/spinnaker#4169 spinnaker/spinnaker#4171 spinnaker/spinnaker#4172 Co-Authored-By: Stu Pollock <spollock@pivotal.io> * so isRequired doesn't accidentally create an uncontrolled component.
- Loading branch information
1 parent
1c9e075
commit c37500c
Showing
21 changed files
with
207 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
app/scripts/modules/cloudfoundry/src/pipeline/config/validation/requiredRoutes.validator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { get } from 'lodash'; | ||
|
||
import { IPipeline, IStage, IStageOrTriggerValidator, ITrigger, PipelineConfigValidator } from '@spinnaker/core'; | ||
|
||
export class CfRequiredRoutesFieldValidator implements IStageOrTriggerValidator { | ||
public validate(_pipeline: IPipeline, stage: IStage | ITrigger, validationConfig: any): string { | ||
const routes: string[] = get(stage, validationConfig.fieldName); | ||
const routeErrors = routes | ||
.map((route: string) => { | ||
const regex = /^([-\w]+)\.([-.\w]+)(:\d+)?([-/\w]+)?$/gm; | ||
route = route || ''; | ||
if (regex.exec(route) === null) { | ||
return `"${route}" did not match the expected format "host.some.domain[:9999][/some/path]"`; | ||
} | ||
return null; | ||
}) | ||
.filter(err => err != null); | ||
return (routeErrors && routeErrors.length && routeErrors[0]) || null; | ||
} | ||
} | ||
|
||
PipelineConfigValidator.registerValidator('cfRequiredRoutesField', new CfRequiredRoutesFieldValidator()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...ules/cloudfoundry/src/pipeline/stages/destroyService/cloudfoundryDestroyServiceStage.html
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
.../cloudfoundry/src/pipeline/stages/mapLoadBalancers/cloudfoundryMapLoadBalancersStage.html
This file was deleted.
Oops, something went wrong.
65 changes: 19 additions & 46 deletions
65
...dfoundry/src/pipeline/stages/mapLoadBalancers/cloudfoundryMapLoadBalancersStage.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,22 @@ | ||
import { IController, IScope, module } from 'angular'; | ||
import { react2angular } from 'react2angular'; | ||
|
||
import { CloudfoundryMapLoadBalancersStageConfig } from './CloudfoundryMapLoadBalancersStageConfig'; | ||
import { AccountService, ExecutionDetailsTasks, IStage, Registry } from '@spinnaker/core'; | ||
import { ExecutionDetailsTasks, IStage, Registry } from '@spinnaker/core'; | ||
import { CloudfoundryMapLoadBalancersExecutionDetails } from './CloudfoundryMapLoadBalancersExecutionDetails'; | ||
|
||
class CloudFoundryMapLoadBalancersStageCtrl implements IController { | ||
public static $inject = ['$scope']; | ||
constructor(public $scope: IScope) { | ||
$scope.accounts = []; | ||
AccountService.listAccounts('cloudfoundry').then(accounts => { | ||
$scope.accounts = accounts; | ||
}); | ||
} | ||
} | ||
|
||
export const CLOUD_FOUNDRY_MAP_LOAD_BALANCERS_STAGE = 'spinnaker.cloudfoundry.pipeline.stage.mapLoadBalancersStage'; | ||
module(CLOUD_FOUNDRY_MAP_LOAD_BALANCERS_STAGE, []) | ||
.config(function() { | ||
Registry.pipeline.registerStage({ | ||
accountExtractor: (stage: IStage) => stage.context.credentials, | ||
configAccountExtractor: (stage: IStage) => [stage.credentials], | ||
cloudProvider: 'cloudfoundry', | ||
controller: 'cfMapLoadBalancersStageCtrl', | ||
description: 'Map load balancers', | ||
executionDetailsSections: [CloudfoundryMapLoadBalancersExecutionDetails, ExecutionDetailsTasks], | ||
key: 'mapLoadBalancers', | ||
label: 'Map Load Balancers', | ||
templateUrl: require('./cloudfoundryMapLoadBalancersStage.html'), | ||
validators: [ | ||
{ type: 'requiredField', fieldName: 'cluster' }, | ||
{ type: 'requiredField', fieldName: 'credentials', fieldLabel: 'account' }, | ||
{ type: 'requiredField', fieldName: 'region' }, | ||
{ type: 'requiredField', fieldName: 'target' }, | ||
], | ||
}); | ||
}) | ||
.component( | ||
'cfMapLoadBalancersStage', | ||
react2angular(CloudfoundryMapLoadBalancersStageConfig, [ | ||
'accounts', | ||
'application', | ||
'pipeline', | ||
'stage', | ||
'stageFieldUpdated', | ||
]), | ||
) | ||
.controller('cfMapLoadBalancersStageCtrl', CloudFoundryMapLoadBalancersStageCtrl); | ||
Registry.pipeline.registerStage({ | ||
accountExtractor: (stage: IStage) => stage.context.credentials, | ||
configAccountExtractor: (stage: IStage) => [stage.credentials], | ||
cloudProvider: 'cloudfoundry', | ||
component: CloudfoundryMapLoadBalancersStageConfig, | ||
controller: 'BaseProviderStageCtrl as baseProviderStageCtrl', | ||
description: 'Map a load balancer', | ||
executionDetailsSections: [CloudfoundryMapLoadBalancersExecutionDetails, ExecutionDetailsTasks], | ||
key: 'mapLoadBalancers', | ||
label: 'Map Load Balancer', | ||
validators: [ | ||
{ type: 'requiredField', preventSave: true, fieldName: 'cluster' }, | ||
{ type: 'requiredField', preventSave: true, fieldName: 'credentials', fieldLabel: 'account' }, | ||
{ type: 'requiredField', preventSave: true, fieldName: 'region' }, | ||
{ type: 'requiredField', preventSave: true, fieldName: 'target' }, | ||
{ type: 'cfRequiredRoutesField', preventSave: true, fieldName: 'loadBalancerNames' }, | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
...udfoundry/src/pipeline/stages/unmapLoadBalancers/cloudfoundryUnmapLoadBalancersStage.html
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.