feat: cron agent binding + doctor UI refresh
This commit is contained in:
@@ -175,6 +175,7 @@ declare global {
|
||||
const DEFAULT_CRON_FORM: CronFormState = {
|
||||
name: "",
|
||||
description: "",
|
||||
agentId: "",
|
||||
enabled: true,
|
||||
scheduleKind: "every",
|
||||
scheduleAt: "",
|
||||
|
||||
@@ -99,9 +99,11 @@ export async function addCronJob(state: CronState) {
|
||||
try {
|
||||
const schedule = buildCronSchedule(state.cronForm);
|
||||
const payload = buildCronPayload(state.cronForm);
|
||||
const agentId = state.cronForm.agentId.trim();
|
||||
const job = {
|
||||
name: state.cronForm.name.trim(),
|
||||
description: state.cronForm.description.trim() || undefined,
|
||||
agentId: agentId || undefined,
|
||||
enabled: state.cronForm.enabled,
|
||||
schedule,
|
||||
sessionTarget: state.cronForm.sessionTarget,
|
||||
|
||||
@@ -157,6 +157,7 @@ export type IMessageForm = {
|
||||
export type CronFormState = {
|
||||
name: string;
|
||||
description: string;
|
||||
agentId: string;
|
||||
enabled: boolean;
|
||||
scheduleKind: "at" | "every" | "cron";
|
||||
scheduleAt: string;
|
||||
|
||||
@@ -82,6 +82,15 @@ export function renderCron(props: CronProps) {
|
||||
props.onFormChange({ description: (e.target as HTMLInputElement).value })}
|
||||
/>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span>Agent ID</span>
|
||||
<input
|
||||
.value=${props.form.agentId}
|
||||
@input=${(e: Event) =>
|
||||
props.onFormChange({ agentId: (e.target as HTMLInputElement).value })}
|
||||
placeholder="default"
|
||||
/>
|
||||
</label>
|
||||
<label class="field checkbox">
|
||||
<span>Enabled</span>
|
||||
<input
|
||||
@@ -338,6 +347,7 @@ function renderJob(job: CronJob, props: CronProps) {
|
||||
<div class="list-title">${job.name}</div>
|
||||
<div class="list-sub">${formatCronSchedule(job)}</div>
|
||||
<div class="muted">${formatCronPayload(job)}</div>
|
||||
${job.agentId ? html`<div class="muted">Agent: ${job.agentId}</div>` : nothing}
|
||||
<div class="chip-row" style="margin-top: 6px;">
|
||||
<span class="chip">${job.enabled ? "enabled" : "disabled"}</span>
|
||||
<span class="chip">${job.sessionTarget}</span>
|
||||
|
||||
Reference in New Issue
Block a user