Skip to content

Commit

Permalink
refactor(*): Replace all uses of wrapped AccountSelectField with reac…
Browse files Browse the repository at this point in the history
…t version (#5832)
  • Loading branch information
Justin Reynolds authored and christopherthielen committed Oct 16, 2018
1 parent 28bb758 commit 8e23f8f
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { chain, find, isEqual, isNil, trimEnd, uniq } from 'lodash';
import { Field, FormikErrors } from 'formik';

import {
AccountSelectField,
AccountService,
Application,
HelpField,
Expand All @@ -14,7 +15,6 @@ import {
ISubnet,
IWizardPageProps,
NameUtils,
NgReact,
RegionSelectField,
Spinner,
SubnetReader,
Expand Down Expand Up @@ -311,7 +311,6 @@ class LoadBalancerLocationImpl extends React.Component<ILoadBalancerLocationProp
const { app } = this.props;
const { errors, values } = this.props.formik;
const { accounts, availabilityZones, hideInternalFlag, regions, subnets } = this.state;
const { AccountSelectField } = NgReact;
const { SubnetSelectField } = AwsNgReact;

const className = classNames({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Observable, Subject } from 'rxjs';
import * as DOMPurify from 'dompurify';

import {
AccountSelectField,
NgReact,
HelpField,
IWizardPageProps,
Expand Down Expand Up @@ -285,7 +286,7 @@ class ServerGroupBasicSettingsImpl extends React.Component<
namePreview,
showPreviewAsWarning,
} = this.state;
const { AccountSelectField, DeploymentStrategySelector } = NgReact;
const { DeploymentStrategySelector } = NgReact;
const { SubnetSelectField } = AwsNgReact;

const accounts = values.backingData.accounts;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import * as React from 'react';
import { FormikErrors } from 'formik';

import {
AccountSelectField,
AccountService,
Application,
IAccount,
IWizardPageProps,
wizardPage,
NgReact,
RegionSelectField,
IRegion,
} from '@spinnaker/core';
Expand Down Expand Up @@ -126,7 +126,6 @@ class LoadBalancerDetailsImpl extends React.Component<ILoadBalancerDetailsProps,
public render() {
const { values } = this.props.formik;
const { accounts, domains, regions } = this.state;
const { AccountSelectField } = NgReact;
return (
<div className="container-fluid form-horizontal">
<div className="modal-body">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { FormikErrors } from 'formik';
import Select, { Option } from 'react-select';

import {
AccountSelectField,
AccountService,
HelpField,
IAccountDetails,
Expand All @@ -12,7 +13,6 @@ import {
IRegion,
wizardPage,
RegionSelectField,
NgReact,
ValidationMessage,
} from '@spinnaker/core';

Expand Down Expand Up @@ -254,7 +254,6 @@ class ArtifactSettingsImpl extends React.Component<
const { values, errors } = this.props.formik;
const { artifact } = values;
const { regions, filteredClusters, serverGroups, allCloudFoundryCredentials } = this.state;
const { AccountSelectField } = NgReact;

return (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { FormikErrors } from 'formik';
import Select, { Option } from 'react-select';

import {
AccountSelectField,
AccountService,
IAccount,
IDeploymentStrategy,
IRegion,
IWizardPageProps,
NgReact,
wizardPage,
HelpField,
RegionSelectField,
Expand Down Expand Up @@ -111,7 +111,6 @@ class BasicSettingsImpl extends React.Component<
public render(): JSX.Element {
const { accounts, regions } = this.state;
const { values, errors } = this.props.formik;
const { AccountSelectField } = NgReact;
return (
<div>
<div className="form-group">
Expand Down
2 changes: 0 additions & 2 deletions app/scripts/modules/core/src/account/account.module.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

import { ACCOUNT_SELECT_FIELD_WRAPPER } from './accountSelectFieldWrapper.component';
import { ACCOUNT_TAG_COMPONENT } from './accountTag.component';

const angular = require('angular');
Expand All @@ -9,6 +8,5 @@ module.exports = angular.module('spinnaker.core.account', [
require('./providerToggles.directive').name,
require('./accountSelectField.directive').name,
require('./collapsibleAccountTag.directive').name,
ACCOUNT_SELECT_FIELD_WRAPPER,
ACCOUNT_TAG_COMPONENT,
]);

This file was deleted.

3 changes: 0 additions & 3 deletions app/scripts/modules/core/src/reactShims/ngReact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ import * as React from 'react';
import { angular2react } from 'angular2react';
import IInjectorService = angular.auto.IInjectorService;

import { AccountSelectFieldWrapperComponent } from '../account/accountSelectFieldWrapper.component';
import { AddEntityTagLinksWrapperComponent } from 'core/entityTag/addEntityTagLinks.component';
import { ButtonBusyIndicatorComponent } from '../forms/buttonBusyIndicator/buttonBusyIndicator.component';
import { CopyToClipboardComponent } from '../utils/clipboard/copyToClipboard.component';
import { DeploymentStrategySelectorWrapper } from 'core/deploymentStrategy/deploymentStrategySelector.component';
import { IDiffViewProps } from '../pipeline/config/actions/history/DiffView';
import { EntitySourceComponent } from 'core/entityTag/entitySource.component';
import { HelpFieldWrapperComponent } from '../help/helpField.component';
import { IAccountSelectFieldProps } from 'core/account/AccountSelectField';
import { IAddEntityTagLinksProps } from 'core/entityTag/AddEntityTagLinks';
import { IButtonBusyIndicatorProps } from '../forms/buttonBusyIndicator/ButtonBusyIndicator';
import { ICopyToClipboardProps } from '../utils/clipboard/CopyToClipboard';
Expand Down Expand Up @@ -43,7 +41,6 @@ export class NgReactInjector extends ReactInject {
public $injectorProxy = {} as IInjectorService;

// Reactified components
public AccountSelectField: React.ComponentClass<IAccountSelectFieldProps> = angular2react('accountSelectFieldWrapper', new AccountSelectFieldWrapperComponent(), this.$injectorProxy) as any;
public AddEntityTagLinks: React.ComponentClass<IAddEntityTagLinksProps> = angular2react('addEntityTagLinksWrapper', new AddEntityTagLinksWrapperComponent(), this.$injectorProxy) as any;
public ButtonBusyIndicator: React.ComponentClass<IButtonBusyIndicatorProps> = angular2react('buttonBusyIndicator', new ButtonBusyIndicatorComponent(), this.$injectorProxy) as any;
public CopyToClipboard: React.ComponentClass<ICopyToClipboardProps> = angular2react('copyToClipboard', new CopyToClipboardComponent(), this.$injectorProxy) as any;
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 { NgReact, HelpField, IWizardPageProps, wizardPage, Application } from '@spinnaker/core';
import { AccountSelectField, HelpField, IWizardPageProps, wizardPage, Application } from '@spinnaker/core';

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

Expand All @@ -24,7 +24,6 @@ class ManifestBasicSettingsImpl extends React.Component<IManifestBasicSettingsPr

public render() {
const { formik, app } = this.props;
const { AccountSelectField } = NgReact;

const accounts = formik.values.metadata.backingData.accounts;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Application,
ReactInjector,
IServerGroup,
AccountSelectField,
AccountTag,
} from '@spinnaker/core';

Expand Down Expand Up @@ -183,7 +184,7 @@ class ServerGroupBasicSettingsImpl extends React.Component<
public render() {
const { errors, setFieldValue, values } = this.props.formik;
const { createsNewCluster, latestServerGroup, namePreview, showImageIdField, showPreviewAsWarning } = this.state;
const { AccountSelectField, DeploymentStrategySelector } = NgReact;
const { DeploymentStrategySelector } = NgReact;

const accounts = values.backingData.accounts;
const readOnlyFields = values.viewState.readOnlyFields || {};
Expand Down

0 comments on commit 8e23f8f

Please sign in to comment.