diff --git a/src/client/src/assets/errorred.svg b/src/client/src/assets/errorred.svg new file mode 100644 index 0000000000..eb6e925706 --- /dev/null +++ b/src/client/src/assets/errorred.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/client/src/containers/PostGenerationModal/index.tsx b/src/client/src/containers/PostGenerationModal/index.tsx index a77a2bc6be..498835d533 100644 --- a/src/client/src/containers/PostGenerationModal/index.tsx +++ b/src/client/src/containers/PostGenerationModal/index.tsx @@ -3,6 +3,8 @@ import * as React from "react"; import { connect } from "react-redux"; import { RouteComponentProps, withRouter } from "react-router"; import ReactMarkdown from "react-markdown"; +import { ReactComponent as Checkmark } from "../../assets/checkgreen.svg"; +import { ReactComponent as ErrorRed } from "../../assets/errorred.svg"; import asModal from "../../components/Modal"; import { ReactComponent as Spinner } from "../../assets/spinner.svg"; @@ -34,11 +36,11 @@ interface LinksDict { } const links: LinksDict = { "Azure Functions": - "[Azure](https://portal.azure.com/#blade/WebsitesExtension/FunctionsIFrameBladeMain)", + "[View](https://portal.azure.com/#blade/WebsitesExtension/FunctionsIFrameBladeMain)", "Cosmos DB": - "[Azure](https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.DocumentDb%2FdatabaseAccounts)", + "[View](https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.DocumentDb%2FdatabaseAccounts)", "App Service": - "[Azure](https://ms.portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.Web%2Fsites)" + "[View](https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.Web%2Fsites)" }; interface IStateProps { @@ -76,6 +78,8 @@ const PostGenerationModal = ({ history }: Props) => { const { formatMessage } = intl; + let serviceFailed = false; + const templateGenerated = isTemplateGenerated && !isTemplatesFailed; const templateGenerationInProgress = !isTemplateGenerated && !isTemplatesFailed; @@ -84,12 +88,6 @@ const PostGenerationModal = ({ {props.children} ); - const handleCloseWizard = () => { - vscode.postMessage({ - module: EXTENSION_MODULES.GENERATE, - command: EXTENSION_COMMANDS.CLOSE_WIZARD - }); - }; const handleOpenProjectOrRestartWizard = () => { if (isTemplatesFailed) { @@ -112,15 +110,7 @@ const PostGenerationModal = ({ if (isTemplatesFailed) { return formatMessage(messages.restartWizard); } - if (isTemplateGenerated) { - return formatMessage(messages.openInCode); - } - return ( - - - {formatMessage(messages.working)} - - ); + return formatMessage(messages.openInCode); }; const handleCreateAnotherProject = () => { @@ -128,41 +118,160 @@ const PostGenerationModal = ({ history.push(ROUTES.NEW_PROJECT); }; + const postGenMessage = () => { + return ( +
+ {isServicesSelected && ( +

+ {formatMessage(messages.generationCompleteWithAzure)} +

+ )} +

+ {formatMessage( + isServicesSelected + ? messages.seeReadMePrefixWithAzure + : messages.seeReadMePrefix + )} + + {formatMessage(messages.readMe)} + + {formatMessage(messages.seeReadMeSuffix)} +

+
+ ); + }; + + const renderTemplatesError = () => { + return ( +
+ {formatMessage(messages.failedToGenerate)} +
+ ); + }; + + const renderTemplatesStatus = () => { + return ( +
+ +
{formatMessage(messages.projectCreation)}
+ {templateGenerationInProgress && ( +
+ +
+ )} + {templateGenerated && ( +
+ +
+ )} + {isTemplatesFailed && ( +
+ +
+ )} +
+
+ ); + }; + + const renderServiceError = () => { + if (isTemplatesFailed) { + return ( +
+ {isServicesSelected && formatMessage(messages.deploymentHalted)} +
+ ); + } + return Object.keys(serviceStatus).map((service: string, idx: number) => { + const serviceTitle = formatMessage(serviceStatus[service].title); + if ( + serviceStatus[service].isSelected && + serviceStatus[service].isFailed + ) { + serviceFailed = true; + return ( +
{`${formatMessage(messages.error)} ${serviceTitle} ${formatMessage( + messages.deploymentFailure + )}`}
+ ); + } + }); + }; + const renderServiceStatus = () => { if (isTemplatesFailed) { - return formatMessage(messages.deploymentHalted); + return Object.keys(serviceStatus).map((service: string, idx: number) => { + const serviceTitle = formatMessage(serviceStatus[service].title); + if (serviceStatus[service].isSelected) { + const halted = `${serviceTitle} deployment halted`; + return ( +
+ +
{serviceTitle}
+
+ +
+
+
+ ); + } + }); } return Object.keys(serviceStatus).map((service: string, idx: number) => { const serviceTitle = formatMessage(serviceStatus[service].title); if (serviceStatus[service].isSelected) { if (serviceStatus[service].isFailed) { + const failed = `${serviceTitle} deployment failed`; return (
{`${formatMessage(messages.error)} ${serviceTitle} ${formatMessage( - messages.deploymentFailure - )}`}
+ className={styles.checkmarkStatusRow} + key={`${messages.isDeploying.defaultMessage}${idx}`} + > + +
{serviceTitle}
+
+ +
+
+ ); } if (serviceStatus[service].isDeployed) { + const deployed = `${serviceTitle} deployment done`; return ( - +
+
{serviceTitle}
+
+ +
+ +
+
+
); } + const inProgress = `${serviceTitle} deployment in progress`; return (
- {`${formatMessage(messages.isDeploying)} ${formatMessage( - serviceStatus[service].title - )}`} + +
{serviceTitle}
+
+ +
+
); } @@ -174,68 +283,43 @@ const PostGenerationModal = ({
{formatMessage(messages.creatingYourProject)}
-
-
- {isTemplatesFailed && formatMessage(messages.failedToGenerate)} -
- {!isTemplateGenerated && !isTemplatesFailed && ( + +
+ {templateGenerationInProgress && (
{templateGenStatus}
)} - {isTemplateGenerated && !isTemplatesFailed && ( -
-

- {formatMessage(messages.generationComplete)} -

-

- {formatMessage(messages.openReadMe)} - - {formatMessage(messages.readMe)} - - {formatMessage(messages.toStart)} -

-
- )} + {templateGenerated && postGenMessage()} + {isTemplatesFailed && renderTemplatesError()} + {isServicesSelected && renderServiceError()}
- {isServicesSelected && ( -
-
- {formatMessage(messages.azureServices)} -
-
{renderServiceStatus()}
-
- )} -
-
- {isTemplateGenerated && !isTemplatesFailed && isServicesDeployed && ( - - )} + +
+
+ {renderTemplatesStatus()} + {isServicesSelected && renderServiceStatus()}
-
- {isTemplateGenerated && !isTemplatesFailed && isServicesDeployed && ( + +
+ {(isTemplatesFailed || serviceFailed) && ( + + {formatMessage(messages.help)} + + )} + + {templateGenerated && isServicesDeployed && ( )} -
- -
+