This removes some deprecated code. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
import"../chunks/DsnmJJEf.js";import{i as Ye}from"../chunks/zNh6Oe5P.js";import{p as Ze,o as er,l as A,a as rr,f as m,h as ar,t as re,g as e,e as tr,c as n,d as dr,m as i,$ as lr,j as a,u,n as $e,k as d,s,r as t,z as L,C as sr,b as or,D as ir,v as Ue,q as nr}from"../chunks/sWNKMed7.js";import{i as p,s as vr,a as mr}from"../chunks/Ccl3fNd2.js";import{B as ze,d as y,c as Me,s as N,r as P}from"../chunks/t8NOL8UT.js";import{b as q}from"../chunks/CLagxtgo.js";import{p as cr}from"../chunks/D4Caz1gY.js";import{g as W}from"../chunks/CaJ57PEy.js";import{a as ur,b as pr}from"../chunks/DKD3N1EI.js";import{t as br}from"../chunks/BZUCTtPY.js";import{e as gr}from"../chunks/BZiHL9L3.js";var fr=m('<p class="mt-2 text-sm text-red-600 dark:text-red-400">Username is required</p>'),xr=m('<p class="mt-2 text-sm text-red-600 dark:text-red-400">Please enter a valid email address</p>'),hr=m('<p class="mt-2 text-sm text-red-600 dark:text-red-400">Full name is required</p>'),yr=m('<p class="mt-2 text-sm text-red-600 dark:text-red-400">Password must be at least 8 characters long</p>'),kr=m('<p class="mt-2 text-sm text-red-600 dark:text-red-400">Passwords do not match</p>'),_r=sr('<svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg> Advanced Configuration (Optional)',1),wr=m('<div class="mt-4 p-4 bg-gray-50 dark:bg-gray-800 rounded-md border border-gray-200 dark:border-gray-600"><div class="space-y-4"><div><label for="metadataUrl" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Metadata URL</label> <div class="mt-1"><input id="metadataUrl" name="metadataUrl" type="url" class="appearance-none block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm" placeholder="https://garm.example.com/api/v1/metadata"/> <p class="mt-1 text-xs text-gray-500 dark:text-gray-400">URL where runners can fetch metadata and setup information.</p></div></div> <div><label for="callbackUrl" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Callback URL</label> <div class="mt-1"><input id="callbackUrl" name="callbackUrl" type="url" class="appearance-none block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm" placeholder="https://garm.example.com/api/v1/callbacks"/> <p class="mt-1 text-xs text-gray-500 dark:text-gray-400">URL where runners send status updates and lifecycle events.</p></div></div> <div><label for="webhookUrl" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Webhook URL</label> <div class="mt-1"><input id="webhookUrl" name="webhookUrl" type="url" class="appearance-none block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm" placeholder="https://garm.example.com/webhooks"/> <p class="mt-1 text-xs text-gray-500 dark:text-gray-400">URL where GitHub/Gitea will send webhook events for job notifications.</p></div></div></div></div>'),$r=m("<li>Enter a username</li>"),Ur=m("<li>Enter a valid email address</li>"),zr=m("<li>Enter your full name</li>"),Mr=m("<li>Enter a password with at least 8 characters</li>"),Rr=m("<li>Confirm your password</li>"),Ar=m('<div class="bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-md p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-yellow-400" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"></path></svg></div> <div class="ml-3"><h3 class="text-sm font-medium text-yellow-800 dark:text-yellow-200">Please complete all required fields</h3> <div class="mt-2 text-sm text-yellow-700 dark:text-yellow-300"><ul class="list-disc list-inside space-y-1"><!> <!> <!> <!> <!></ul></div></div></div></div>'),Pr=m('<div class="bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-md p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-red-400" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"></path></svg></div> <div class="ml-3"><p class="text-sm text-red-800 dark:text-red-200"> </p></div></div></div>'),qr=m('<div class="min-h-screen bg-gray-50 dark:bg-gray-900 flex flex-col justify-center py-12 sm:px-6 lg:px-8"><div class="sm:mx-auto sm:w-full sm:max-w-md"><div class="flex justify-center"><img alt="GARM" class="h-16 w-auto dark:hidden"/> <img alt="GARM" class="h-16 w-auto hidden dark:block"/></div> <h1 class="mt-6 text-center text-3xl font-extrabold text-gray-900 dark:text-white">Welcome to GARM</h1> <p class="mt-2 text-center text-sm text-gray-600 dark:text-gray-400">Complete the first-run setup to get started</p></div> <div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md"><div class="bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-md p-4 mb-6"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-blue-400" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"></path></svg></div> <div class="ml-3"><h3 class="text-sm font-medium text-blue-800 dark:text-blue-200">First-Run Initialization</h3> <div class="mt-2 text-sm text-blue-700 dark:text-blue-300"><p>GARM needs to be initialized before first use. This will create the admin user and generate a unique controller ID for this installation.</p></div></div></div></div> <div class="bg-white dark:bg-gray-800 py-8 px-4 shadow sm:rounded-lg sm:px-10"><form class="space-y-6"><div><label for="username" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Username</label> <div class="mt-1"><input id="username" name="username" type="text" required placeholder="Enter admin username"/> <!></div></div> <div><label for="email" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Email Address</label> <div class="mt-1"><input id="email" name="email" type="email" required placeholder="admin@example.com"/> <!></div></div> <div><label for="fullName" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Full Name</label> <div class="mt-1"><input id="fullName" name="fullName" type="text" required placeholder="Enter full name"/> <!></div></div> <div><label for="password" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Password</label> <div class="mt-1"><input id="password" name="password" type="password" required placeholder="Choose a strong password"/> <!></div></div> <div><label for="confirmPassword" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Confirm Password</label> <div class="mt-1"><input id="confirmPassword" name="confirmPassword" type="password" required placeholder="Confirm your password"/> <!></div></div> <div class="pt-4"><!> <!></div> <!> <!> <div><!></div></form> <div class="mt-6"><div class="text-center"><p class="text-xs text-gray-500 dark:text-gray-400">This will create the admin user, generate a unique controller ID, and configure the required URLs for your GARM installation. <br/> Make sure to remember these credentials as they cannot be recovered.</p></div></div></div></div></div>');function Dr(Re,Ae){Ze(Ae,!1);const[Pe,qe]=vr(),C=()=>mr(ur,"$authStore",Pe),_=i(),w=i(),$=i(),U=i(),z=i(),S=i();let f=i("admin"),b=i("admin@garm.local"),c=i(""),x=i(""),h=i("Administrator"),j=i(!1),H=i(""),T=i(!1),I=i(""),E=i(""),V=i("");async function Ce(){if(e(S))try{s(j,!0),s(H,""),await pr.initialize(e(f).trim(),e(b).trim(),e(c),e(h).trim(),{callbackUrl:e(I).trim()||void 0,metadataUrl:e(E).trim()||void 0,webhookUrl:e(V).trim()||void 0}),br.success("GARM Initialized","GARM has been successfully initialized. Welcome!"),W(y("/"))}catch(r){s(H,gr(r))}finally{s(j,!1)}}er(()=>{if(C().isAuthenticated){W(y("/"));return}!C().needsInitialization&&!C().loading&&W(y("/login"))}),A(()=>(e(I),e(E),e(V)),()=>{if(typeof window<"u"){const r=window.location.origin;e(I)||s(I,`${r}/api/v1/callbacks`),e(E)||s(E,`${r}/api/v1/metadata`),e(V)||s(V,`${r}/webhooks`)}}),A(()=>e(b),()=>{s(_,e(b).trim()!==""&&e(b).includes("@"))}),A(()=>e(c),()=>{s(w,e(c).length>=8)}),A(()=>(e(x),e(c)),()=>{s($,e(x).length>0&&e(c)===e(x))}),A(()=>e(f),()=>{s(U,e(f).trim()!=="")}),A(()=>e(h),()=>{s(z,e(h).trim()!=="")}),A(()=>(e(U),e(_),e(z),e(w),e($)),()=>{s(S,e(U)&&e(_)&&e(z)&&e(w)&&e($))}),A(()=>(C(),y),()=>{C().isAuthenticated?W(y("/")):!C().needsInitialization&&!C().loading&&W(y("/login"))}),rr(),Ye();var ae=qr();ar(r=>{lr.title="Initialize GARM - First Run Setup"});var te=a(ae),me=a(te),ce=a(me),Ge=d(ce,2);t(me),L(4),t(te);var ue=d(te,2),pe=d(a(ue),2),de=a(pe),le=a(de),be=d(a(le),2),O=a(be);P(O);var Le=d(O,2);{var Ie=r=>{var l=fr();n(r,l)};p(Le,r=>{e(U),e(f),u(()=>!e(U)&&e(f).length>0)&&r(Ie)})}t(be),t(le);var se=d(le,2),ge=d(a(se),2),J=a(ge);P(J);var Ee=d(J,2);{var Ve=r=>{var l=xr();n(r,l)};p(Ee,r=>{e(_),e(b),u(()=>!e(_)&&e(b).length>0)&&r(Ve)})}t(ge),t(se);var oe=d(se,2),fe=d(a(oe),2),K=a(fe);P(K);var Be=d(K,2);{var Ne=r=>{var l=hr();n(r,l)};p(Be,r=>{e(z),e(h),u(()=>!e(z)&&e(h).length>0)&&r(Ne)})}t(fe),t(oe);var ie=d(oe,2),xe=d(a(ie),2),Q=a(xe);P(Q);var Se=d(Q,2);{var je=r=>{var l=yr();n(r,l)};p(Se,r=>{e(w),e(c),u(()=>!e(w)&&e(c).length>0)&&r(je)})}t(xe),t(ie);var ne=d(ie,2),he=d(a(ne),2),X=a(he);P(X);var Fe=d(X,2);{var De=r=>{var l=kr();n(r,l)};p(Fe,r=>{e($),e(x),u(()=>!e($)&&e(x).length>0)&&r(De)})}t(he),t(ne);var ve=d(ne,2),ye=a(ve);ze(ye,{type:"button",variant:"ghost",size:"sm",$$events:{click:()=>s(T,!e(T))},children:(r,l)=>{var g=_r(),v=or(g);L(),re(()=>N(v,0,`w-4 h-4 mr-2 transition-transform ${e(T)?"rotate-90":""}`)),n(r,g)},$$slots:{default:!0}});var We=d(ye,2);{var He=r=>{var l=wr(),g=a(l),v=a(g),M=d(a(v),2),G=a(M);P(G),L(2),t(M),t(v);var B=d(v,2),Y=d(a(B),2),F=a(Y);P(F),L(2),t(Y),t(B);var Z=d(B,2),D=d(a(Z),2),ee=a(D);P(ee),L(2),t(D),t(Z),t(g),t(l),q(G,()=>e(E),R=>s(E,R)),q(F,()=>e(I),R=>s(I,R)),q(ee,()=>e(V),R=>s(V,R)),n(r,l)};p(We,r=>{e(T)&&r(He)})}t(ve);var ke=d(ve,2);{var Te=r=>{var l=Ar(),g=a(l),v=d(a(g),2),M=d(a(v),2),G=a(M),B=a(G);{var Y=o=>{var k=$r();n(o,k)};p(B,o=>{e(U)||o(Y)})}var F=d(B,2);{var Z=o=>{var k=Ur();n(o,k)};p(F,o=>{e(_)||o(Z)})}var D=d(F,2);{var ee=o=>{var k=zr();n(o,k)};p(D,o=>{e(z)||o(ee)})}var R=d(D,2);{var Ke=o=>{var k=Mr();n(o,k)};p(R,o=>{e(w)||o(Ke)})}var Qe=d(R,2);{var Xe=o=>{var k=Rr();n(o,k)};p(Qe,o=>{e($)||o(Xe)})}t(G),t(M),t(v),t(g),t(l),n(r,l)};p(ke,r=>{e(S),e(f),e(b),e(h),e(c),e(x),u(()=>!e(S)&&(e(f).length>0||e(b).length>0||e(h).length>0||e(c).length>0||e(x).length>0))&&r(Te)})}var _e=d(ke,2);{var Oe=r=>{var l=Pr(),g=a(l),v=d(a(g),2),M=a(v),G=a(M,!0);t(M),t(v),t(g),t(l),re(()=>Ue(G,e(H))),n(r,l)};p(_e,r=>{e(H)&&r(Oe)})}var we=d(_e,2),Je=a(we);{let r=nr(()=>!e(S)||e(j));ze(Je,{type:"submit",variant:"primary",size:"lg",fullWidth:!0,get loading(){return e(j)},get disabled(){return e(r)},children:(l,g)=>{L();var v=ir();re(()=>Ue(v,e(j)?"Initializing...":"Initialize GARM")),n(l,v)},$$slots:{default:!0}})}t(we),t(de),L(2),t(pe),t(ue),t(ae),re((r,l)=>{Me(ce,"src",r),Me(Ge,"src",l),N(O,1,`appearance-none block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm ${e(U),e(f),u(()=>!e(U)&&e(f).length>0?"border-red-300 dark:border-red-600":"")??""}`),N(J,1,`appearance-none block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm ${e(_),e(b),u(()=>!e(_)&&e(b).length>0?"border-red-300 dark:border-red-600":"")??""}`),N(K,1,`appearance-none block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm ${e(z),e(h),u(()=>!e(z)&&e(h).length>0?"border-red-300 dark:border-red-600":"")??""}`),N(Q,1,`appearance-none block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm ${e(w),e(c),u(()=>!e(w)&&e(c).length>0?"border-red-300 dark:border-red-600":"")??""}`),N(X,1,`appearance-none block w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm ${e($),e(x),u(()=>!e($)&&e(x).length>0?"border-red-300 dark:border-red-600":"")??""}`)},[()=>($e(y),u(()=>y("/assets/garm-light.svg"))),()=>($e(y),u(()=>y("/assets/garm-dark.svg")))]),q(O,()=>e(f),r=>s(f,r)),q(J,()=>e(b),r=>s(b,r)),q(K,()=>e(h),r=>s(h,r)),q(Q,()=>e(c),r=>s(c,r)),q(X,()=>e(x),r=>s(x,r)),tr("submit",de,cr(Ce)),n(Re,ae),dr(),qe()}export{Dr as component};
|