This commit is contained in:
Ishaan Dey
2024-05-25 01:16:25 -07:00
parent a16b530b56
commit a90c09200d
3 changed files with 86 additions and 60 deletions

View File

@ -34,50 +34,55 @@ export default function Editor({
return;
}
startServer(sandboxData.id).then((response) => {
if (!response.success) {
toast.error(response.message);
setDidFail(true);
} else {
setIsServiceRunning(true);
// startServer(sandboxData.id).then((response) => {
// if (!response.success) {
// toast.error(response.message);
// setDidFail(true);
// } else {
// setIsServiceRunning(true);
checkServiceStatus(sandboxData.id)
.then(() => {
setIsDeploymentActive(true);
// checkServiceStatus(sandboxData.id)
// .then(() => {
// setIsDeploymentActive(true);
getTaskIp(sandboxData.id)
.then((ip) => {
setTaskIp(ip);
})
.catch(() => {
setDidFail(true);
toast.error("An error occurred while getting your server IP.");
});
})
.catch(() => {
toast.error("An error occurred while initializing your server.");
setDidFail(true);
});
}
});
// getTaskIp(sandboxData.id)
// .then((ip) => {
// setTaskIp(ip);
// })
// .catch(() => {
// setDidFail(true);
// toast.error("An error occurred while getting your server IP.");
// });
// })
// .catch(() => {
// toast.error("An error occurred while initializing your server.");
// setDidFail(true);
// });
// }
// });
}, []);
if (didFail) return <Loading didFail={didFail} />;
if (!isServiceRunning || !isDeploymentActive || !taskIp)
return (
<Loading
text="Creating sandbox resources"
description={
isDeploymentActive
? "Preparing server networking..."
: isServiceRunning
? "Initializing server, this could take a minute..."
: "Requesting your server creation..."
}
/>
);
// if (didFail) return <Loading didFail={didFail} />;
// if (!isServiceRunning || !isDeploymentActive || !taskIp)
// return (
// <Loading
// text="Creating sandbox resources"
// description={
// isDeploymentActive
// ? "Preparing server networking..."
// : isServiceRunning
// ? "Initializing server, this could take a minute..."
// : "Requesting your server creation..."
// }
// />
// );
return (
<CodeEditor ip={taskIp} userData={userData} sandboxData={sandboxData} />
<CodeEditor
ip={"localhost"}
// ip={taskIp}
userData={userData}
sandboxData={sandboxData}
/>
);
}