From 6186e404b90c035cfc28793d416c59621f17d694 Mon Sep 17 00:00:00 2001 From: Siyuan Fu Date: Thu, 17 Oct 2019 15:58:04 -0700 Subject: [PATCH] refactor(aws): move Resize item in the AmazonServerGroupAction dropdown into separate component --- .../details/AmazonServerGroupActions.tsx | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/app/scripts/modules/amazon/src/serverGroup/details/AmazonServerGroupActions.tsx b/app/scripts/modules/amazon/src/serverGroup/details/AmazonServerGroupActions.tsx index 2865261d545..0be1eb9c61a 100644 --- a/app/scripts/modules/amazon/src/serverGroup/details/AmazonServerGroupActions.tsx +++ b/app/scripts/modules/amazon/src/serverGroup/details/AmazonServerGroupActions.tsx @@ -12,18 +12,39 @@ import { ReactInjector, ServerGroupWarningMessageService, SETTINGS, + Overridable, } from '@spinnaker/core'; import { IAmazonServerGroup, IAmazonServerGroupView } from 'amazon/domain'; import { AmazonCloneServerGroupModal } from 'amazon/serverGroup/configure/wizard/AmazonCloneServerGroupModal'; import { AwsReactInjector } from 'amazon/reactShims'; import { IAmazonServerGroupCommand } from '../configure'; -import { AmazonResizeServerGroupModal } from './resize/AmazonResizeServerGroupModal'; +import { + AmazonResizeServerGroupModal, + IAmazonResizeServerGroupModalProps, +} from './resize/AmazonResizeServerGroupModal'; export interface IAmazonServerGroupActionsProps extends IServerGroupActionsProps { serverGroup: IAmazonServerGroupView; } +@Overridable('AmazonServerGroupActions.resize') +export class AmazonServerGroupActionsResize extends React.Component { + private resizeServerGroup = (): void => { + AmazonResizeServerGroupModal.show(this.props); + }; + + public render(): JSX.Element { + return ( +
  • + + Resize + +
  • + ); + } +} + export class AmazonServerGroupActions extends React.Component { private isEnableLocked(): boolean { if (this.props.serverGroup.isDisabled) { @@ -255,11 +276,6 @@ export class AmazonServerGroupActions extends React.Component { - const { app, serverGroup } = this.props; - AmazonResizeServerGroupModal.show({ application: app, serverGroup }); - }; - private cloneServerGroup = (): void => { const { app, serverGroup } = this.props; AwsReactInjector.awsServerGroupCommandBuilder @@ -289,11 +305,7 @@ export class AmazonServerGroupActions extends React.Component )} {this.isRollbackEnabled() &&
  • } -
  • - - Resize - -
  • + {!serverGroup.isDisabled && (