fix(schedule): return deployment metadata from runManually and fail early on missing container

This commit is contained in:
Mauricio Siu
2026-08-02 16:15:20 -06:00
parent a058d1f5c7
commit cbb3450b93
3 changed files with 90 additions and 68 deletions
@@ -58,8 +58,12 @@ export const ShowSchedules = ({ id, scheduleType = "application" }: Props) => {
const handleRunManually = async (scheduleId: string) => {
setRunningSchedules((prev) => new Set(prev).add(scheduleId));
try {
await runManually({ scheduleId });
toast.success("Schedule run successfully");
const result = await runManually({ scheduleId });
if (result.status === "error") {
toast.error("Schedule run failed, check the deployment logs");
} else {
toast.success("Schedule run successfully");
}
await refetchSchedules();
} catch {
toast.error("Error running schedule");
+6 -2
View File
@@ -329,13 +329,17 @@ export const scheduleRouter = createTRPCRouter({
await checkPermission(ctx, { schedule: ["create"] });
}
try {
await runCommand(input.scheduleId);
const deployment = await runCommand(input.scheduleId);
await audit(ctx, {
action: "run",
resourceType: "schedule",
resourceId: input.scheduleId,
});
return true;
return {
status: deployment.status,
deploymentId: deployment.deploymentId,
logPath: deployment.logPath,
};
} catch (error) {
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",