diff --git a/packages/app/src/ui.ts b/packages/app/src/ui.ts index 37f87edd..d74952c7 100644 --- a/packages/app/src/ui.ts +++ b/packages/app/src/ui.ts @@ -44,7 +44,7 @@ export const landingPage = (viewer: Viewer) => shell("Factorize: Software Factor `); -const dashboardHead = (title: string, description: string, action = "") => `

${title}

${description}

${action}
`; +const dashboardHead = (title: string, description: string, action = "") => `

${title}

${description ? `

${description}

` : ""}
${action}
`; const card = "rounded-2xl border border-stone-200 bg-white shadow-sm dark:border-slate-800 dark:bg-slate-900"; const uiHelpers = ` const $=s=>document.querySelector(s),esc=v=>String(v??'').replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c])); @@ -59,9 +59,9 @@ const jobStatus=j=>{if(j.runningCount>0)return{label:'Running',classes:'bg-blue- `; export const jobsPage = (viewer: { email: string }) => shell("Jobs — Factorize", viewer, `
-${dashboardHead("Jobs", "Create reusable agent work and choose exactly how it starts.", 'Create job')} +${dashboardHead("Jobs", "", 'Create job')}

Loading jobs…

`, `${uiHelpers} -async function load(){const jobs=await request('/api/v1/jobs');const root=$('#jobs');if(!jobs.length){root.innerHTML='

No jobs yet

Create a manual-only or automatically triggered job.

';return}root.innerHTML=''}load().catch(e=>$('#jobs').innerHTML='

'+esc(e.message)+'

');`); +async function load(){const jobs=await request('/api/v1/jobs');const root=$('#jobs');if(!jobs.length){root.innerHTML='

No jobs yet

Create a manual-only or automatically triggered job.

';return}root.innerHTML=''}load().catch(e=>$('#jobs').innerHTML='

'+esc(e.message)+'

');`); export const jobPage = (viewer: { email: string }, jobId?: string) => shell(`${jobId ? "Edit" : "Create"} job — Factorize`, viewer, `
← Jobs
${dashboardHead(jobId ? "Edit job" : "Create a job", "Every prompt input comes from an explicit trigger row with a stable context slug.")}

Step 1

Job details

Name this job and set how many runs it can process at once.

diff --git a/packages/app/test/ui.test.ts b/packages/app/test/ui.test.ts index 5147569a..ce1d79e3 100644 --- a/packages/app/test/ui.test.ts +++ b/packages/app/test/ui.test.ts @@ -246,13 +246,17 @@ describe("pages", () => { const detail = jobDetailPage({ email: "owner@example.com" }, "job-1"); const run = jobRunPage({ email: "owner@example.com" }, "run-1"); const settings = settingsPage({ email: "owner@example.com" }); - expect(list).toContain("Manual only"); expect(list).toContain("jobStatus(j)"); expect(list).toContain("j.runningCount>0"); expect(list).toContain("Last run failed"); expect(list).toContain("Last run succeeded"); expect(list).toContain("/'+esc(j.concurrencyLimit)+' Running"); - expect(list).not.toContain("+' concurrent · updated '"); + expect(list).toMatch(/

Jobs<\/h1><\/div>triggerBadge(t.kind))"); + expect(list).not.toContain("new Date(j.updatedAt)"); + expect(list).not.toContain("new Date(next)"); + expect(list).not.toContain(">View →"); expect(editor).toContain("Add trigger"); expect(editor).toContain('id="trigger-rows"'); expect(editor).toContain("Context slug");