Files
archie/ui/dist/assets/ScheduleRunsPage.js
T
sam d4e563a19c feat(ui): schedules table, runs page and Schedule trigger
Schedules list as a table with enable, run now, edit, duplicate, delete and
view runs; built-ins only enable, retime and run. The runs page links each
run's tasks through its capture's dispatches. The Start node gains a Schedule
trigger that picks or creates a schedule and binds the schedule source to the
workflow. Times show in a per-browser display zone set under Appearance; the
cron time zone and run retention are edited on the Schedules page.
2026-10-26 00:57:52 +11:00

1 line
3.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{t as e}from"./badge.js";import{A as t,C as n,Ct as r,Gt as i,M as a,S as o,Tt as s,Xt as c,_t as l,b as u,ht as d,ir as f,jn as p,k as m,l as h,t as g,x as _,xn as v,y}from"./PageHeader.js";import{M as b,r as x}from"./createLucideIcon.js";import{G as S,i as C,s as w,t as T}from"./schedule.js";import{s as E}from"./table.js";import{I as D,M as O,w as k,z as A}from"./index.js";var j={key:0,class:`mb-4 text-sm text-danger`,role:`alert`},M={key:0,class:`space-y-2`},N={class:`tabular-nums text-fg-muted`},P={class:`block max-w-md break-words whitespace-normal text-danger`},F={class:`flex flex-wrap gap-2`},I=a({__name:`ScheduleRunsPage`,setup(a){let I=S(),L=y(()=>String(I.params.id??``)),R=v(null),z=v(null),B=v(``);async function V(){let e=L.value;try{let[t,n]=await Promise.all([x.schedules(),x.scheduleRuns(e)]);if(e!==L.value)return;R.value=t.schedules?.find(t=>t.id===e)??null,z.value=n.runs??[],B.value=``}catch(t){e===L.value&&(B.value=t instanceof Error?t.message:String(t))}}i(L,()=>{z.value=null,V()},{immediate:!0});let H=setInterval(()=>void V(),15e3);d(()=>clearInterval(H));async function U(){B.value=``;try{await x.scheduleRunNow(L.value),await V()}catch(e){B.value=e instanceof Error?e.message:String(e)}}let W=[{id:`scheduled`,label:`Scheduled`,fixed:!0,sort:e=>e.scheduled_for},{id:`started`,label:`Started`},{id:`duration`,label:`Duration`},{id:`result`,label:`Result`,sort:e=>e.result},{id:`error`,label:`Error`},{id:`tasks`,label:`Tasks`}];return(i,a)=>{let d=s(`RouterLink`);return l(),n(`div`,null,[t(g,{title:R.value?.name||`Schedule runs`},{default:c(()=>[t(p(b),{variant:`ghost`,size:`sm`,"as-child":``},{default:c(()=>[t(d,{to:`/org/schedules`},{default:c(()=>[t(p(A),{"data-icon":`inline-start`}),a[0]||=m(`Schedules`,-1)]),_:1})]),_:1}),t(p(b),{size:`sm`,disabled:!R.value,onClick:U},{default:c(()=>[t(p(D),{"data-icon":`inline-start`}),a[1]||=m(`Run now`,-1)]),_:1},8,[`disabled`])]),_:1},8,[`title`]),B.value?(l(),n(`p`,j,f(B.value),1)):o(``,!0),t(p(k),null,{default:c(()=>[!z.value&&!B.value?(l(),n(`div`,M,[t(p(E),{class:`h-8 w-full`}),t(p(E),{class:`h-8 w-full`})])):z.value?(l(),_(p(w),{key:1,columns:W,rows:z.value,"row-key":e=>String(e.id),"storage-key":`schedule-runs`,"initial-sort":{id:`scheduled`,desc:!0}},{empty:c(()=>[...a[2]||=[u(`p`,{class:`py-4 text-center text-sm text-fg-subtle`},`No runs yet.`,-1)]]),"cell-scheduled":c(({row:e})=>[t(p(O),{at:e.scheduled_for,absolute:``},null,8,[`at`])]),"cell-started":c(({row:e})=>[t(p(O),{at:e.started,absolute:``},null,8,[`at`])]),"cell-duration":c(({row:e})=>[u(`span`,N,f(p(C)(e)||`–`),1)]),"cell-result":c(({row:n})=>[t(p(e),{variant:p(T)[n.result]??`idle`},{default:c(()=>[m(f(n.result),1)]),_:2},1032,[`variant`])]),"cell-error":c(({row:e})=>[u(`span`,P,f(e.error),1)]),"cell-tasks":c(({row:e})=>[u(`span`,F,[(l(!0),n(h,null,r(e.task_ids??[],e=>(l(),_(d,{key:e,to:`/tasks/${e}`,class:`font-mono hover:underline`},{default:c(()=>[m(`#`+f(e),1)]),_:2},1032,[`to`]))),128))])]),_:1},8,[`rows`,`row-key`])):o(``,!0)]),_:1})])}}});export{I as default};