From 41278cd04aa3a5969727f7d798d53c3b7c81ab80 Mon Sep 17 00:00:00 2001 From: Martin Sosic Date: Sun, 9 Jul 2023 19:38:43 +0200 Subject: [PATCH] Fixed some bugs in web app regarding 'cancelled' status and retrying. --- wasp-ai/src/client/Main.css | 4 ++-- wasp-ai/src/client/components/Logs.jsx | 10 ++++++---- wasp-ai/src/client/pages/ResultPage.jsx | 15 +++------------ 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/wasp-ai/src/client/Main.css b/wasp-ai/src/client/Main.css index 26d954f00..73e7820ae 100644 --- a/wasp-ai/src/client/Main.css +++ b/wasp-ai/src/client/Main.css @@ -43,7 +43,7 @@ textarea { @apply bg-green-50 text-green-800; } -.big-box.error { +.big-box.error, .big-box.cancelled { @apply bg-red-50 text-red-800; } @@ -55,7 +55,7 @@ textarea { @apply bg-green-100 } -.big-box-button.error { +.big-box-button.error, .big-box-button.cancelled { @apply bg-red-100; } diff --git a/wasp-ai/src/client/components/Logs.jsx b/wasp-ai/src/client/components/Logs.jsx index c1f14da74..5f242e534 100644 --- a/wasp-ai/src/client/components/Logs.jsx +++ b/wasp-ai/src/client/components/Logs.jsx @@ -18,7 +18,6 @@ export function Logs({ logs, status, onRetry }) { } function getEmoji(log) { - // log.toLowerCase().includes("generated") ? "✅ " : "⌛️ " if ( log.toLowerCase().includes("generated") || log.toLowerCase().includes("fixed") || @@ -32,7 +31,8 @@ export function Logs({ logs, status, onRetry }) { } if ( log.toLowerCase().includes("error") || - log.toLowerCase().includes("fail") + log.toLowerCase().includes("fail") || + log.toLowerCase().includes("took too long") ) { return "❌"; } @@ -61,13 +61,15 @@ export function Logs({ logs, status, onRetry }) { />
- {(status === "inProgress" || status === "pending") && } + {(status === "inProgress" || status === "pending") && + + } {status === "success" && (
)} - {status === "error" && ( + {status === "error" || status === "cancelled" && (
diff --git a/wasp-ai/src/client/pages/ResultPage.jsx b/wasp-ai/src/client/pages/ResultPage.jsx index 67444b73b..14b7cc019 100644 --- a/wasp-ai/src/client/pages/ResultPage.jsx +++ b/wasp-ai/src/client/pages/ResultPage.jsx @@ -179,16 +179,9 @@ export const ResultPage = () => { !project.primaryColor || !project.authMethod ) { - setCurrentStatus({ - status: "error", - message: "Missing project data", - }); + alert("Missing project data"); return; } - setCurrentStatus({ - status: "inProgress", - message: "Retrying app generation", - }); try { const appId = await startGeneratingNewApp({ appName: project.name, @@ -196,12 +189,10 @@ export const ResultPage = () => { appPrimaryColor: project.primaryColor, appAuthMethod: project.authMethod, }); + alert("Now I will go to " + appId); history.push(`/result/${appId}`); } catch (e) { - setCurrentStatus({ - status: "error", - message: e.message, - }); + alert(e.message); } }