Files
archie/ui/dist/assets/HarnessPage.js
T
sam f727d54d75 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
6.2 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,M as i,S as a,Xt as o,_t as s,b as c,dt as l,ir as u,jn as d,k as f,l as p,st as m,t as h,x as g,xn as _}from"./PageHeader.js";import{M as ee,n as v,r as y}from"./createLucideIcon.js";import{a as b,i as x,n as S,o as C,s as w,t as T}from"./select.js";import{a as E,i as D,n as O,o as k,r as A,s as j,t as M}from"./table.js";import{n as N,r as P,t as F}from"./alert.js";import{M as I,S as L,_ as R,n as z,r as B,s as V,w as H,y as U}from"./index.js";function W(e,t=Date.now()){if(!e.captured)return`unconfigured`;if(!e.expires_at)return`ready`;let n=Date.parse(e.expires_at);return Number.isNaN(n)?`ready`:n<=t?`expired`:n-t<=18e5?`expiring`:`ready`}function G(e,t,n=80,r=24){let i=t.protocol===`https:`?`wss:`:`ws:`,a=new URLSearchParams({profile:e,cols:String(n),rows:String(r)}).toString();return`${i}//${t.host}/api/harness/terminal?${a}`}var K={class:`flex h-full min-h-0 flex-col gap-2`},q={key:0,class:`text-sm text-fg-muted`,role:`status`},J=i({__name:`SetupTerminal`,props:{profile:{}},setup(e){let t=e,r=_(null),i=_(`connecting`),o=null,u=null,d=null,h=null;function g(){try{d?.fit()}catch{}}return l(()=>{let e=r.value;if(!e)return;o=new B({convertEol:!0,cursorBlink:!0,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`,cursor:`#e6edf3`,selectionBackground:`#264f78`}}),d=new z,o.loadAddon(d),o.open(e),g(),o.focus();let n=new WebSocket(G(t.profile,window.location,o?.cols??80,o?.rows??24));u=n,n.binaryType=`arraybuffer`,n.onopen=()=>{i.value=`open`},n.onmessage=e=>{o&&(typeof e.data==`string`?o.write(e.data):o.write(new Uint8Array(e.data)))},n.onerror=()=>{i.value=`failed`},n.onclose=()=>{i.value=`closed`},o.onData(e=>{n.readyState===WebSocket.OPEN&&n.send(e)}),h=new ResizeObserver(g),h.observe(e)}),m(()=>{h?.disconnect(),h=null,u?.close(),u=null,o?.dispose(),o=null,d=null}),(e,t)=>(s(),n(`div`,K,[i.value===`open`?a(``,!0):(s(),n(`p`,q,[i.value===`connecting`?(s(),n(p,{key:0},[f(`Connecting…`)],64)):i.value===`closed`?(s(),n(p,{key:1},[f(`The terminal session ended.`)],64)):(s(),n(p,{key:2},[f(`Could not open the setup terminal.`)],64))])),c(`div`,{ref_key:`host`,ref:r,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),Y={key:1,class:`flex flex-col gap-2`},X={class:`flex flex-wrap items-end gap-3`},Z={class:`flex flex-col gap-1 text-sm`},Q={class:`h-96`},$=i({__name:`HarnessPage`,setup(i){let m=_(null),z=_(!0),B=_(null),G=_(!1),K=_(``),q=_(!1),$={ready:{label:`Ready`,variant:`ok`},expiring:{label:`Expiring soon`,variant:`warn`},expired:{label:`Expired`,variant:`danger`},unconfigured:{label:`Not set up`,variant:`idle`}};l(te);async function te(){z.value=!0,B.value=null,G.value=!1;try{let e=await y.harnessBindings();m.value={terminal:e.terminal,bindings:e.bindings??[],profiles:e.profiles??[]},K.value=m.value.profiles[0]??``}catch(e){let t=e instanceof v?e.status:void 0;t===501||t===503?G.value=!0:B.value=e instanceof Error?e.message:String(e),m.value=null}finally{z.value=!1}}function ne(){m.value?.terminal&&K.value&&(q.value=!0)}function re(e){return e.scopes?.length?e.scopes.join(`, `):`–`}return(i,l)=>(s(),n(`div`,null,[t(h,{title:`Harness`}),B.value?(s(),g(d(P),{key:0,variant:`destructive`,class:`mb-4`},{default:o(()=>[t(d(F),null,{default:o(()=>[...l[1]||=[f(`Could not load the harness`,-1)]]),_:1}),t(d(N),null,{default:o(()=>[f(u(B.value),1)]),_:1})]),_:1})):a(``,!0),z.value?(s(),n(`div`,Y,[t(d(j),{class:`h-24 w-full`}),t(d(j),{class:`h-40 w-full`})])):G.value?(s(),g(d(L),{key:2},{default:o(()=>[t(d(U),null,{default:o(()=>[t(d(R),null,{default:o(()=>[...l[2]||=[f(`Harness bindings are not configured`,-1)]]),_:1})]),_:1})]),_:1})):m.value?(s(),n(p,{key:3},[m.value.terminal?(s(),g(d(H),{key:1},{default:o(()=>[c(`div`,X,[c(`div`,Z,[t(d(V),{for:`harness-profile`,class:`text-fg-muted`},{default:o(()=>[...l[5]||=[f(`Profile`,-1)]]),_:1}),t(d(w),{modelValue:K.value,"onUpdate:modelValue":l[0]||=e=>K.value=e,disabled:!m.value.profiles.length},{default:o(()=>[t(d(S),{id:`harness-profile`,size:`sm`,class:`min-w-48`},{default:o(()=>[t(d(T),{placeholder:`No profiles configured`})]),_:1}),t(d(C),null,{default:o(()=>[t(d(b),null,{default:o(()=>[(s(!0),n(p,null,r(m.value.profiles,e=>(s(),g(d(x),{key:e,value:e},{default:o(()=>[f(u(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`modelValue`,`disabled`])]),t(d(ee),{disabled:!K.value,onClick:ne},{default:o(()=>[...l[6]||=[f(`Open setup terminal`,-1)]]),_:1},8,[`disabled`])])]),_:1})):(s(),g(d(P),{key:0,class:`mb-4`},{default:o(()=>[t(d(F),null,{default:o(()=>[...l[3]||=[f(`Setup terminal unavailable`,-1)]]),_:1}),t(d(N),null,{default:o(()=>[...l[4]||=[f(`Start the daemon with a container runtime and a harness token to log in to a CLI from here.`,-1)]]),_:1})]),_:1})),q.value&&K.value?(s(),g(d(H),{key:2},{default:o(()=>[c(`div`,Q,[t(J,{profile:K.value},null,8,[`profile`])])]),_:1})):a(``,!0),t(d(H),null,{default:o(()=>[t(d(k),null,{default:o(()=>[t(d(M),null,{default:o(()=>[t(d(A),null,{default:o(()=>[t(d(O),null,{default:o(()=>[...l[7]||=[f(`Service`,-1)]]),_:1}),t(d(O),null,{default:o(()=>[...l[8]||=[f(`Status`,-1)]]),_:1}),t(d(O),null,{default:o(()=>[...l[9]||=[f(`Expires`,-1)]]),_:1}),t(d(O),null,{default:o(()=>[...l[10]||=[f(`Scopes`,-1)]]),_:1}),t(d(O),null,{default:o(()=>[...l[11]||=[f(`Updated`,-1)]]),_:1})]),_:1})]),_:1}),t(d(E),null,{default:o(()=>[m.value.bindings.length?a(``,!0):(s(),g(d(A),{key:0},{default:o(()=>[t(d(D),{colspan:`5`,class:`text-fg-muted`},{default:o(()=>[...l[12]||=[f(`No credential bindings.`,-1)]]),_:1})]),_:1})),(s(!0),n(p,null,r(m.value.bindings,n=>(s(),g(d(A),{key:n.service},{default:o(()=>[t(d(D),{class:`font-medium`},{default:o(()=>[f(u(n.service),1)]),_:2},1024),t(d(D),null,{default:o(()=>[t(d(e),{variant:$[d(W)(n)].variant},{default:o(()=>[f(u($[d(W)(n)].label),1)]),_:2},1032,[`variant`])]),_:2},1024),t(d(D),null,{default:o(()=>[t(d(I),{at:n.expires_at,absolute:``},null,8,[`at`])]),_:2},1024),t(d(D),{class:`text-fg-muted`},{default:o(()=>[f(u(re(n)),1)]),_:2},1024),t(d(D),{class:`text-fg-muted`},{default:o(()=>[t(d(I),{at:n.updated_at},null,8,[`at`])]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1})]),_:1})],64)):a(``,!0)]))}});export{$ as default};