Skip to content

Commit

Permalink
refactor(core/account): rename AccountSelectField to AccountSelectInput
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed Dec 7, 2018
1 parent 4d808f7 commit 6f7f543
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { chain, find, isEqual, isNil, trimEnd, uniq } from 'lodash';
import { Field, FormikErrors } from 'formik';

import {
AccountSelectField,
AccountSelectInput,
AccountService,
Application,
HelpField,
Expand Down Expand Up @@ -342,7 +342,7 @@ class LoadBalancerLocationImpl extends React.Component<ILoadBalancerLocationProp
<div className="form-group">
<div className="col-md-3 sm-label-right">Account</div>
<div className="col-md-7">
<AccountSelectField
<AccountSelectInput
component={values}
field="credentials"
accounts={accounts}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Observable, Subject } from 'rxjs';
import * as DOMPurify from 'dompurify';

import {
AccountSelectField,
AccountSelectInput,
DeploymentStrategySelector,
HelpField,
IWizardPageProps,
Expand Down Expand Up @@ -316,7 +316,7 @@ class ServerGroupBasicSettingsImpl extends React.Component<
<div className="form-group">
<div className="col-md-3 sm-label-right">Account</div>
<div className="col-md-7">
<AccountSelectField
<AccountSelectInput
readOnly={readOnlyFields.credentials}
component={values}
field="credentials"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';
import { FormikErrors } from 'formik';

import {
AccountSelectField,
AccountSelectInput,
AccountService,
Application,
IAccount,
Expand Down Expand Up @@ -132,7 +132,7 @@ class LoadBalancerDetailsImpl extends React.Component<ILoadBalancerDetailsProps,
<div className="form-group">
<div className="col-md-3 sm-label-right">Account</div>
<div className="col-md-7">
<AccountSelectField
<AccountSelectInput
component={values}
field="credentials"
accounts={accounts}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';

import {
AccountSelectField,
AccountSelectInput,
AccountService,
IAccount,
IArtifactAccount,
Expand Down Expand Up @@ -423,7 +423,7 @@ export class CloudfoundryDeployServiceStageConfig extends React.Component<
return (
<div className="form-horizontal cloudfoundry-deploy-service-stage">
<StageConfigField label="Account">
<AccountSelectField
<AccountSelectInput
accounts={accounts}
component={stage}
field="credentials"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import {
AccountSelectField,
AccountSelectInput,
AccountService,
IAccount,
IRegion,
Expand Down Expand Up @@ -87,7 +87,7 @@ export class CloudfoundryDestroyServiceStageConfig extends React.Component<
return (
<div className="form-horizontal">
<StageConfigField label="Account">
<AccountSelectField
<AccountSelectInput
accounts={accounts}
component={stage}
field="credentials"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';
import Select, { Option } from 'react-select';

import {
AccountSelectField,
AccountSelectInput,
AccountService,
HelpField,
IAccountDetails,
Expand Down Expand Up @@ -238,7 +238,7 @@ class ArtifactSettingsImpl extends React.Component<
<div className="form-group">
<div className="col-md-3 sm-label-right">Account</div>
<div className="col-md-7">
<AccountSelectField
<AccountSelectInput
component={artifact}
field="credentials"
accounts={allCloudFoundryCredentials}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';
import { Field, FormikErrors } from 'formik';

import {
AccountSelectField,
AccountSelectInput,
AccountService,
IAccount,
IRegion,
Expand Down Expand Up @@ -80,7 +80,7 @@ class BasicSettingsImpl extends React.Component<
<div className="form-group">
<div className="col-md-3 sm-label-right">Account</div>
<div className="col-md-7">
<AccountSelectField
<AccountSelectInput
component={values}
field="credentials"
accounts={accounts}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { flatten, has, isEqual, map, uniq, xor } from 'lodash';
import { IAccount } from 'core/account';
import { AccountService } from 'core/account/AccountService';

export interface IAccountSelectFieldProps {
export interface IAccountSelectInputProps {
accounts: IAccount[] | string[];
component: { [key: string]: any };
field: string;
Expand All @@ -16,7 +16,7 @@ export interface IAccountSelectFieldProps {
readOnly?: boolean;
}

export interface IAccountSelectFieldState {
export interface IAccountSelectInputState {
accountContainsExpression: boolean;
mergedAccounts: string[];
primaryAccounts: string[];
Expand All @@ -25,8 +25,8 @@ export interface IAccountSelectFieldState {

const isExpression = (account: string) => !!account && account.includes('${');

export class AccountSelectField extends React.Component<IAccountSelectFieldProps, IAccountSelectFieldState> {
public state: IAccountSelectFieldState = {
export class AccountSelectInput extends React.Component<IAccountSelectInputProps, IAccountSelectInputState> {
public state: IAccountSelectInputState = {
accountContainsExpression: false,
mergedAccounts: [],
primaryAccounts: [],
Expand Down Expand Up @@ -90,7 +90,7 @@ export class AccountSelectField extends React.Component<IAccountSelectFieldProps
this.groupAccounts(this.props.accounts);
}

public componentWillReceiveProps(nextProps: IAccountSelectFieldProps) {
public componentWillReceiveProps(nextProps: IAccountSelectInputProps) {
if (!isEqual(nextProps.accounts, this.props.accounts)) {
this.groupAccounts(nextProps.accounts);
}
Expand Down
3 changes: 1 addition & 2 deletions app/scripts/modules/core/src/account/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './AccountSelectField';
export * from './AccountSelectInput';
export * from './AccountService';
export * from './AccountSelectField';
export * from './AccountTag';
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Creatable, Option } from 'react-select';
import { $q } from 'ngimport';
import Spy = jasmine.Spy;

import { noop, ScopeClusterSelector, AccountService, AccountSelectField } from '@spinnaker/core';
import { noop, ScopeClusterSelector, AccountService, AccountSelectInput } from '@spinnaker/core';

import { ManifestKindSearchService } from 'kubernetes/v2/manifest/ManifestKindSearch';
import { ManifestSelector } from 'kubernetes/v2/manifest/selector/ManifestSelector';
Expand Down Expand Up @@ -270,7 +270,7 @@ describe('<ManifestSelector />', () => {
],
});

const account = wrapper.find(AccountSelectField).first();
const account = wrapper.find(AccountSelectInput).first();
account.props().onChange('my-other-account');
expect(searchService).toHaveBeenCalledWith('configMap', 'default', 'my-other-account');
});
Expand All @@ -288,7 +288,7 @@ describe('<ManifestSelector />', () => {
],
});

const account = wrapper.find(AccountSelectField).first();
const account = wrapper.find(AccountSelectInput).first();
account.props().onChange('my-other-account');
expect(wrapper.instance().state.selector.location).toBeFalsy();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
IAccountDetails,
SETTINGS,
StageConfigField,
AccountSelectField,
AccountSelectInput,
AccountService,
noop,
ScopeClusterSelector,
Expand Down Expand Up @@ -273,7 +273,7 @@ export class ManifestSelector extends React.Component<IManifestSelectorProps, IM
return (
<>
<StageConfigField label="Account">
<AccountSelectField
<AccountSelectInput
component={selector}
field="account"
accounts={accounts}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { FormikErrors } from 'formik';

import { AccountSelectField, HelpField, IWizardPageProps, wizardPage, Application } from '@spinnaker/core';
import { AccountSelectInput, HelpField, IWizardPageProps, wizardPage, Application } from '@spinnaker/core';

import { IKubernetesManifestCommandData } from 'kubernetes/v2/manifest/manifestCommandBuilder.service';

Expand Down Expand Up @@ -34,7 +34,7 @@ class ManifestBasicSettingsImpl extends React.Component<IManifestBasicSettingsPr
Account <HelpField id="kubernetes.manifest.account" />
</div>
<div className="col-md-7">
<AccountSelectField
<AccountSelectInput
readOnly={false}
component={formik.values.command}
field="account"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
AccountService,
FirewallLabels,
MapEditor,
AccountSelectField,
AccountSelectInput,
} from '@spinnaker/core';

import { DockerImageAndTagSelector, DockerImageUtils, IDockerImageAndTagChanges } from '@spinnaker/docker';
Expand Down Expand Up @@ -156,7 +156,7 @@ export class TitusRunJobStageConfig extends React.Component<IStageConfigProps, I
<span className="label-text">Account</span>
</label>
<div className="col-md-5">
<AccountSelectField
<AccountSelectInput
component={stage}
field="credentials"
accounts={credentials}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
Application,
ReactInjector,
IServerGroup,
AccountSelectField,
AccountSelectInput,
AccountTag,
} from '@spinnaker/core';

Expand Down Expand Up @@ -178,7 +178,7 @@ class ServerGroupBasicSettingsImpl extends React.Component<
<div className="form-group">
<div className="col-md-3 sm-label-right">Account</div>
<div className="col-md-7">
<AccountSelectField
<AccountSelectInput
readOnly={readOnlyFields.credentials}
component={values}
field="credentials"
Expand Down

0 comments on commit 6f7f543

Please sign in to comment.