Fixed some bugs in web app regarding 'cancelled' status and retrying.

This commit is contained in:
Martin Sosic 2023-07-09 19:38:43 +02:00
parent 9209ef4079
commit 41278cd04a
3 changed files with 11 additions and 18 deletions

View File

@ -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;
}

View File

@ -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 }) {
/>
<div className="flex justify-between items-flex-start">
<div className="flex-shrink-0 mr-3">
{(status === "inProgress" || status === "pending") && <Loader />}
{(status === "inProgress" || status === "pending") &&
<Loader />
}
{status === "success" && (
<div className="status-icon bg-green-500">
<CheckIcon className="w-4 h-4 text-white" />
</div>
)}
{status === "error" && (
{status === "error" || status === "cancelled" && (
<div className="status-icon bg-red-500">
<XMarkIcon className="w-4 h-4 text-white" />
</div>

View File

@ -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);
}
}