This change adds a single page application front-end to GARM. It uses a generated REST client, built from the swagger definitions, the websocket interface for live updates of entities and eager loading of everything except runners, as users may have many runners and we don't want to load hundreds of runners in memory. Proper pagination should be implemented in the API, in future commits, to avoid loading lots of elements for no reason. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
13 lines
21 KiB
JavaScript
13 lines
21 KiB
JavaScript
import"../chunks/DsnmJJEf.js";import{i as He}from"../chunks/B3Pzt0F_.js";import{p as Se,o as De,s as h,m as F,g as e,l as X,a as Le,f as c,b as E,j as o,k as n,r as t,u as i,t as P,v as ge,c as s,B as U,C as Y,e as I,d as Be,q as cr,h as gr,$ as hr}from"../chunks/D8EpLgQ1.js";import{a as me,i as w,s as Ae}from"../chunks/5WA7h8uK.js";import{c as _,s as Q,h as ur,B as fr,d as Ge}from"../chunks/CiE1LlKV.js";import{p as qe}from"../chunks/C41YH50Q.js";import{g as fe}from"../chunks/CTf6mQoE.js";import{b as l}from"../chunks/CoIRRsD9.js";import{b as Ne,a as mr}from"../chunks/duD3WMbl.js";import{e as ne,i as ce,w as xr}from"../chunks/u94nIB4-.js";import{t as Oe}from"../chunks/BEkVdVE1.js";const pr=async({url:Z})=>({url:Z.pathname}),kr=!1,br=!1,va=Object.freeze(Object.defineProperty({__proto__:null,load:pr,prerender:kr,ssr:br},Symbol.toStringTag,{value:"Module"}));var yr=c('<div class="flex items-center text-green-600 dark:text-green-400"><div class="w-2.5 h-2.5 bg-green-500 rounded-full mr-2 animate-pulse shadow-sm"></div> <span class="text-xs font-medium">Live Updates</span></div>'),_r=c('<div class="flex items-center text-yellow-600 dark:text-yellow-400"><div class="w-2.5 h-2.5 bg-yellow-500 rounded-full mr-2 animate-pulse shadow-sm"></div> <span class="text-xs font-medium">Connecting</span></div>'),wr=c('<div class="flex items-center text-red-600 dark:text-red-400"><div class="w-2.5 h-2.5 bg-red-500 rounded-full mr-2 shadow-sm"></div> <span class="text-xs font-medium">Updates Unavailable</span></div>'),Mr=c('<div class="flex items-center text-gray-500 dark:text-gray-400"><div class="w-2.5 h-2.5 bg-gray-400 rounded-full mr-2 shadow-sm"></div> <span class="text-xs font-medium">Manual Refresh</span></div>'),$r=Y('<svg class="h-4 w-4 text-yellow-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"></path></svg>'),jr=Y('<svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"></path></svg>'),zr=Y('<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path>'),Cr=Y('<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path>'),Hr=c('<a><svg class="mr-3 h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"><!></svg> </a>'),Sr=c('<a><svg class="mr-3 h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path></svg> </a>'),Lr=c('<div class="flex items-center"><div class="w-2 h-2 bg-green-500 rounded-full animate-pulse shadow-sm" title="Live updates enabled"></div></div>'),Br=c('<div class="flex items-center"><div class="w-2 h-2 bg-yellow-500 rounded-full animate-pulse shadow-sm" title="Connecting to live updates"></div></div>'),Ar=c('<div class="flex items-center"><div class="w-2 h-2 bg-red-500 rounded-full shadow-sm" title="Live updates unavailable"></div></div>'),Vr=c('<div class="flex items-center"><div class="w-2 h-2 bg-gray-400 rounded-full shadow-sm" title="Manual refresh mode"></div></div>'),Ir=Y('<svg class="w-5 h-5 text-yellow-400 hover:text-yellow-300" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"></path></svg>'),Rr=Y('<svg class="w-5 h-5 text-black hover:text-gray-800" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"></path></svg>'),Tr=Y('<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path>'),Pr=Y('<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path>'),Er=c('<a><svg class="mr-4 flex-shrink-0 h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><!></svg> </a>'),Gr=c('<a><svg class="mr-4 flex-shrink-0 h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path></svg> </a>'),Or=c('<div class="fixed inset-0 flex z-50 lg:hidden"><div class="fixed inset-0 bg-black/30" role="button" tabindex="0" aria-label="Close menu"></div> <div class="relative flex-1 flex flex-col max-w-xs w-full bg-white dark:bg-gray-800"><div class="absolute top-0 right-0 -mr-12 pt-2"><button aria-label="Close menu" class="ml-1 flex items-center justify-center h-10 w-10 rounded-full focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white cursor-pointer"><svg class="h-6 w-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg></button></div> <div class="flex-1 h-0 pt-5 pb-4 overflow-y-auto"><nav class="px-2 space-y-1"><!> <div class="border-t border-gray-200 dark:border-gray-600 mt-4 pt-4"></div> <div class="border-t border-gray-200 dark:border-gray-600 mt-4 pt-4"><button class="group flex items-center px-2 py-2 text-base font-medium rounded-md w-full text-left text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white cursor-pointer"><svg class="mr-4 flex-shrink-0 h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"></path></svg> Logout</button></div></nav></div></div></div>'),Dr=c('<div class="fixed inset-0 z-10" role="button" tabindex="0" aria-label="Close user menu"></div>'),qr=c('<div class="hidden lg:fixed lg:inset-y-0 lg:flex lg:w-64 lg:flex-col"><div class="flex min-h-0 flex-1 flex-col bg-white dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700"><div class="flex-shrink-0 border-b border-gray-200 dark:border-gray-700"><div class="px-6 py-3 bg-gradient-to-r from-gray-50 to-white dark:from-gray-800 dark:to-gray-700"><a class="flex justify-center"><img alt="GARM" class="h-24 w-auto dark:hidden transition-transform hover:scale-105"/> <img alt="GARM" class="h-24 w-auto hidden dark:block transition-transform hover:scale-105"/></a></div> <div class="px-4 py-3 bg-gray-50 dark:bg-gray-800/50 border-t border-gray-100 dark:border-gray-700"><div class="flex items-center justify-between"><div class="flex items-center space-x-2"><!></div> <button class="p-2 rounded-lg bg-white dark:bg-gray-700 shadow-sm border border-gray-200 dark:border-gray-600 text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-600 dark:hover:text-white transition-all duration-200 hover:shadow-md cursor-pointer"><!></button></div></div></div> <nav class="mt-5 flex-1 px-2 space-y-1"><!> <div class="border-t border-gray-200 dark:border-gray-600 mt-4 pt-4"></div> <div class="border-t border-gray-200 dark:border-gray-600 mt-4 pt-4"><button class="group flex items-center px-2 py-2 text-sm font-medium rounded-md w-full text-left text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white cursor-pointer"><svg class="mr-3 h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"></path></svg> Logout</button></div></nav></div></div> <div class="lg:hidden"><div class="fixed top-0 left-0 right-0 z-40 flex items-center justify-between h-16 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4"><button aria-label="Open main menu" class="text-gray-500 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-300 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-500 cursor-pointer"><svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path></svg></button> <div class="flex items-center space-x-3"><img alt="GARM"/> <img alt="GARM"/> <h1 class="text-xl font-bold text-gray-900 dark:text-white">GARM</h1> <div class="flex items-center ml-2"><!></div></div> <button class="p-2 rounded-lg bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer" title="Toggle theme"><!></button></div> <!></div> <!>',1);function Nr(Z,ee){Se(ee,!1);const[re,he]=Ae(),M=()=>me(xr,"$websocketStore",re),m=()=>me(qe,"$page",re),u=F(),y=F();let $=F(!1),G=F(!1),f=F(!1);De(()=>{j(),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",v)});function j(){const a=localStorage.getItem("theme");a==="dark"?h(f,!0):a==="light"?h(f,!1):h(f,window.matchMedia("(prefers-color-scheme: dark)").matches),p()}function v(a){(!localStorage.getItem("theme")||localStorage.getItem("theme")==="system")&&(h(f,a.matches),p())}function O(){h(f,!e(f)),localStorage.setItem("theme",e(f)?"dark":"light"),p()}function p(){e(f)?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}function z(){Ne.logout(),h(G,!1)}const le=[{href:`${l}/`,label:"Dashboard",icon:["M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2-2z","M8 5a2 2 0 012-2h4a2 2 0 012 2v2H8V5z"]},{href:`${l}/repositories`,label:"Repositories",icon:["M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2-2z","M8 5a2 2 0 012-2h4a2 2 0 012 2v2H8V5z"]},{href:`${l}/organizations`,label:"Organizations",icon:"M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"},{href:`${l}/enterprises`,label:"Enterprises",icon:"M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"},{href:`${l}/pools`,label:"Pools",icon:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"},{href:`${l}/scalesets`,label:"Scale Sets",icon:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"},{href:`${l}/instances`,label:"Runners",icon:"M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"}],J=[{href:`${l}/credentials`,label:"Credentials",icon:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1721 9z"},{href:`${l}/endpoints`,label:"Endpoints",icon:"M13 10V3L4 14h7v7l9-11h-7z"}];X(()=>M(),()=>{h(u,M())}),X(()=>m(),()=>{m().url.pathname&&h($,!1)}),X(()=>m(),()=>{h(y,m().url.pathname)}),Le(),He();var D=qr(),V=E(D),q=o(V),ae=o(q),K=o(ae),te=o(K),b=o(te),C=n(b,2);t(te),t(K);var N=n(K,2),oe=o(N),de=o(oe),xe=o(de);{var ke=a=>{var r=yr();s(a,r)},Ue=a=>{var r=U(),g=E(r);{var H=x=>{var S=_r();s(x,S)},R=x=>{var S=U(),W=E(S);{var L=k=>{var T=wr();s(k,T)},B=k=>{var T=Mr();s(k,T)};w(W,k=>{e(u),i(()=>e(u).error)?k(L):k(B,!1)},!0)}s(x,S)};w(g,x=>{e(u),i(()=>e(u).connecting)?x(H):x(R,!1)},!0)}s(a,r)};w(xe,a=>{e(u),i(()=>e(u).connected)?a(ke):a(Ue,!1)})}t(de);var pe=n(de,2),Qe=o(pe);{var Fe=a=>{var r=$r();s(a,r)},Je=a=>{var r=jr();s(a,r)};w(Qe,a=>{e(f)?a(Fe):a(Je,!1)})}t(pe),t(oe),t(N),t(ae);var Ve=n(ae,2),Ie=o(Ve);ne(Ie,1,()=>le,ce,(a,r)=>{var g=Hr(),H=o(g),R=o(H);{var x=L=>{var B=U(),k=E(B);ne(k,1,()=>(e(r),i(()=>e(r).icon)),ce,(T,se)=>{var d=zr();P(()=>_(d,"d",e(se))),s(T,d)}),s(L,B)},S=L=>{var B=Cr();P(()=>_(B,"d",(e(r),i(()=>e(r).icon)))),s(L,B)};w(R,L=>{e(r),i(()=>Array.isArray(e(r).icon))?L(x):L(S,!1)})}t(H);var W=n(H);t(g),P(()=>{_(g,"href",(e(r),i(()=>e(r).href))),Q(g,1,`group flex items-center px-2 py-2 text-sm font-medium rounded-md transition-colors duration-200
|
|
${e(y),e(r),i(()=>e(y)===e(r).href?"bg-gray-100 text-gray-900 dark:bg-gray-700 dark:text-white":"text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white")??""}`),ge(W,` ${e(r),i(()=>e(r).label)??""}`)}),s(a,g)});var be=n(Ie,2);ne(be,5,()=>J,ce,(a,r)=>{var g=Sr(),H=o(g),R=o(H);t(H);var x=n(H);t(g),P(()=>{_(g,"href",(e(r),i(()=>e(r).href))),Q(g,1,`group flex items-center px-2 py-2 text-sm font-medium rounded-md transition-colors duration-200
|
|
${e(y),e(r),i(()=>e(y)===e(r).href?"bg-gray-100 text-gray-900 dark:bg-gray-700 dark:text-white":"text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white")??""}`),_(R,"d",(e(r),i(()=>e(r).icon))),ge(x,` ${e(r),i(()=>e(r).label)??""}`)}),s(a,g)}),t(be);var Re=n(be,2),Ke=o(Re);t(Re),t(Ve),t(q),t(V);var ye=n(V,2),_e=o(ye),Te=o(_e),we=n(Te,2),Me=o(we),$e=n(Me,2),Pe=n($e,4),We=o(Pe);{var Xe=a=>{var r=Lr();s(a,r)},Ye=a=>{var r=U(),g=E(r);{var H=x=>{var S=Br();s(x,S)},R=x=>{var S=U(),W=E(S);{var L=k=>{var T=Ar();s(k,T)},B=k=>{var T=Vr();s(k,T)};w(W,k=>{e(u),i(()=>e(u).error)?k(L):k(B,!1)},!0)}s(x,S)};w(g,x=>{e(u),i(()=>e(u).connecting)?x(H):x(R,!1)},!0)}s(a,r)};w(We,a=>{e(u),i(()=>e(u).connected)?a(Xe):a(Ye,!1)})}t(Pe),t(we);var je=n(we,2),Ze=o(je);{var er=a=>{var r=Ir();s(a,r)},rr=a=>{var r=Rr();s(a,r)};w(Ze,a=>{e(f)?a(er):a(rr,!1)})}t(je),t(_e);var ar=n(_e,2);{var tr=a=>{var r=Or(),g=o(r),H=n(g,2),R=o(H),x=o(R);t(R);var S=n(R,2),W=o(S),L=o(W);ne(L,1,()=>le,ce,(se,d)=>{var A=Er(),ie=o(A),ze=o(ie);{var Ce=ve=>{var ue=U(),lr=E(ue);ne(lr,1,()=>(e(d),i(()=>e(d).icon)),ce,(dr,vr)=>{var Ee=Tr();P(()=>_(Ee,"d",e(vr))),s(dr,Ee)}),s(ve,ue)},ir=ve=>{var ue=Pr();P(()=>_(ue,"d",(e(d),i(()=>e(d).icon)))),s(ve,ue)};w(ze,ve=>{e(d),i(()=>Array.isArray(e(d).icon))?ve(Ce):ve(ir,!1)})}t(ie);var nr=n(ie);t(A),P(()=>{_(A,"href",(e(d),i(()=>e(d).href))),Q(A,1,`group flex items-center px-2 py-2 text-base font-medium rounded-md transition-colors duration-200
|
|
${e(y),e(d),i(()=>e(y)===e(d).href?"bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white":"text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white")??""}`),ge(nr,` ${e(d),i(()=>e(d).label)??""}`)}),I("click",A,()=>h($,!1)),s(se,A)});var B=n(L,2);ne(B,5,()=>J,ce,(se,d)=>{var A=Gr(),ie=o(A),ze=o(ie);t(ie);var Ce=n(ie);t(A),P(()=>{_(A,"href",(e(d),i(()=>e(d).href))),Q(A,1,`group flex items-center px-2 py-2 text-base font-medium rounded-md transition-colors duration-200
|
|
${e(y),e(d),i(()=>e(y)===e(d).href?"bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white":"text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white")??""}`),_(ze,"d",(e(d),i(()=>e(d).icon))),ge(Ce,` ${e(d),i(()=>e(d).label)??""}`)}),I("click",A,()=>h($,!1)),s(se,A)}),t(B);var k=n(B,2),T=o(k);t(k),t(W),t(S),t(H),t(r),I("click",g,()=>h($,!1)),I("keydown",g,se=>{se.key==="Escape"&&h($,!1)}),I("click",x,()=>h($,!1)),I("click",T,z),s(a,r)};w(ar,a=>{e($)&&a(tr)})}t(ye);var or=n(ye,2);{var sr=a=>{var r=Dr();I("click",r,()=>h(G,!1)),I("keydown",r,g=>{g.key==="Escape"&&h(G,!1)}),s(a,r)};w(or,a=>{e(G)&&a(sr)})}P(()=>{_(te,"href",`${l}/`),_(b,"src",`${l??""}/assets/garm-light.svg`),_(C,"src",`${l??""}/assets/garm-dark.svg`),_(pe,"title",e(f)?"Switch to Light Mode":"Switch to Dark Mode"),_(Me,"src",`${l??""}/assets/garm-light.svg`),Q(Me,1,`${e(f)?"hidden":"block"} h-8 w-8`),_($e,"src",`${l??""}/assets/garm-dark.svg`),Q($e,1,`${e(f)?"block":"hidden"} h-8 w-8`)}),I("click",pe,O),I("click",Ke,z),I("click",Te,()=>h($,!e($))),I("click",je,O),s(Z,D),Be(),he()}var Ur=c("<div> </div>"),Qr=c('<div><div class="flex"><div class="flex-shrink-0"><!></div> <div class="ml-3 flex-1"><h3> </h3> <!></div> <div class="ml-4 flex-shrink-0"><!></div></div></div>'),Fr=c('<div class="fixed top-4 right-4 z-[60] space-y-4 max-w-sm"></div>');function Jr(Z,ee){Se(ee,!1);const[re,he]=Ae(),M=()=>me(Oe,"$toastStore",re),m=F();function u(j){switch(j){case"success":return`<svg class="h-5 w-5 text-green-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
|
</svg>`;case"error":return`<svg class="h-5 w-5 text-red-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
|
</svg>`;case"warning":return`<svg class="h-5 w-5 text-yellow-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"/>
|
|
</svg>`;case"info":default:return`<svg class="h-5 w-5 text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
|
</svg>`}}function y(j){switch(j){case"success":return"bg-green-50 dark:bg-green-900 border-green-200 dark:border-green-700";case"error":return"bg-red-50 dark:bg-red-900 border-red-200 dark:border-red-700";case"warning":return"bg-yellow-50 dark:bg-yellow-900 border-yellow-200 dark:border-yellow-700";case"info":default:return"bg-blue-50 dark:bg-blue-900 border-blue-200 dark:border-blue-700"}}function $(j){switch(j){case"success":return"text-green-800 dark:text-green-200";case"error":return"text-red-800 dark:text-red-200";case"warning":return"text-yellow-800 dark:text-yellow-200";case"info":default:return"text-blue-800 dark:text-blue-200"}}function G(j){switch(j){case"success":return"text-green-700 dark:text-green-300";case"error":return"text-red-700 dark:text-red-300";case"warning":return"text-yellow-700 dark:text-yellow-300";case"info":default:return"text-blue-700 dark:text-blue-300"}}X(()=>M(),()=>{h(m,M())}),Le(),He();var f=Fr();ne(f,5,()=>e(m),j=>j.id,(j,v)=>{var O=Qr(),p=o(O),z=o(p),le=o(z);ur(le,()=>(e(v),i(()=>u(e(v).type)))),t(z);var J=n(z,2),D=o(J),V=o(D,!0);t(D);var q=n(D,2);{var ae=b=>{var C=Ur(),N=o(C,!0);t(C),P(oe=>{Q(C,1,`mt-1 text-sm ${oe??""}`),ge(N,(e(v),i(()=>e(v).message)))},[()=>(e(v),i(()=>G(e(v).type)))]),s(b,C)};w(q,b=>{e(v),i(()=>e(v).message)&&b(ae)})}t(J);var K=n(J,2),te=o(K);{let b=cr(()=>(e(v),i(()=>e(v).type==="success"?"text-green-400 hover:text-green-500 focus:ring-green-500":e(v).type==="error"?"text-red-400 hover:text-red-500 focus:ring-red-500":e(v).type==="warning"?"text-yellow-400 hover:text-yellow-500 focus:ring-yellow-500":"text-blue-400 hover:text-blue-500 focus:ring-blue-500")));fr(te,{variant:"ghost",size:"sm","aria-label":"Dismiss notification",icon:"<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 18L18 6M6 6l12 12'/>",get class(){return e(b)},$$events:{click:()=>Oe.remove(e(v).id)}})}t(K),t(p),t(O),P((b,C)=>{Q(O,1,`relative rounded-lg border p-4 shadow-lg transition-all duration-300 ease-in-out ${b??""}`),Q(D,1,`text-sm font-medium ${C??""}`),ge(V,(e(v),i(()=>e(v).title)))},[()=>(e(v),i(()=>y(e(v).type))),()=>(e(v),i(()=>$(e(v).type)))]),s(j,O)}),t(f),s(Z,f),Be(),he()}var Kr=c('<div class="min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900"><div class="text-center"><div class="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"></div> <p class="mt-4 text-gray-500 dark:text-gray-400">Loading...</p></div></div>'),Wr=c('<div class="min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900"><div class="text-center"><p class="text-gray-600 dark:text-gray-400">Redirecting to login...</p></div></div>'),Xr=c('<div class="min-h-screen bg-gray-100 dark:bg-gray-900"><!> <div class="lg:pl-64"><main class="py-6 pt-20 lg:pt-6"><div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8"><!></div></main></div></div>'),Yr=c("<!> <!>",1);function ca(Z,ee){Se(ee,!1);const[re,he]=Ae(),M=()=>me(qe,"$page",re),m=()=>me(mr,"$authStore",re),u=F(),y=F(),$=F();De(()=>{Ne.init(),setTimeout(()=>{const p=M().url.pathname===`${l}/login`,z=M().url.pathname===`${l}/init`;!p&&!z&&!m().isAuthenticated&&!m().loading&&(m().needsInitialization?fe(`${l}/init`):fe(`${l}/login`))},200)}),X(()=>(m(),M(),fe),()=>{if(!m().loading){const p=M().url.pathname===`${l}/login`,z=M().url.pathname===`${l}/init`;!p&&!z&&!m().isAuthenticated&&(m().needsInitialization?fe(`${l}/init`):fe(`${l}/login`))}}),X(()=>(M(),l),()=>{h(u,M().url.pathname===`${l}/login`)}),X(()=>(M(),l),()=>{h(y,M().url.pathname===`${l}/init`)}),X(()=>(e(u),e(y)),()=>{h($,!e(u)&&!e(y))}),Le(),He();var G=Yr();gr(p=>{hr.title="GARM - GitHub Actions Runner Manager"});var f=E(G);{var j=p=>{var z=Kr();s(p,z)},v=p=>{var z=U(),le=E(z);{var J=V=>{var q=Wr();s(V,q)},D=V=>{var q=U(),ae=E(q);{var K=b=>{var C=U(),N=E(C);Ge(N,ee,"default",{}),s(b,C)},te=b=>{var C=Xr(),N=o(C);Nr(N,{});var oe=n(N,2),de=o(oe),xe=o(de),ke=o(xe);Ge(ke,ee,"default",{}),t(xe),t(de),t(oe),t(C),s(b,C)};w(ae,b=>{e(u)||e(y)?b(K):b(te,!1)},!0)}s(V,q)};w(le,V=>{e($),m(),i(()=>e($)&&!m().isAuthenticated)?V(J):V(D,!1)},!0)}s(p,z)};w(f,p=>{m(),i(()=>m().loading)?p(j):p(v,!1)})}var O=n(f,2);Jr(O,{}),s(Z,G),Be(),he()}export{ca as component,va as universal};
|