Blame components/Wizard/ReviewStep.js

Packit Service eebd6f
import React from "react";
Packit Service eebd6f
import {
Packit Service eebd6f
  Alert,
Packit Service eebd6f
  Button,
Packit Service eebd6f
  Popover,
Packit Service eebd6f
  Text,
Packit Service eebd6f
  TextList,
Packit Service eebd6f
  TextContent,
Packit Service eebd6f
  TextListVariants,
Packit Service eebd6f
  TextListItem,
Packit Service eebd6f
  TextListItemVariants,
Packit Service eebd6f
  Title,
Packit Service eebd6f
} from "@patternfly/react-core";
Packit Service eebd6f
import {
Packit Service eebd6f
  ExclamationCircleIcon,
Packit Service eebd6f
  ExternalLinkSquareAltIcon,
Packit Service eebd6f
  ExclamationTriangleIcon,
Packit Service eebd6f
  OutlinedQuestionCircleIcon,
Packit Service eebd6f
} from "@patternfly/react-icons";
Packit Service eebd6f
import { FormattedMessage, defineMessages, injectIntl, intlShape } from "react-intl";
Packit Service eebd6f
import PropTypes from "prop-types";
Packit Service eebd6f
Packit Service eebd6f
const ariaLabels = defineMessages({
Packit Service eebd6f
  aws: {
Packit Service eebd6f
    defaultMessage: "AWS help",
Packit Service eebd6f
  },
Packit Service eebd6f
  azure: {
Packit Service eebd6f
    defaultMessage: "Azure help",
Packit Service eebd6f
  },
Packit Service eebd6f
  processLength: {
Packit Service eebd6f
    defaultMessage: "Process length help",
Packit Service eebd6f
  },
Packit Service eebd6f
});
Packit Service eebd6f
Packit Service eebd6f
const messages = defineMessages({
Packit Service eebd6f
  infotip: {
Packit Service eebd6f
    defaultMessage: "This process can take a while. " + "Images are built in the order they are started.",
Packit Service eebd6f
  },
Packit Service eebd6f
  review: {
Packit Service eebd6f
    defaultMessage:
Packit Service eebd6f
      "Review the information below and click Finish to create the image and complete the tasks that were selected. ",
Packit Service eebd6f
  },
Packit Service eebd6f
  warningReview: {
Packit Service eebd6f
    defaultMessage: "There are one or more fields that require your attention.",
Packit Service eebd6f
  },
Packit Service eebd6f
  warningSizeEmpty: {
Packit Service eebd6f
    defaultMessage: "A value is required.",
Packit Service eebd6f
  },
Packit Service eebd6f
  warningSizeSmall: {
Packit Service eebd6f
    defaultMessage: "Minimum size is {size} GB.",
Packit Service eebd6f
  },
Packit Service eebd6f
  warningSizeLarge: {
Packit Service eebd6f
    defaultMessage:
Packit Service eebd6f
      "The size specified is large. We recommend that you check whether your target destination has any restrictions on image size.",
Packit Service eebd6f
  },
Packit Service eebd6f
});
Packit Service eebd6f
Packit Service eebd6f
class ReviewStep extends React.PureComponent {
Packit Service eebd6f
  render() {
Packit Service eebd6f
    const { formatMessage } = this.props.intl;
Packit Service eebd6f
    const {
Packit Service eebd6f
      imageName,
Packit Service eebd6f
      imageSize,
Packit Service eebd6f
      imageType,
Packit Service eebd6f
      imageTypes,
Packit Service eebd6f
      minImageSize,
Packit Service eebd6f
      maxImageSize,
Packit Service eebd6f
      missingRequiredFields,
Packit Service eebd6f
      uploadService,
Packit Service eebd6f
      uploadSettings,
Packit Service eebd6f
    } = this.props;
Packit Service eebd6f
Packit Service eebd6f
    const awsReviewStep = uploadService === "aws" && (
Packit Service 0c2606
      <TextContent id="aws-content">
Packit Service eebd6f
        
Packit Service eebd6f
          

Packit Service 0c2606
            <FormattedMessage defaultMessage="Upload to AWS" />
Packit Service eebd6f
          
Packit Service eebd6f
          
Packit Service eebd6f
            className="pf-l-flex__item"
Packit Service eebd6f
            id="aws-review-popover"
Packit Service eebd6f
            bodyContent={
Packit Service 0c2606
              
Packit Service eebd6f
                

Packit Service eebd6f
                  
Packit Service eebd6f
                    defaultMessage="
Packit Service eebd6f
                        Image Builder can upload images you create to an {bucket} in AWS and then import them into EC2. When the image build is complete
Packit Service eebd6f
                        and the upload action is successful, the image file is available in the AMI section of EC2. Most of the values required to upload
Packit Service eebd6f
                        the image can be found in the {console}.
Packit Service eebd6f
                      "
Packit Service eebd6f
                    values={{
Packit Service eebd6f
                      bucket: "S3 bucket",
Packit Service eebd6f
                      console: (
Packit Service eebd6f
                        
Packit Service eebd6f
                          component="a"
Packit Service eebd6f
                          className="pf-icon"
Packit Service eebd6f
                          target="_blank"
Packit Service eebd6f
                          variant="link"
Packit Service eebd6f
                          icon={<ExternalLinkSquareAltIcon />}
Packit Service eebd6f
                          iconPosition="right"
Packit Service eebd6f
                          isInline
Packit Service eebd6f
                          href="https://console.aws.amazon.com/console/home"
Packit Service eebd6f
                        >
Packit Service eebd6f
                          AWS Management Console
Packit Service eebd6f
                        </Button>
Packit Service eebd6f
                      ),
Packit Service eebd6f
                    }}
Packit Service eebd6f
                  />
Packit Service eebd6f
                

Packit Service 0c2606
                
Packit Service eebd6f
                

Packit Service eebd6f
                  
Packit Service eebd6f
                    defaultMessage="
Packit Service eebd6f
                        This upload process requires that you have an {iam} role named {vmimport} to ensure that the image can
Packit Service eebd6f
                        be imported from the S3 {bucket} into EC2. For more details, refer to the {role}.
Packit Service eebd6f
                      "
Packit Service eebd6f
                    values={{
Packit Service eebd6f
                      bucket: "bucket",
Packit Service eebd6f
                      vmimport: vmimport,
Packit Service eebd6f
                      iam: "Identity and Access Management (IAM)",
Packit Service eebd6f
                      role: (
Packit Service eebd6f
                        
Packit Service eebd6f
                          component="a"
Packit Service eebd6f
                          className="pf-icon"
Packit Service eebd6f
                          target="_blank"
Packit Service eebd6f
                          variant="link"
Packit Service eebd6f
                          icon={<ExternalLinkSquareAltIcon />}
Packit Service eebd6f
                          iconPosition="right"
Packit Service eebd6f
                          isInline
Packit Service eebd6f
                          href="https://docs.aws.amazon.com/vm-import/latest/userguide/vmie_prereqs.html#vmimport-role"
Packit Service eebd6f
                        >
Packit Service eebd6f
                          AWS Required Service Role
Packit Service eebd6f
                        </Button>
Packit Service eebd6f
                      ),
Packit Service eebd6f
                    }}
Packit Service eebd6f
                  />
Packit Service eebd6f
                

Packit Service 0c2606
              
Packit Service eebd6f
            }
Packit Service eebd6f
            aria-label={formatMessage(ariaLabels.aws)}
Packit Service eebd6f
          >
Packit Service eebd6f
            <Button variant="plain" aria-label={formatMessage(ariaLabels.aws)}>
Packit Service eebd6f
              <OutlinedQuestionCircleIcon id="popover-icon" />
Packit Service eebd6f
            </Button>
Packit Service eebd6f
          </Popover>
Packit Service eebd6f
        
Packit Service eebd6f
        <TextList className="cc-m-column__fixed-width" component={TextListVariants.dl}>
Packit Service eebd6f
          <TextListItem component={TextListItemVariants.dt}>
Packit Service eebd6f
            <FormattedMessage defaultMessage="Access key ID" />
Packit Service eebd6f
          </TextListItem>
Packit Service eebd6f
          <TextListItem component={TextListItemVariants.dd}>
Packit Service eebd6f
            {"*".repeat(uploadSettings.accessKeyID.length)}
Packit Service eebd6f
          </TextListItem>
Packit Service eebd6f
          <TextListItem component={TextListItemVariants.dt}>
Packit Service eebd6f
            <FormattedMessage defaultMessage="Secret access key" />
Packit Service eebd6f
          </TextListItem>
Packit Service eebd6f
          <TextListItem component={TextListItemVariants.dd}>
Packit Service eebd6f
            {"*".repeat(uploadSettings.secretAccessKey.length)}
Packit Service eebd6f
          </TextListItem>
Packit Service eebd6f
          <TextListItem component={TextListItemVariants.dt}>
Packit Service eebd6f
            <FormattedMessage defaultMessage="Image name" />
Packit Service eebd6f
          </TextListItem>
Packit Service eebd6f
          <TextListItem component={TextListItemVariants.dd}>{imageName}</TextListItem>
Packit Service eebd6f
          <TextListItem component={TextListItemVariants.dt}>Amazon S3 bucket</TextListItem>
Packit Service eebd6f
          <TextListItem component={TextListItemVariants.dd}>{uploadSettings.bucket}</TextListItem>
Packit Service eebd6f
          <TextListItem component={TextListItemVariants.dt}>
Packit Service eebd6f
            <FormattedMessage defaultMessage="AWS region" />
Packit Service eebd6f
          </TextListItem>
Packit Service eebd6f
          <TextListItem component={TextListItemVariants.dd}>{uploadSettings.region}</TextListItem>
Packit Service eebd6f
        </TextList>
Packit Service eebd6f
      </TextContent>
Packit Service eebd6f
    );
Packit Service eebd6f
Packit Service eebd6f
    const azureReviewStep = uploadService === "azure" && (
Packit Service 0c2606
      <TextContent id="azure-content">
Packit Service eebd6f
        
Packit Service eebd6f
          

Packit Service eebd6f
            <FormattedMessage defaultMessage="Upload to Azure" />
Packit Service eebd6f
          
Packit Service eebd6f
          
Packit Service eebd6f
            className="pf-l-flex__item"
Packit Service eebd6f
            id="azure-review-popover"
Packit Service eebd6f
            bodyContent={
Packit Service eebd6f
              
Packit Service eebd6f
                defaultMessage="
Packit Service eebd6f
                      Image Builder can upload images you create to a Blob container in {azure}. When the image build is complete 
Packit Service eebd6f
                      and the upload action is successful, the image file is available in the Storage account and Blob container that you specified.
Packit Service eebd6f
                      "
Packit Service eebd6f
                values={{
Packit Service eebd6f
                  azure: (
Packit Service eebd6f
                    
Packit Service eebd6f
                      component="a"
Packit Service eebd6f
                      className="pf-icon"
Packit Service eebd6f
                      target="_blank"
Packit Service eebd6f
                      variant="link"
Packit Service eebd6f
                      icon={<ExternalLinkSquareAltIcon />}
Packit Service eebd6f
                      iconPosition="right"
Packit Service eebd6f
                      isInline
Packit Service eebd6f
                      href="https://portal.azure.com/"
Packit Service eebd6f
                    >
Packit Service eebd6f
                      Microsoft Azure
Packit Service eebd6f
                    </Button>
Packit Service eebd6f
                  ),
Packit Service eebd6f
                }}
Packit Service eebd6f
              />
Packit Service eebd6f
            }
Packit Service eebd6f
            aria-label={formatMessage(ariaLabels.azure)}
Packit Service eebd6f
          >
Packit Service eebd6f
            <Button variant="plain" aria-label={formatMessage(ariaLabels.azure)}>
Packit Service eebd6f
              <OutlinedQuestionCircleIcon id="popover-icon" />
Packit Service eebd6f
            </Button>
Packit Service eebd6f
          </Popover>
Packit Service eebd6f
        
Packit Service eebd6f
        <TextList className="cc-m-column__fixed-width" component={TextListVariants.dl}>
Packit Service eebd6f
          <TextListItem component={TextListItemVariants.dt}>
Packit Service eebd6f
            <FormattedMessage defaultMessage="Storage account" />
Packit Service eebd6f
          </TextListItem>
Packit Service eebd6f
          <TextListItem component={TextListItemVariants.dd}>{uploadSettings.storageAccount}</TextListItem>
Packit Service eebd6f
          <TextListItem component={TextListItemVariants.dt}>
Packit Service eebd6f
            <FormattedMessage defaultMessage="Storage access key" />
Packit Service eebd6f
          </TextListItem>
Packit Service eebd6f
          <TextListItem component={TextListItemVariants.dd}>
Packit Service eebd6f
            {"*".repeat(uploadSettings.storageAccessKey.length)}
Packit Service eebd6f
          </TextListItem>
Packit Service eebd6f
          <TextListItem component={TextListItemVariants.dt}>
Packit Service eebd6f
            <FormattedMessage defaultMessage="Image name" />
Packit Service eebd6f
          </TextListItem>
Packit Service eebd6f
          <TextListItem component={TextListItemVariants.dd}>{imageName}</TextListItem>
Packit Service eebd6f
          <TextListItem component={TextListItemVariants.dt}>
Packit Service eebd6f
            <FormattedMessage defaultMessage="Storage container" />
Packit Service eebd6f
          </TextListItem>
Packit Service eebd6f
          <TextListItem component={TextListItemVariants.dd}>{uploadSettings.container}</TextListItem>
Packit Service eebd6f
        </TextList>
Packit Service eebd6f
      </TextContent>
Packit Service eebd6f
    );
Packit Service eebd6f
Packit Service eebd6f
    return (
Packit Service eebd6f
      <>
Packit Service eebd6f
        {missingRequiredFields() && (
Packit Service eebd6f
          <Alert id="required-fields-alert" variant="danger" isInline title={formatMessage(messages.warningReview)} />
Packit Service eebd6f
        )}
Packit Service eebd6f
        <TextContent>
Packit Service eebd6f
          <Title className="cc-c-popover__horizontal-group" headingLevel="h3" size="2xl">
Packit Service eebd6f
            <FormattedMessage defaultMessage="Create and upload image" />
Packit Service eebd6f
            <Popover bodyContent={formatMessage(messages.infotip)} aria-label={formatMessage(ariaLabels.processLength)}>
Packit Service eebd6f
              <Button variant="plain" aria-label={formatMessage(ariaLabels.processLength)}>
Packit Service eebd6f
                <OutlinedQuestionCircleIcon id="popover-icon" />
Packit Service eebd6f
              </Button>
Packit Service eebd6f
            </Popover>
Packit Service eebd6f
          </Title>
Packit Service eebd6f
          <Text>{formatMessage(messages.review)}</Text>
Packit Service eebd6f
          

Packit Service eebd6f
            <FormattedMessage defaultMessage="Image output" />
Packit Service eebd6f
          
Packit Service eebd6f
          <TextList className="cc-m-column__fixed-width" component={TextListVariants.dl}>
Packit Service eebd6f
            
Packit Service eebd6f
              <FormattedMessage defaultMessage="Image size" />
Packit Service eebd6f
            
Packit Service eebd6f
            
Packit Service eebd6f
              {imageSize === undefined && (
Packit Service eebd6f
                
Packit Service eebd6f
                  <ExclamationCircleIcon className="cc-c-text__danger-icon" />{" "}
Packit Service eebd6f
                  {formatMessage(messages.warningSizeEmpty)}
Packit Service eebd6f
                
Packit Service eebd6f
              )}
Packit Service eebd6f
              {imageSize !== undefined && 
{imageSize} GB
}
Packit Service eebd6f
              {imageSize < minImageSize && (
Packit Service eebd6f
                
Packit Service eebd6f
                  <ExclamationCircleIcon className="cc-c-text__danger-icon" />{" "}
Packit Service eebd6f
                  {formatMessage(messages.warningSizeSmall, {
Packit Service eebd6f
                    size: minImageSize,
Packit Service eebd6f
                  })}
Packit Service eebd6f
                
Packit Service eebd6f
              )}
Packit Service eebd6f
              {imageSize > maxImageSize && (
Packit Service eebd6f
                
Packit Service eebd6f
                  <ExclamationTriangleIcon className="cc-c-text__warning-icon" />{" "}
Packit Service eebd6f
                  {formatMessage(messages.warningSizeLarge)}
Packit Service eebd6f
                
Packit Service eebd6f
              )}
Packit Service eebd6f
            
Packit Service eebd6f
            <TextListItem component={TextListItemVariants.dt}>
Packit Service eebd6f
              <FormattedMessage defaultMessage="Image type" />
Packit Service eebd6f
            </TextListItem>
Packit Service eebd6f
            <TextListItem component={TextListItemVariants.dd}>
Packit Service eebd6f
              {imageTypes.find((type) => type.name === imageType).label}
Packit Service eebd6f
            </TextListItem>
Packit Service eebd6f
          </TextList>
Packit Service eebd6f
        </TextContent>
Packit Service eebd6f
        {awsReviewStep}
Packit Service eebd6f
        {azureReviewStep}
Packit Service eebd6f
      
Packit Service eebd6f
    );
Packit Service eebd6f
  }
Packit Service eebd6f
}
Packit Service eebd6f
Packit Service eebd6f
ReviewStep.propTypes = {
Packit Service eebd6f
  intl: intlShape.isRequired,
Packit Service eebd6f
  imageName: PropTypes.string,
Packit Service eebd6f
  imageType: PropTypes.string,
Packit Service eebd6f
  imageTypes: PropTypes.arrayOf(PropTypes.object),
Packit Service eebd6f
  imageSize: PropTypes.number,
Packit Service eebd6f
  minImageSize: PropTypes.number,
Packit Service eebd6f
  maxImageSize: PropTypes.number,
Packit Service eebd6f
  missingRequiredFields: PropTypes.func,
Packit Service eebd6f
  uploadService: PropTypes.string,
Packit Service eebd6f
  uploadSettings: PropTypes.object,
Packit Service eebd6f
};
Packit Service eebd6f
Packit Service eebd6f
ReviewStep.defaultProps = {
Packit Service eebd6f
  imageName: "",
Packit Service eebd6f
  imageType: "",
Packit Service eebd6f
  imageTypes: [],
Packit Service eebd6f
  imageSize: undefined,
Packit Service eebd6f
  minImageSize: 0,
Packit Service eebd6f
  maxImageSize: 2000,
Packit Service eebd6f
  missingRequiredFields() {},
Packit Service eebd6f
  uploadService: "",
Packit Service eebd6f
  uploadSettings: {},
Packit Service eebd6f
};
Packit Service eebd6f
Packit Service eebd6f
export default injectIntl(ReviewStep);