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)=>'