Skip to content

Commit

Permalink
feat(provider/aws): Show load balancer warning based on settings (#7542)
Browse files Browse the repository at this point in the history
* feat(provider/aws): Show NLB warning based on config

* Abstract nlb warning to handle all generic messages

* Abstract warning naming

* Use Markdown component
  • Loading branch information
caseyhebebrand authored and mergify[bot] committed Oct 22, 2019
1 parent 7da89e0 commit 938d219
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/scripts/modules/amazon/src/aws.settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export interface IAWSProviderSettings extends IProviderSettings {
};
minRootVolumeSize?: number;
disableSpotPricing?: boolean;
createLoadBalancerWarnings?: {
network?: string;
application?: string;
classic?: string;
};
}

export const AWSProviderSettings: IAWSProviderSettings = (SETTINGS.providers.aws as IAWSProviderSettings) || {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import {
ReactModal,
noop,
CloudProviderRegistry,
Markdown,
} from '@spinnaker/core';
import { AWSProviderSettings } from 'amazon/aws.settings';

import { IAmazonLoadBalancerConfig, LoadBalancerTypes } from './LoadBalancerTypes';

Expand Down Expand Up @@ -102,6 +104,10 @@ export class AmazonLoadBalancerChoiceModal extends React.Component<
.map(cloudProvider => this.getIncompatibility(selectedChoice, cloudProvider))
.filter((x: ILoadBalancerIncompatibility) => x);

const loadBalancerWarning =
AWSProviderSettings.createLoadBalancerWarnings &&
AWSProviderSettings.createLoadBalancerWarnings[selectedChoice.type];

return (
<>
<ModalClose dismiss={this.close} />
Expand Down Expand Up @@ -133,6 +139,14 @@ export class AmazonLoadBalancerChoiceModal extends React.Component<
</div>
))}
</>
{!!loadBalancerWarning && (
<div className="alert alert-warning">
<p>
<i className="fa fa-exclamation-triangle" />
<Markdown message={loadBalancerWarning} style={{ display: 'inline-block', marginLeft: '2px' }} />
</p>
</div>
)}
<div className="load-balancer-description" />
</div>
</Modal.Body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface ICloseableLoadBalancerModal extends React.ComponentClass<ILoadB
}

export interface IAmazonLoadBalancerConfig {
type: string;
type: 'network' | 'application' | 'classic';
label: string;
sublabel: string;
description: string;
Expand Down

0 comments on commit 938d219

Please sign in to comment.