import{a as N}from"./chunk-PWF76NCM.js";import{a as F}from"./chunk-7PK6Q4UU.js";import{C as d,F as c,G as x,H as i,I as n,J as h,K as k,L as f,M as b,N as r,O as l,P as S,Q as C,W as g,X as D,Y as E,da as R,ea as y,fa as I,k as u,la as T,m as _,ma as W,n as v,t as a,w}from"./chunk-O7TQGEFF.js";var $=o=>["/workflows",o],V=o=>["/runs",o],B=(o,e)=>e.name,M=(o,e)=>e.runId;function O(o,e){if(o&1){let t=k();i(0,"div",3)(1,"a",9)(2,"div",10),r(3),n(),i(4,"div",11),r(5),n()(),i(6,"div",12)(7,"span",13),r(8),n(),i(9,"button",14),f("click",function(){let m=_(t).$implicit,p=b();return v(p.openRunDialog(m.name))}),r(10,"Run \u25B6"),n()()()}if(o&2){let t=e.$implicit;a(),d("routerLink",g(4,$,t.name)),a(2),l(t.name),a(2),l(t.description),a(3),S("",t.nodeCount," nodes")}}function A(o,e){if(o&1&&(i(0,"div",6)(1,"span",15),r(2),n(),i(3,"span",16),r(4),n(),i(5,"span")(6,"span",17),r(7),n()(),i(8,"span",13),r(9),D(10,"date"),n(),i(11,"a",18),r(12,"View \u2192"),n()()),o&2){let t=e.$implicit,s=b();a(2),l(t.runId),a(2),l(t.workflow),a(2),d("ngClass",s.statusClass(t.status)),a(),C(" ",s.statusIcon(t.status)," ",t.status," "),a(2),l(E(10,7,t.startedAt,"short")),a(2),d("routerLink",g(10,V,t.runId))}}function P(o,e){o&1&&(i(0,"div",7),r(1,'No runs yet. Click "Run \u25B6" on a workflow to start.'),n())}var L=class o{api=u(F);router=u(T);workflows=[];runs=[];showRunDialog=!1;selectedWorkflow="";ngOnInit(){this.api.getWorkflows().subscribe(e=>this.workflows=e),this.api.getRuns().subscribe(e=>this.runs=e.reverse())}openRunDialog(e){this.selectedWorkflow=e,this.showRunDialog=!0}onStartRun(e){this.showRunDialog=!1,this.api.startRun(this.selectedWorkflow,e).subscribe(t=>{this.router.navigate(["/runs",t.runId])})}statusClass(e){switch(e){case"completed":return"bg-green-500/10 text-green-400";case"failed":return"bg-red-500/10 text-red-400";case"running":return"bg-blue-500/10 text-blue-400";default:return"bg-slate-700 text-slate-400"}}statusIcon(e){switch(e){case"completed":return"\u2713";case"failed":return"\u2717";case"running":return"\u25CF";default:return"\u25CB"}}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=w({type:o,selectors:[["app-dashboard"]],decls:23,vars:3,consts:[[1,"max-w-6xl","mx-auto"],[1,"text-xs","font-semibold","text-slate-400","uppercase","tracking-wider","mb-3"],[1,"grid","grid-cols-1","md:grid-cols-2","lg:grid-cols-3","gap-3","mb-8"],[1,"bg-slate-800","rounded-lg","p-4","border","border-slate-700","hover:border-slate-600","transition-colors"],[1,"bg-slate-800","rounded-lg","border","border-slate-700","overflow-hidden"],[1,"grid","grid-cols-[1fr_1.5fr_1fr_1fr_0.5fr]","px-4","py-2","text-xs","text-slate-500","uppercase","border-b","border-slate-700"],[1,"grid","grid-cols-[1fr_1.5fr_1fr_1fr_0.5fr]","px-4","py-2.5","text-sm","border-b","border-slate-800","items-center"],[1,"px-4","py-6","text-center","text-sm","text-slate-500"],[3,"run","closed","visible","workflowName"],[1,"block",3,"routerLink"],[1,"font-semibold","text-slate-100","mb-1"],[1,"text-xs","text-slate-500","mb-3","line-clamp-2"],[1,"flex","items-center"],[1,"text-xs","text-slate-400"],[1,"ml-auto","bg-blue-600","text-white","text-xs","px-3","py-1","rounded","hover:bg-blue-500",3,"click"],[1,"font-mono","text-slate-400","text-xs"],[1,"text-slate-100"],[1,"text-xs","px-2","py-0.5","rounded",3,"ngClass"],[1,"text-xs","text-blue-400","hover:text-blue-300",3,"routerLink"]],template:function(t,s){t&1&&(i(0,"div",0)(1,"h2",1),r(2,"Workflows"),n(),i(3,"div",2),c(4,O,11,6,"div",3,B),n(),i(6,"h2",1),r(7,"Recent Runs"),n(),i(8,"div",4)(9,"div",5)(10,"span"),r(11,"Run ID"),n(),i(12,"span"),r(13,"Workflow"),n(),i(14,"span"),r(15,"Status"),n(),i(16,"span"),r(17,"Started"),n(),h(18,"span"),n(),c(19,A,13,12,"div",6,M,!1,P,2,0,"div",7),n()(),i(22,"app-run-dialog",8),f("run",function(p){return s.onStartRun(p)})("closed",function(){return s.showRunDialog=!1}),n()),t&2&&(a(4),x(s.workflows),a(15),x(s.runs),a(3),d("visible",s.showRunDialog)("workflowName",s.selectedWorkflow))},dependencies:[I,R,y,W,N],encapsulation:2})};export{L as DashboardComponent};
