Skip to content

Commit

Permalink
chore(cf): rename serviceName to serviceInstanceName (#6523)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammy Louie authored and jkschneider committed Feb 12, 2019
1 parent 70b8e01 commit 46de5cf
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class CloudfoundryDeployServiceStageConfig extends React.Component<
props.stage.cloudProvider = 'cloudfoundry';
props.stage.manifest = props.stage.manifest || {
service: '',
serviceName: '',
serviceInstanceName: '',
servicePlan: '',
parameters: '',
type: 'direct',
Expand All @@ -71,7 +71,7 @@ export class CloudfoundryDeployServiceStageConfig extends React.Component<
case 'direct':
this.props.stage.manifest = {
service: '',
serviceName: '',
serviceInstanceName: '',
servicePlan: '',
type: 'direct',
};
Expand All @@ -89,7 +89,7 @@ export class CloudfoundryDeployServiceStageConfig extends React.Component<
this.props.stage.manifest = {
credentials: '',
routeServiceUrl: '',
serviceName: '',
serviceInstanceName: '',
syslogDrainUrl: '',
tags: [],
type: 'userProvided',
Expand Down Expand Up @@ -147,7 +147,7 @@ export class CloudfoundryDeployServiceStageConfig extends React.Component<
this.props.stage.credentials = credentials;
this.props.stage.region = '';
this.props.stage.manifest.service = '';
this.props.stage.manifest.serviceName = '';
this.props.stage.manifest.serviceInstanceName = '';
this.props.stage.manifest.servicePlan = '';
this.props.stageFieldUpdated();
if (credentials) {
Expand All @@ -160,7 +160,7 @@ export class CloudfoundryDeployServiceStageConfig extends React.Component<
this.setState({ region: region });
this.props.stage.region = region;
this.props.stage.manifest.service = '';
this.props.stage.manifest.serviceName = '';
this.props.stage.manifest.serviceInstanceName = '';
this.props.stage.manifest.servicePlan = '';
this.props.stageFieldUpdated();
this.clearAndReloadServices();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface ICreateServiceInstanceDirectInputProps {
interface ICreateServiceInstanceDirectInputState {
parameters?: string;
service: string;
serviceName: string;
serviceInstanceName: string;
servicePlan: string;
tags?: string[];
}
Expand All @@ -33,13 +33,13 @@ export class CreateServiceInstanceDirectInput extends React.Component<
};
}

private serviceNameUpdated = (event: React.ChangeEvent<HTMLInputElement>): void => {
const serviceName = event.target.value;
private serviceInstanceNameUpdated = (event: React.ChangeEvent<HTMLInputElement>): void => {
const serviceInstanceName = event.target.value;
const { onChange, serviceInput } = this.props;
this.setState({ serviceName });
this.setState({ serviceInstanceName });
onChange({
...serviceInput,
serviceName,
serviceInstanceName,
} as ICloudFoundryServiceManifestSource);
};

Expand Down Expand Up @@ -88,14 +88,19 @@ export class CreateServiceInstanceDirectInput extends React.Component<

public render() {
const { serviceInput, serviceNamesAndPlans } = this.props;
const { parameters, service, serviceName, servicePlan, tags } = serviceInput;
const { parameters, service, serviceInstanceName, servicePlan, tags } = serviceInput;
const services = serviceNamesAndPlans.map(item => item.name);
const serviceWithPlans = serviceNamesAndPlans.find(it => it.name === serviceInput.service);
const servicePlans = serviceWithPlans ? serviceWithPlans.servicePlans.map((it: IServicePlan) => it.name) : [];
return (
<div>
<StageConfigField label="Service Name">
<TextInput type="text" className="form-control" onChange={this.serviceNameUpdated} value={serviceName} />
<StageConfigField label="Service Instance Name">
<TextInput
type="text"
className="form-control"
onChange={this.serviceInstanceNameUpdated}
value={serviceInstanceName}
/>
</StageConfigField>
<StageConfigField label="Service">
<ReactSelectInput clearable={false} onChange={this.serviceUpdated} value={service} stringOptions={services} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface ICreateServiceInstanceUserProvidedInputProps {
}

interface ICreateServiceInstanceUserProvidedInputState {
serviceName: string;
serviceInstanceName: string;
tags?: string[];
syslogDrainUrl?: string;
credentials?: string;
Expand All @@ -28,13 +28,13 @@ export class CreateUserProvidedInput extends React.Component<
this.state = { ...serviceInput };
}

private serviceNameUpdated = (event: React.ChangeEvent<HTMLInputElement>): void => {
const serviceName = event.target.value;
private serviceInstanceNameUpdated = (event: React.ChangeEvent<HTMLInputElement>): void => {
const serviceInstanceName = event.target.value;
const { onChange, serviceInput } = this.props;
this.setState({ serviceName });
this.setState({ serviceInstanceName });
onChange({
...serviceInput,
serviceName,
serviceInstanceName,
} as ICloudFoundryServiceManifestSource);
};

Expand Down Expand Up @@ -78,11 +78,16 @@ export class CreateUserProvidedInput extends React.Component<
};

public render() {
const { serviceName, tags, syslogDrainUrl, credentials, routeServiceUrl } = this.state;
const { serviceInstanceName, tags, syslogDrainUrl, credentials, routeServiceUrl } = this.state;
return (
<>
<StageConfigField label="Service Name">
<TextInput type="text" className="form-control" onChange={this.serviceNameUpdated} value={serviceName} />
<StageConfigField label="Service Instance Name">
<TextInput
type="text"
className="form-control"
onChange={this.serviceInstanceNameUpdated}
value={serviceInstanceName}
/>
</StageConfigField>
<StageConfigField label="Syslog Drain URL">
<TextInput onChange={this.syslogDrainUrlUpdated} value={syslogDrainUrl} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ class CloudFoundryDeployServiceStageCtrl implements IController {
}
}

const serviceNameValidatorConfig: IServiceFieldValidatorConfig = {
const serviceInstanceNameValidatorConfig: IServiceFieldValidatorConfig = {
type: 'requiredServiceField',
serviceInputType: 'direct',
fieldName: 'serviceName',
fieldName: 'serviceInstanceName',
preventSave: true,
};

Expand Down Expand Up @@ -54,10 +54,10 @@ const referenceValidatorConfig: IServiceFieldValidatorConfig = {
preventSave: true,
};

const userProvidedServiceNameValidatorConfig: IServiceFieldValidatorConfig = {
const userProvidedServiceInstanceNameValidatorConfig: IServiceFieldValidatorConfig = {
type: 'requiredServiceField',
serviceInputType: 'userProvided',
fieldName: 'serviceName',
fieldName: 'serviceInstanceName',
preventSave: true,
};

Expand All @@ -83,13 +83,13 @@ module(CLOUD_FOUNDRY_DEPLOY_SERVICE_STAGE, [])
validators: [
{ type: 'requiredField', fieldName: 'credentials', fieldLabel: 'account' },
{ type: 'requiredField', fieldName: 'region' },
serviceNameValidatorConfig,
serviceInstanceNameValidatorConfig,
serviceValidatorConfig,
servicePlanValidatorConfig,
jsonValidatorConfig,
accountValidatorConfig,
referenceValidatorConfig,
userProvidedServiceNameValidatorConfig,
userProvidedServiceInstanceNameValidatorConfig,
credentialsJsonValidatorConfig,
],
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export interface ICloudfoundryServiceManifestDirectSource {
parameters?: string;
service: string;
serviceName: string;
serviceInstanceName: string;
servicePlan: string;
tags?: string[];
}
Expand All @@ -14,7 +14,7 @@ export interface ICloudfoundryServiceManifestArtifactSource {
export interface ICloudFoundryServiceUserProvidedSource {
credentials?: string;
routeServiceUrl: string;
serviceName: string;
serviceInstanceName: string;
syslogDrainUrl?: string;
tags?: string[];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface ICloudfoundryDestroyAsgStageConfigState {
pipeline: IPipeline;
region: string;
regions: IRegion[];
serviceName: string;
serviceInstanceName: string;
target: string;
}

Expand All @@ -44,7 +44,7 @@ export class CloudfoundryDestroyAsgStageConfig extends React.Component<
pipeline: props.pipeline,
region: props.stage.region,
regions: [],
serviceName: props.stage.serviceName,
serviceInstanceName: props.stage.serviceInstanceName,
target: props.stage.target,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface ICloudfoundryDestroyServiceStageConfigState {
credentials: string;
region: string;
regions: IRegion[];
serviceName: string;
serviceInstanceName: string;
}

export class CloudfoundryDestroyServiceStageConfig extends React.Component<
Expand All @@ -26,7 +26,7 @@ export class CloudfoundryDestroyServiceStageConfig extends React.Component<
credentials: props.stage.credentials,
region: props.stage.region,
regions: [],
serviceName: props.stage.serviceName,
serviceInstanceName: props.stage.serviceInstanceName,
};
}

Expand Down Expand Up @@ -63,10 +63,10 @@ export class CloudfoundryDestroyServiceStageConfig extends React.Component<
this.props.stageFieldUpdated();
};

private serviceNameUpdated = (event: React.ChangeEvent<HTMLInputElement>): void => {
const serviceName = event.target.value;
this.setState({ serviceName });
this.props.stage.serviceName = serviceName;
private serviceInstanceNameUpdated = (event: React.ChangeEvent<HTMLInputElement>): void => {
const serviceInstanceName = event.target.value;
this.setState({ serviceInstanceName });
this.props.stage.serviceInstanceName = serviceInstanceName;
this.props.stageFieldUpdated();
};

Expand All @@ -77,7 +77,7 @@ export class CloudfoundryDestroyServiceStageConfig extends React.Component<

public render() {
const { stage } = this.props;
const { credentials, region, serviceName, timeout } = stage;
const { credentials, region, serviceInstanceName, timeout } = stage;
const { accounts, regions } = this.state;
return (
<div className="form-horizontal">
Expand Down Expand Up @@ -109,13 +109,13 @@ export class CloudfoundryDestroyServiceStageConfig extends React.Component<
onChange={this.regionUpdated}
/>
</StageConfigField>
<StageConfigField label="Service Name">
<StageConfigField label="Service Instance Name">
<input
type="text"
className="form-control"
required={true}
onChange={this.serviceNameUpdated}
value={serviceName}
onChange={this.serviceInstanceNameUpdated}
value={serviceInstanceName}
/>
</StageConfigField>
<StageConfigField label="Override Destroy Timeout (Seconds)" helpKey="cf.service.destroy.timeout">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module(CLOUD_FOUNDRY_DESTROY_SERVICE_STAGE, [])
executionDetailsSections: [CloudfoundryDestroyServiceExecutionDetails, ExecutionDetailsTasks],
validators: [
{ type: 'requiredField', fieldName: 'region' },
{ type: 'requiredField', fieldName: 'serviceName', preventSave: true },
{ type: 'requiredField', fieldName: 'serviceInstanceName', preventSave: true },
{ type: 'requiredField', fieldName: 'credentials', fieldLabel: 'account' },
],
});
Expand Down

0 comments on commit 46de5cf

Please sign in to comment.