|
|
@@ -7,10 +7,14 @@ import aws from "assets/aws.png";
|
|
|
|
|
|
import { Context } from "shared/Context";
|
|
|
|
|
|
-import Heading from "components/form-components/Heading";
|
|
|
-import Helper from "./form-components/Helper";
|
|
|
+import Text from "./porter/Text";
|
|
|
+import Spacer from "./porter/Spacer";
|
|
|
import InputRow from "./form-components/InputRow";
|
|
|
import SaveButton from "./SaveButton";
|
|
|
+import Fieldset from "./porter/Fieldset";
|
|
|
+import Input from "./porter/Input";
|
|
|
+import Button from "./porter/Button";
|
|
|
+import DocsHelper from "./DocsHelper";
|
|
|
|
|
|
type Props = {
|
|
|
goBack: () => void;
|
|
|
@@ -22,6 +26,7 @@ const CloudFormationForm: React.FC<Props> = ({
|
|
|
proceed,
|
|
|
}) => {
|
|
|
const [AWSAccountID, setAWSAccountID] = useState("");
|
|
|
+ const [grantPermissionsError, setGrantPermissionsError] = useState("");
|
|
|
const [roleStatus, setRoleStatus] = useState("");
|
|
|
|
|
|
const checkIfRoleExists = () => {
|
|
|
@@ -61,22 +66,53 @@ const CloudFormationForm: React.FC<Props> = ({
|
|
|
const renderContent = () => {
|
|
|
return (
|
|
|
<>
|
|
|
- <StyledForm>
|
|
|
- <InputRow
|
|
|
- type="string"
|
|
|
+ <Spacer y={1} />
|
|
|
+ <Fieldset>
|
|
|
+ <Text size={16} weight={500}>
|
|
|
+ Log in to AWS and "Create stack"
|
|
|
+ </Text>
|
|
|
+ <Spacer height="15px" />
|
|
|
+ <Text color="helper">
|
|
|
+ Provide your AWS account ID to log in and grant Porter access to AWS. You will need to select "Create stack" after being redirected to the AWS console below.
|
|
|
+ </Text>
|
|
|
+ <Spacer y={1} />
|
|
|
+ <Input
|
|
|
+ label={
|
|
|
+ <Flex>
|
|
|
+ 👤 AWS account ID
|
|
|
+ <i
|
|
|
+ className="material-icons"
|
|
|
+ >
|
|
|
+ help_outline
|
|
|
+ </i>
|
|
|
+ </Flex>
|
|
|
+ }
|
|
|
+ type="number"
|
|
|
value={AWSAccountID}
|
|
|
- setValue={(e: string) => setAWSAccountID(e)}
|
|
|
- label="👤 AWS Account ID"
|
|
|
+ setValue={(e) => {
|
|
|
+ setGrantPermissionsError("");
|
|
|
+ setAWSAccountID(e);
|
|
|
+ }}
|
|
|
placeholder="ex: 915037676314"
|
|
|
- isRequired
|
|
|
/>
|
|
|
- <SaveButton
|
|
|
- disabled={AWSAccountID === ""}
|
|
|
- onClick={directToCloudFormation}
|
|
|
- clearPosition
|
|
|
- text="Grant Permissions"
|
|
|
- />
|
|
|
- </StyledForm>
|
|
|
+ <Spacer y={1} />
|
|
|
+ <Button
|
|
|
+ onClick={() => {
|
|
|
+ if (AWSAccountID.length === 12) {
|
|
|
+ directToCloudFormation();
|
|
|
+ } else {
|
|
|
+ setGrantPermissionsError("Invalid AWS account ID");
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ status={grantPermissionsError}
|
|
|
+ errorText={grantPermissionsError}
|
|
|
+ color="#1E2631"
|
|
|
+ withBorder
|
|
|
+ >
|
|
|
+ <ButtonImg src={aws} /> Grant permissions
|
|
|
+ </Button>
|
|
|
+ </Fieldset>
|
|
|
+ <Spacer y={1} />
|
|
|
<SaveButton
|
|
|
onClick={checkIfRoleExists}
|
|
|
status={roleStatus}
|
|
|
@@ -90,30 +126,39 @@ const CloudFormationForm: React.FC<Props> = ({
|
|
|
|
|
|
return (
|
|
|
<>
|
|
|
- <Heading isAtTop>
|
|
|
+ <Text size={16} weight={500}>
|
|
|
<BackButton width="140px" onClick={goBack}>
|
|
|
<i className="material-icons">first_page</i>
|
|
|
Select cloud
|
|
|
</BackButton>
|
|
|
- <Spacer />
|
|
|
+ <Spacer x={1} inline />
|
|
|
<Img src={aws} />
|
|
|
- Grant AWS Permissions
|
|
|
- </Heading>
|
|
|
- <Helper>
|
|
|
+ Grant AWS permissions
|
|
|
+ </Text>
|
|
|
+ <Spacer y={1} />
|
|
|
+ <Text color="helper">
|
|
|
Grant Porter permissions to create infrastructure in your AWS account.
|
|
|
- </Helper>
|
|
|
- {
|
|
|
- renderContent()
|
|
|
- }
|
|
|
+ </Text>
|
|
|
+ {renderContent()}
|
|
|
</>
|
|
|
);
|
|
|
};
|
|
|
|
|
|
export default CloudFormationForm;
|
|
|
|
|
|
-const Spacer = styled.div`
|
|
|
- height: 1px;
|
|
|
- width: 17px;
|
|
|
+const Flex = styled.div`
|
|
|
+ display: flex;
|
|
|
+ ailgn-items: center;
|
|
|
+ > i {
|
|
|
+ margin-left: 10px;
|
|
|
+ font-size: 16px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+`;
|
|
|
+
|
|
|
+const ButtonImg = styled.img`
|
|
|
+ height: 14px;
|
|
|
+ margin-right: 12px;
|
|
|
`;
|
|
|
|
|
|
const Img = styled.img`
|