garm/webapp/assets/_app/immutable/chunks/Csic5lDL.js
Gabriel Adrian Samfira 69a2c509a7 Replace ${base} with resolve()
This removes some deprecated code.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2025-08-18 13:08:58 +00:00

1 line
17 KiB
JavaScript

import"./DsnmJJEf.js";import{i as Lr}from"./zNh6Oe5P.js";import{p as qr,E as Gr,m as s,o as Jr,f as m,k as r,j as o,g as e,r as a,t as v,e as M,c as b,v as T,b as Nr,z as vr,x as W,u as p,s as d,D as je,d as Vr}from"./sWNKMed7.js";import{p as pr,i as z}from"./Ccl3fNd2.js";import{e as Ae,i as Oe}from"./BuuPrWMc.js";import{s as $e,r as h,b as Q,g as C,c as Fr}from"./t8NOL8UT.js";import{b as E,a as Kr}from"./CLagxtgo.js";import{p as Ur}from"./D4Caz1gY.js";import{M as Wr}from"./-99ewtnX.js";import{e as He}from"./BZiHL9L3.js";import{J as Qr}from"./5NDOgLBG.js";var Xr=m('<div class="rounded-md bg-red-50 dark:bg-red-900 p-4"><p class="text-sm font-medium text-red-800 dark:text-red-200"> </p></div>'),Yr=m('<div class="animate-pulse bg-gray-200 dark:bg-gray-700 h-10 rounded"></div>'),Zr=m("<option><!></option>"),et=m('<select id="entity" required class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"><option> </option><!></select>'),rt=m('<div class="animate-pulse bg-gray-200 dark:bg-gray-700 h-10 rounded"></div>'),tt=m("<option> </option>"),at=m('<select id="provider" required class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"><option>Select a provider</option><!></select>'),ot=m('<span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200"> <button type="button" class="ml-1 h-4 w-4 rounded-full hover:bg-blue-200 dark:hover:bg-blue-800 flex items-center justify-center cursor-pointer"><svg class="h-3 w-3" 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></span>'),dt=m('<div class="flex flex-wrap gap-2"></div>'),it=m('<div class="space-y-4"><h3 class="text-lg font-medium text-gray-900 dark:text-white border-b border-gray-200 dark:border-gray-700 pb-2">Entity & Provider Configuration</h3> <div class="grid grid-cols-1 md:grid-cols-2 gap-4"><div><label for="entity" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"> <span class="text-red-500">*</span></label> <!></div> <div><label for="provider" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Provider <span class="text-red-500">*</span></label> <!></div></div></div> <div class="space-y-4"><h3 class="text-lg font-medium text-gray-900 dark:text-white border-b border-gray-200 dark:border-gray-700 pb-2">Image & OS Configuration</h3> <div class="grid grid-cols-1 md:grid-cols-2 gap-4"><div><label for="image" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Image <span class="text-red-500">*</span></label> <input id="image" type="text" required placeholder="e.g., ubuntu:22.04" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"/></div> <div><label for="flavor" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Flavor <span class="text-red-500">*</span></label> <input id="flavor" type="text" required placeholder="e.g., default" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"/></div> <div><label for="osType" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">OS Type</label> <select id="osType" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"><option>Linux</option><option>Windows</option></select></div> <div><label for="osArch" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Architecture</label> <select id="osArch" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"><option>AMD64</option><option>ARM64</option></select></div></div></div> <div class="space-y-4"><h3 class="text-lg font-medium text-gray-900 dark:text-white border-b border-gray-200 dark:border-gray-700 pb-2">Runner Limits & Timing</h3> <div class="grid grid-cols-1 md:grid-cols-3 gap-4"><div><label for="minIdleRunners" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Min Idle Runners</label> <input id="minIdleRunners" type="number" min="0" placeholder="0" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"/></div> <div><label for="maxRunners" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Max Runners</label> <input id="maxRunners" type="number" min="1" placeholder="10" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"/></div> <div><label for="bootstrapTimeout" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Bootstrap Timeout (min)</label> <input id="bootstrapTimeout" type="number" min="1" placeholder="20" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"/></div></div></div> <div class="space-y-4"><h3 class="text-lg font-medium text-gray-900 dark:text-white border-b border-gray-200 dark:border-gray-700 pb-2">Advanced Settings</h3> <div class="grid grid-cols-1 md:grid-cols-3 gap-4"><div><label for="runnerPrefix" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Runner Prefix</label> <input id="runnerPrefix" type="text" placeholder="garm" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"/></div> <div><label for="priority" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Priority</label> <input id="priority" type="number" min="1" placeholder="100" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"/></div> <div><label for="githubRunnerGroup" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">GitHub Runner Group (optional)</label> <input id="githubRunnerGroup" type="text" placeholder="Default group" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"/></div></div> <div><label for="tag-input" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Tags</label> <div class="space-y-2"><div class="flex"><input id="tag-input" type="text" placeholder="Enter a tag" class="flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-l-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"/> <button type="button" class="px-3 py-2 bg-blue-600 text-white rounded-r-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 cursor-pointer">Add</button></div> <!></div></div> <fieldset><legend class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Extra Specs (JSON)</legend> <!></fieldset> <div class="flex items-center"><input id="enabled" type="checkbox" class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 dark:border-gray-600 rounded"/> <label for="enabled" class="ml-2 block text-sm text-gray-700 dark:text-gray-300">Enable pool immediately</label></div></div>',1),st=m('<div class="flex items-center"><div class="animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"></div> Creating...</div>'),lt=m('<div class="max-w-6xl w-full max-h-[90vh] overflow-y-auto"><div class="px-6 py-4 border-b border-gray-200 dark:border-gray-700"><h2 class="text-xl font-semibold text-gray-900 dark:text-white">Create New Pool</h2></div> <form class="p-6 space-y-6"><!> <fieldset><legend class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-3">Entity Level <span class="text-red-500">*</span></legend> <div class="grid grid-cols-3 gap-4"><button type="button"><svg class="w-8 h-8 mb-2 text-gray-600 dark:text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2-2z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 5a2 2 0 012-2h4a2 2 0 012 2v2H8V5z"></path></svg> <span class="text-sm font-medium text-gray-900 dark:text-white">Repository</span></button> <button type="button"><svg class="w-8 h-8 mb-2 text-gray-600 dark:text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"></path></svg> <span class="text-sm font-medium text-gray-900 dark:text-white">Organization</span></button> <button type="button"><svg class="w-8 h-8 mb-2 text-gray-600 dark:text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="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"></path></svg> <span class="text-sm font-medium text-gray-900 dark:text-white">Enterprise</span></button></div></fieldset> <!> <div class="flex justify-end space-x-3 pt-6 border-t border-gray-200 dark:border-gray-700"><button type="button" class="px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 cursor-pointer">Cancel</button> <button type="submit" class="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer"><!></button></div></form></div>');function ht(mr,X){qr(X,!1);const Y=Gr();let Be=pr(X,"initialEntityType",8,""),fr=pr(X,"initialEntityId",8,""),G=s(!1),P=s(""),n=s(Be()),I=s([]),Z=s([]),ee=s(!1),re=s(!1),k=s(fr()),S=s(""),B=s(""),D=s(""),te=s(void 0),ae=s(void 0),oe=s(void 0),de=s(100),ie=s("garm"),J=s("linux"),N=s("amd64"),se=s(""),le=s(!0),_=s([]),j=s(""),L=s("{}");async function yr(){try{d(re,!0),d(Z,await C.listProviders())}catch(l){d(P,He(l))}finally{d(re,!1)}}async function De(){if(e(n))try{switch(d(ee,!0),d(I,[]),e(n)){case"repository":d(I,await C.listRepositories());break;case"organization":d(I,await C.listOrganizations());break;case"enterprise":d(I,await C.listEnterprises());break}}catch(l){d(P,He(l))}finally{d(ee,!1)}}function ne(l){e(n)!==l&&(d(n,l),d(k,""),De())}function Le(){e(j).trim()&&!e(_).includes(e(j).trim())&&(d(_,[...e(_),e(j).trim()]),d(j,""))}function xr(l){d(_,e(_).filter((A,w)=>w!==l))}function hr(l){l.key==="Enter"&&(l.preventDefault(),Le())}async function kr(){if(!e(n)||!e(k)||!e(S)||!e(B)||!e(D)){d(P,"Please fill in all required fields");return}try{d(G,!0),d(P,"");let l={};if(e(L).trim())try{l=JSON.parse(e(L))}catch{throw new Error("Invalid JSON in extra specs")}const A={provider_name:e(S),image:e(B),flavor:e(D),max_runners:e(te)||10,min_idle_runners:e(ae)||0,runner_bootstrap_timeout:e(oe)||20,priority:e(de),runner_prefix:e(ie),os_type:e(J),os_arch:e(N),"github-runner-group":e(se)||void 0,enabled:e(le),tags:e(_),extra_specs:e(L).trim()?l:void 0};let w;switch(e(n)){case"repository":w=await C.createRepositoryPool(e(k),A);break;case"organization":w=await C.createOrganizationPool(e(k),A);break;case"enterprise":w=await C.createEnterprisePool(e(k),A);break;default:throw new Error("Invalid entity level")}Y("submit",A)}catch(l){d(P,He(l))}finally{d(G,!1)}}Jr(()=>{yr(),Be()&&De()}),Lr(),Wr(mr,{$$events:{close:()=>Y("close")},children:(l,A)=>{var w=lt(),V=r(o(w),2),qe=o(V);{var _r=c=>{var y=Xr(),O=o(y),F=o(O,!0);a(O),a(y),v(()=>T(F,e(P))),b(c,y)};z(qe,c=>{e(P)&&c(_r)})}var ue=r(qe,2),Ge=r(o(ue),2),be=o(Ge),ce=r(be,2),Je=r(ce,2);a(Ge),a(ue);var Ne=r(ue,2);{var wr=c=>{var y=it(),O=Nr(y),F=r(o(O),2),ve=o(F),pe=o(ve),Rr=o(pe);vr(),a(pe);var Tr=r(pe,2);{var zr=t=>{var u=Yr();b(t,u)},Cr=t=>{var u=et();v(()=>{e(k),W(()=>{e(n),e(I)})});var f=o(u),$=o(f);a(f),f.value=f.__value="";var R=r(f);Ae(R,1,()=>e(I),Oe,(g,i)=>{var x=Zr(),U=o(x);{var Br=H=>{var q=je();v(()=>T(q,`${e(i),p(()=>e(i).owner)??""}/${e(i),p(()=>e(i).name)??""} (${e(i),p(()=>e(i).endpoint?.name)??""})`)),b(H,q)},Dr=H=>{var q=je();v(()=>T(q,`${e(i),p(()=>e(i).name)??""} (${e(i),p(()=>e(i).endpoint?.name)??""})`)),b(H,q)};z(U,H=>{e(n)==="repository"?H(Br):H(Dr,!1)})}a(x);var gr={};v(()=>{gr!==(gr=(e(i),p(()=>e(i).id)))&&(x.value=(x.__value=(e(i),p(()=>e(i).id)))??"")}),b(g,x)}),a(u),v(()=>T($,`Select a ${e(n)??""}`)),Q(u,()=>e(k),g=>d(k,g)),b(t,u)};z(Tr,t=>{e(ee)?t(zr):t(Cr,!1)})}a(ve);var Ke=r(ve,2),Ir=r(o(Ke),2);{var Sr=t=>{var u=rt();b(t,u)},jr=t=>{var u=at();v(()=>{e(S),W(()=>{e(Z)})});var f=o(u);f.value=f.__value="";var $=r(f);Ae($,1,()=>e(Z),Oe,(R,g)=>{var i=tt(),x=o(i,!0);a(i);var U={};v(()=>{T(x,(e(g),p(()=>e(g).name))),U!==(U=(e(g),p(()=>e(g).name)))&&(i.value=(i.__value=(e(g),p(()=>e(g).name)))??"")}),b(R,i)}),a(u),Q(u,()=>e(S),R=>d(S,R)),b(t,u)};z(Ir,t=>{e(re)?t(Sr):t(jr,!1)})}a(Ke),a(F),a(O);var me=r(O,2),Ue=r(o(me),2),fe=o(Ue),We=r(o(fe),2);h(We),a(fe);var ye=r(fe,2),Qe=r(o(ye),2);h(Qe),a(ye);var xe=r(ye,2),he=r(o(xe),2);v(()=>{e(J),W(()=>{})});var ke=o(he);ke.value=ke.__value="linux";var Xe=r(ke);Xe.value=Xe.__value="windows",a(he),a(xe);var Ye=r(xe,2),_e=r(o(Ye),2);v(()=>{e(N),W(()=>{})});var we=o(_e);we.value=we.__value="amd64";var Ze=r(we);Ze.value=Ze.__value="arm64",a(_e),a(Ye),a(Ue),a(me);var Ee=r(me,2),er=r(o(Ee),2),Me=o(er),rr=r(o(Me),2);h(rr),a(Me);var Pe=r(Me,2),tr=r(o(Pe),2);h(tr),a(Pe);var ar=r(Pe,2),or=r(o(ar),2);h(or),a(ar),a(er),a(Ee);var dr=r(Ee,2),Re=r(o(dr),2),Te=o(Re),ir=r(o(Te),2);h(ir),a(Te);var ze=r(Te,2),sr=r(o(ze),2);h(sr),a(ze);var lr=r(ze,2),nr=r(o(lr),2);h(nr),a(lr),a(Re);var Ce=r(Re,2),ur=r(o(Ce),2),Ie=o(ur),K=o(Ie);h(K);var Ar=r(K,2);a(Ie);var Or=r(Ie,2);{var $r=t=>{var u=dt();Ae(u,5,()=>e(_),Oe,(f,$,R)=>{var g=ot(),i=o(g),x=r(i);a(g),v(()=>{T(i,`${e($)??""} `),Fr(x,"aria-label",`Remove tag ${e($)}`)}),M("click",x,()=>xr(R)),b(f,g)}),a(u),b(t,u)};z(Or,t=>{e(_),p(()=>e(_).length>0)&&t($r)})}a(ur),a(Ce);var Se=r(Ce,2),Hr=r(o(Se),2);Qr(Hr,{rows:4,placeholder:"{}",get value(){return e(L)},set value(t){d(L,t)},$$legacy:!0}),a(Se);var br=r(Se,2),cr=o(br);h(cr),vr(2),a(br),a(dr),v(t=>T(Rr,`${t??""} `),[()=>(e(n),p(()=>e(n).charAt(0).toUpperCase()+e(n).slice(1)))]),E(We,()=>e(B),t=>d(B,t)),E(Qe,()=>e(D),t=>d(D,t)),Q(he,()=>e(J),t=>d(J,t)),Q(_e,()=>e(N),t=>d(N,t)),E(rr,()=>e(ae),t=>d(ae,t)),E(tr,()=>e(te),t=>d(te,t)),E(or,()=>e(oe),t=>d(oe,t)),E(ir,()=>e(ie),t=>d(ie,t)),E(sr,()=>e(de),t=>d(de,t)),E(nr,()=>e(se),t=>d(se,t)),E(K,()=>e(j),t=>d(j,t)),M("keydown",K,hr),M("click",Ar,Le),Kr(cr,()=>e(le),t=>d(le,t)),b(c,y)};z(Ne,c=>{e(n)&&c(wr)})}var Ve=r(Ne,2),Fe=o(Ve),ge=r(Fe,2),Er=o(ge);{var Mr=c=>{var y=st();b(c,y)},Pr=c=>{var y=je("Create Pool");b(c,y)};z(Er,c=>{e(G)?c(Mr):c(Pr,!1)})}a(ge),a(Ve),a(V),a(w),v(()=>{$e(be,1,`flex flex-col items-center justify-center p-4 border-2 rounded-lg transition-colors cursor-pointer ${e(n)==="repository"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`),$e(ce,1,`flex flex-col items-center justify-center p-4 border-2 rounded-lg transition-colors cursor-pointer ${e(n)==="organization"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`),$e(Je,1,`flex flex-col items-center justify-center p-4 border-2 rounded-lg transition-colors cursor-pointer ${e(n)==="enterprise"?"border-blue-500 bg-blue-50 dark:bg-blue-900":"border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500"}`),ge.disabled=e(G)||!e(n)||!e(k)||!e(S)||!e(B)||!e(D)}),M("click",be,()=>ne("repository")),M("click",ce,()=>ne("organization")),M("click",Je,()=>ne("enterprise")),M("click",Fe,()=>Y("close")),M("submit",V,Ur(kr)),b(l,w)},$$slots:{default:!0}}),Vr()}export{ht as C};