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