From 6cb1682453f93d9e2979800345ce2e66e192b657 Mon Sep 17 00:00:00 2001 From: Brendan Date: Thu, 17 Sep 2026 14:58:20 +0000 Subject: [PATCH] Fix GitHub webhook rule editor options --- packages/app/src/ui.ts | 1 + packages/app/test/ui.test.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/packages/app/src/ui.ts b/packages/app/src/ui.ts index bbd04396..de4f0c10 100644 --- a/packages/app/src/ui.ts +++ b/packages/app/src/ui.ts @@ -108,6 +108,7 @@ const showTriggerDialog=dialog.showModal.bind(dialog);dialog.showModal=()=>{if(t async function refreshAvailability(){availability=await request('/api/v1/job-trigger-availability');const select=$('#add-trigger'),selected=select.value;select.replaceChildren(new Option('Add trigger…',''),...Object.entries(kinds).filter(([kind])=>availability[kind]).map(([kind,label])=>new Option(label,kind)));select.value=selected;select.disabled=false} const ruleLabels={status:'Status',label:'Label',assignee:'Assignee',creator:'Creator',owner:'Owner'}; const ruleOptions=type=>type==='status'?resources.options.statuses:type==='label'?resources.options.labels:resources.options.users; +const githubRuleOptions=type=>type==='status'?resources.githubOptions.statuses:type==='label'?resources.githubOptions.labels:resources.githubOptions.users; const ruleSummary=rule=>ruleLabels[rule.type]+' is '+nameOf(ruleOptions(rule.type),rule.targetId); function summary(t){const c=t.config||{},k=providerKind(t);if(k==='manual')return 'Prompt entered when run';if(k==='schedule')return c.cron+' · '+c.timezone;if(k==='linear')return nameOf(resources.projects,c.projectId)+' · '+(c.matchRules||[]).map(ruleSummary).join(' + ');if(k==='clickup')return nameOf(resources.clickupLists,c.listId)+' · '+(c.matchRules||[]).map(ruleSummary).join(' + ');if(k==='github'){const i=resources.installations.find(x=>String(x.installationId)===String(c.installationId));const repos=resources.repositories.get(String(c.installationId))||[];return (i?.accountLogin||c.installationId)+' · '+(repos.find(x=>String(x.id)===String(c.repositoryId))?.fullName||c.repositoryId)+' · '+c.event+'/'+c.action}if(k==='cloudflareTail')return 'Managed signed Tail endpoint'+(c.handlerCode?' · handler':'');return (c.sourceJobIds||[]).map(id=>resources.jobs.find(j=>j.id===id)?.name||id).join(', ')+' · '+(c.states||[]).join(', ')} function render(){const rows=$('#trigger-rows');rows.innerHTML=triggers.map((t,i)=>''+esc(t.slug)+''+esc(kinds[providerKind(t)])+(t.actionRequired?'Action required':'')+''+esc(t.actionRequired||summary(t))+'
').join('');$('#trigger-empty').classList.toggle('hidden',triggers.length>0);const hints=triggerHints();$('#context-paths').innerHTML=hints.length?'Available context: '+hints.map(x=>'').join(''):'Add a trigger to expose context.';updateSuggestions()} diff --git a/packages/app/test/ui.test.ts b/packages/app/test/ui.test.ts index fbefe5ad..caf7f699 100644 --- a/packages/app/test/ui.test.ts +++ b/packages/app/test/ui.test.ts @@ -99,6 +99,8 @@ describe("pages", () => { expect(html).toContain('id="add-github-rule"'); expect(html).toContain("matchRules:readGithubRules()"); expect(html).toContain("status:'Status',label:'Label',assignee:'Assignee',creator:'Creator',owner:'Owner'"); + expect(html).toContain("const githubRuleOptions=type=>type==='status'?resources.githubOptions.statuses:type==='label'?resources.githubOptions.labels:resources.githubOptions.users;"); + expect(html).toContain("githubRuleOptions(type.value).map"); expect(html).toContain("matchRules:readLinearRules()"); expect(html).toContain("(c.matchRules?.length?c.matchRules:"); expect(html).not.toContain("const legacyJobPage");