|
@@ -9,6 +9,7 @@ import { InfraType } from "shared/types";
|
|
|
|
|
|
|
|
import SelectRow from "components/values-form/SelectRow";
|
|
import SelectRow from "components/values-form/SelectRow";
|
|
|
import InputRow from "components/values-form/InputRow";
|
|
import InputRow from "components/values-form/InputRow";
|
|
|
|
|
+import CheckboxRow from "components/values-form/CheckboxRow";
|
|
|
import Helper from "components/values-form/Helper";
|
|
import Helper from "components/values-form/Helper";
|
|
|
import Heading from "components/values-form/Heading";
|
|
import Heading from "components/values-form/Heading";
|
|
|
import SaveButton from "components/SaveButton";
|
|
import SaveButton from "components/SaveButton";
|
|
@@ -28,6 +29,7 @@ type StateType = {
|
|
|
awsSecretKey: string;
|
|
awsSecretKey: string;
|
|
|
selectedInfras: { value: string; label: string }[];
|
|
selectedInfras: { value: string; label: string }[];
|
|
|
buttonStatus: string;
|
|
buttonStatus: string;
|
|
|
|
|
+ provisionConfirmed: boolean;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const provisionOptions = [
|
|
const provisionOptions = [
|
|
@@ -66,6 +68,7 @@ class AWSFormSection extends Component<PropsType, StateType> {
|
|
|
awsSecretKey: "",
|
|
awsSecretKey: "",
|
|
|
selectedInfras: [...provisionOptions],
|
|
selectedInfras: [...provisionOptions],
|
|
|
buttonStatus: "",
|
|
buttonStatus: "",
|
|
|
|
|
+ provisionConfirmed: false,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
componentDidMount = () => {
|
|
componentDidMount = () => {
|
|
@@ -88,6 +91,10 @@ class AWSFormSection extends Component<PropsType, StateType> {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
checkFormDisabled = () => {
|
|
checkFormDisabled = () => {
|
|
|
|
|
+ if (!this.state.provisionConfirmed) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
let { awsRegion, awsAccessId, awsSecretKey, selectedInfras } = this.state;
|
|
let { awsRegion, awsAccessId, awsSecretKey, selectedInfras } = this.state;
|
|
|
let { projectName } = this.props;
|
|
let { projectName } = this.props;
|
|
|
if (projectName || projectName === "") {
|
|
if (projectName || projectName === "") {
|
|
@@ -237,6 +244,18 @@ class AWSFormSection extends Component<PropsType, StateType> {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ getButtonStatus = () => {
|
|
|
|
|
+ if (this.props.projectName) {
|
|
|
|
|
+ if (!isAlphanumeric(this.props.projectName)) {
|
|
|
|
|
+ return "Project name contains illegal characters";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!this.state.awsAccessId || !this.state.awsSecretKey || !this.state.provisionConfirmed || this.props.projectName === "") {
|
|
|
|
|
+ return "Required fields missing";
|
|
|
|
|
+ }
|
|
|
|
|
+ return this.state.buttonStatus;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
render() {
|
|
render() {
|
|
|
let { setSelectedProvisioner } = this.props;
|
|
let { setSelectedProvisioner } = this.props;
|
|
|
let { awsRegion, awsAccessId, awsSecretKey, selectedInfras } = this.state;
|
|
let { awsRegion, awsAccessId, awsSecretKey, selectedInfras } = this.state;
|
|
@@ -293,6 +312,16 @@ class AWSFormSection extends Component<PropsType, StateType> {
|
|
|
this.setState({ selectedInfras: x });
|
|
this.setState({ selectedInfras: x });
|
|
|
}}
|
|
}}
|
|
|
/>
|
|
/>
|
|
|
|
|
+ <Helper>
|
|
|
|
|
+ Important: AWS will bill you for any provisioned resources. Learn more about EKS pricing
|
|
|
|
|
+ <Highlight href="https://aws.amazon.com/eks/pricing/" target="_blank">here</Highlight>
|
|
|
|
|
+ </Helper>
|
|
|
|
|
+ <CheckboxRow
|
|
|
|
|
+ required={true}
|
|
|
|
|
+ checked={this.state.provisionConfirmed}
|
|
|
|
|
+ toggle={() => this.setState({ provisionConfirmed: !this.state.provisionConfirmed })}
|
|
|
|
|
+ label="I understand and wish to proceed"
|
|
|
|
|
+ />
|
|
|
</FormSection>
|
|
</FormSection>
|
|
|
{this.props.children ? this.props.children : <Padding />}
|
|
{this.props.children ? this.props.children : <Padding />}
|
|
|
<SaveButton
|
|
<SaveButton
|
|
@@ -300,7 +329,7 @@ class AWSFormSection extends Component<PropsType, StateType> {
|
|
|
disabled={this.checkFormDisabled() || this.state.buttonStatus === "loading"}
|
|
disabled={this.checkFormDisabled() || this.state.buttonStatus === "loading"}
|
|
|
onClick={this.onCreateAWS}
|
|
onClick={this.onCreateAWS}
|
|
|
makeFlush={true}
|
|
makeFlush={true}
|
|
|
- status={this.state.buttonStatus}
|
|
|
|
|
|
|
+ status={this.getButtonStatus()}
|
|
|
helper="Note: Provisioning can take up to 15 minutes"
|
|
helper="Note: Provisioning can take up to 15 minutes"
|
|
|
/>
|
|
/>
|
|
|
</StyledAWSFormSection>
|
|
</StyledAWSFormSection>
|
|
@@ -312,6 +341,14 @@ AWSFormSection.contextType = Context;
|
|
|
|
|
|
|
|
export default withRouter(AWSFormSection);
|
|
export default withRouter(AWSFormSection);
|
|
|
|
|
|
|
|
|
|
+const Highlight = styled.a`
|
|
|
|
|
+ color: #8590ff;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ text-decoration: none;
|
|
|
|
|
+ margin-left: 5px;
|
|
|
|
|
+ margin-right: 10px;
|
|
|
|
|
+`;
|
|
|
|
|
+
|
|
|
const Padding = styled.div`
|
|
const Padding = styled.div`
|
|
|
height: 15px;
|
|
height: 15px;
|
|
|
`;
|
|
`;
|