mirror of
https://github.com/domfelipe/mika-agent-assist.git
synced 2026-08-07 13:16:51 +00:00
Changes
Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com>
This commit is contained in:
parent
6c0ccff305
commit
c6b67e98b8
9 changed files with 1033 additions and 141 deletions
|
|
@ -142,16 +142,29 @@ export function useCreateCronjob() {
|
|||
});
|
||||
}
|
||||
|
||||
export async function markCronjobRuntimeSyncError(id: string, detail: string) {
|
||||
const message = detail.slice(0, 2000);
|
||||
const { error } = await supabase
|
||||
.from("scheduled_jobs")
|
||||
.update({
|
||||
status: "error",
|
||||
auto_paused_reason: "Falha ao sincronizar esta automação com o runtime do agente.",
|
||||
runtime_state: "error",
|
||||
runtime_last_status: "error",
|
||||
runtime_last_error: message,
|
||||
})
|
||||
.eq("id", id);
|
||||
|
||||
if (error) throw error;
|
||||
}
|
||||
|
||||
export function useUpdateCronjobStatus() {
|
||||
const qc = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: async ({ id, status }: { id: string; status: "active" | "paused" }) => {
|
||||
const update: { status: "active" | "paused"; auto_paused_reason?: null } = { status };
|
||||
if (status === "paused") update.auto_paused_reason = null;
|
||||
const { error } = await supabase
|
||||
.from("scheduled_jobs")
|
||||
.update(update)
|
||||
.eq("id", id);
|
||||
const { error } = await supabase.from("scheduled_jobs").update(update).eq("id", id);
|
||||
if (error) throw error;
|
||||
},
|
||||
onSuccess: () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue