Add bot schedules (routines), open Activity, add Help and a Desktop computer view
Bots create, list, update and delete schedules (cron_jobs, Bun.cron in UTC); a per-minute cron queues due runs as tasks. Routines, Activity (super admins) and Help get their own rail aside. Help covers familiar problems, starting with signing in to Google through Cookie-Editor over the new Desktop (noVNC) view. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import type { CronJobWithNames } from "@/src/types";
|
||||
|
||||
type Params = {
|
||||
cron_job: CronJobWithNames;
|
||||
};
|
||||
|
||||
/**
|
||||
* One schedule as a bot reads it: id, title, expression, where it runs,
|
||||
* its state and next run (ISO, UTC), and the last error if any.
|
||||
*/
|
||||
export default function describeCronJob({ cron_job }: Params) {
|
||||
const runs = Number(cron_job.run_count || 0);
|
||||
const parts = [
|
||||
`#${cron_job.id} "${cron_job.title}"`,
|
||||
`\`${cron_job.schedule}\` (UTC)`,
|
||||
cron_job.workspace_name ? `in the workspace ${cron_job.workspace_name}` : `in your own chat`,
|
||||
cron_job.computer_id ? `on computer ${cron_job.computer_id}` : "",
|
||||
cron_job.enabled
|
||||
? cron_job.next_run_at
|
||||
? `next run ${new Date(cron_job.next_run_at).toISOString()}`
|
||||
: "no next run"
|
||||
: "paused",
|
||||
`${runs}${cron_job.max_runs ? ` of ${cron_job.max_runs}` : ""} run${runs == 1 ? "" : "s"} so far`,
|
||||
cron_job.last_error ? `last error: ${cron_job.last_error}` : "",
|
||||
];
|
||||
|
||||
return parts.filter(Boolean).join(", ");
|
||||
}
|
||||
Reference in New Issue
Block a user