mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-12-27 02:52:22 +03:00
Uses status from DB
This commit is contained in:
parent
3b6b6ddf1a
commit
23d29cb370
@ -49,6 +49,7 @@ entity Project {=psl
|
|||||||
name String
|
name String
|
||||||
description String
|
description String
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
|
status String @default("in-progress")
|
||||||
files File[]
|
files File[]
|
||||||
logs Log[]
|
logs Log[]
|
||||||
psl=}
|
psl=}
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Project" ADD COLUMN "status" TEXT NOT NULL DEFAULT 'in-progress';
|
@ -30,14 +30,14 @@ export const ResultPage = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
appGenerationResult?.status === "success" ||
|
appGenerationResult?.project?.status === "success" ||
|
||||||
appGenerationResult?.status === "failure"
|
appGenerationResult?.project?.status === "failure"
|
||||||
) {
|
) {
|
||||||
setGenerationDone(true);
|
setGenerationDone(true);
|
||||||
setCurrentStatus({
|
setCurrentStatus({
|
||||||
status: appGenerationResult.status === "success" ? "success" : "error",
|
status: appGenerationResult.project.status === "success" ? "success" : "error",
|
||||||
message:
|
message:
|
||||||
appGenerationResult.status === "success"
|
appGenerationResult.project.status === "success"
|
||||||
? "Finished"
|
? "Finished"
|
||||||
: "There was an error",
|
: "There was an error",
|
||||||
});
|
});
|
||||||
|
@ -35,7 +35,6 @@ export const startGeneratingNewApp: StartGeneratingNewApp<
|
|||||||
|
|
||||||
const appId = project.id;
|
const appId = project.id;
|
||||||
appGenerationResults[appId] = {
|
appGenerationResults[appId] = {
|
||||||
status: "in-progress",
|
|
||||||
unconsumedStdout: "",
|
unconsumedStdout: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -132,17 +131,26 @@ export const startGeneratingNewApp: StartGeneratingNewApp<
|
|||||||
console.error(data.toString());
|
console.error(data.toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
waspCliProcess.on("close", (code) => {
|
waspCliProcess.on("close", async (code) => {
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
appGenerationResults[appId].status = "success";
|
await Project.update({
|
||||||
|
where: { id: appId },
|
||||||
|
data: { status: "success" },
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
appGenerationResults[appId].status = "failure";
|
await Project.update({
|
||||||
|
where: { id: appId },
|
||||||
|
data: { status: "failure" },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
waspCliProcess.on("error", (err) => {
|
waspCliProcess.on("error", async (err) => {
|
||||||
console.error("WASP CLI PROCESS ERROR", err);
|
console.error("WASP CLI PROCESS ERROR", err);
|
||||||
appGenerationResults[appId].status = "failure";
|
await Project.update({
|
||||||
|
where: { id: appId },
|
||||||
|
data: { status: "failure" },
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return appId;
|
return appId;
|
||||||
@ -164,7 +172,6 @@ export const getAppGenerationResult = (async (args, context) => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
status: appGenerationResults[appId]?.status ?? "success",
|
|
||||||
project,
|
project,
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user