This change fixes the creation of pools though the UI. Both the modal and the page were sending a request to create the pool, leading to double pool. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
1 line
20 KiB
JavaScript
1 line
20 KiB
JavaScript
import"../chunks/DsnmJJEf.js";import{i as hr}from"../chunks/zNh6Oe5P.js";import{p as xr,E as Hr,o as _r,f as w,k as a,j as o,g as e,m as i,r as s,t as _,s as r,e as ne,c as f,v as X,b as kr,z as pr,x as he,D as Be,d as wr,l as q,a as jr,h as Nr,$ as Ur,q as Je,u as mr,n as qr}from"../chunks/sWNKMed7.js";import{i as D,s as Or,a as Lr}from"../chunks/Ccl3fNd2.js";import{r as T,s as Ve,b as xe,g as R}from"../chunks/DVl4ZBgx.js";import{P as Br}from"../chunks/qfys27k5.js";import{e as vr,i as fr}from"../chunks/BuuPrWMc.js";import{b as H,a as Jr}from"../chunks/CLagxtgo.js";import{p as Vr}from"../chunks/D4Caz1gY.js";import{M as Fr}from"../chunks/DN14Fk2Y.js";import{J as Wr}from"../chunks/CkYhV7Br.js";import{e as Y}from"../chunks/BZiHL9L3.js";import{U as Kr}from"../chunks/vrFkfzoI.js";import{D as Qr}from"../chunks/kJjQhR0J.js";import{e as Xr,a as yr}from"../chunks/DA-798Ko.js";import{t as _e}from"../chunks/BZUCTtPY.js";import{e as ce,h as Yr}from"../chunks/cjRLNre3.js";import{D as Zr,G as Fe,a as et}from"../chunks/DCYYzf48.js";import{E as rt}from"../chunks/DAWfW-VQ.js";import{E as tt}from"../chunks/CARsAFuo.js";import{S as at}from"../chunks/BJXodF8n.js";import{P as ot}from"../chunks/BaVaT5nU.js";import"../chunks/C6O4o7G1.js";var st=w('<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>'),lt=w('<div class="animate-pulse bg-gray-200 dark:bg-gray-700 h-10 rounded"></div>'),it=w("<option><!></option>"),dt=w('<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>'),nt=w('<div class="animate-pulse bg-gray-200 dark:bg-gray-700 h-10 rounded"></div>'),ct=w("<option> </option>"),ut=w('<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>'),gt=w('<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-2 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="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><div class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Extra Specs (JSON)</div> <!></div> <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 scale set immediately</label></div></div>',1),bt=w('<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>'),pt=w('<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 Scale Set</h2> <p class="mt-1 text-sm text-gray-500 dark:text-gray-400">Scale sets are only available for GitHub endpoints</p></div> <form class="p-6 space-y-6"><!> <div><label for="name" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Name <span class="text-red-500">*</span></label> <input id="name" type="text" required placeholder="e.g., my-scale-set" 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><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> <!> <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 mt(ke,we){xr(we,!1);const Z=Hr();let O=i(!1),b=i(""),n=i(""),m=i([]),S=i([]),L=i(!1),C=i(!1),$=i(""),v=i(""),k=i(""),u=i(""),y=i(""),A=i(void 0),I=i(void 0),z=i(void 0),d=i("garm"),B=i("linux"),J=i("amd64"),ee=i(""),re=i(!0),G=i("{}");async function ue(){try{r(C,!0),r(S,await R.listProviders())}catch(p){r(b,Y(p))}finally{r(C,!1)}}async function Se(){if(e(n))try{switch(r(L,!0),r(m,[]),e(n)){case"repository":r(m,await R.listRepositories());break;case"organization":r(m,await R.listOrganizations());break;case"enterprise":r(m,await R.listEnterprises());break}}catch(p){r(b,Y(p))}finally{r(L,!1)}}function te(p){e(n)!==p&&(r(n,p),r(v,""),Se())}async function Ce(){if(!e($)||!e(n)||!e(v)||!e(k)||!e(u)||!e(y)){r(b,"Please fill in all required fields");return}try{r(O,!0),r(b,"");let p={};if(e(G).trim())try{p=JSON.parse(e(G))}catch{throw new Error("Invalid JSON in extra specs")}const V={name:e($),provider_name:e(k),image:e(u),flavor:e(y),max_runners:e(A)||10,min_idle_runners:e(I)||0,runner_bootstrap_timeout:e(z)||20,runner_prefix:e(d),os_type:e(B),os_arch:e(J),"github-runner-group":e(ee)||void 0,enabled:e(re),extra_specs:e(G).trim()?p:void 0};let P;switch(e(n)){case"repository":P=await R.createRepositoryScaleSet(e(v),V);break;case"organization":P=await R.createOrganizationScaleSet(e(v),V);break;case"enterprise":P=await R.createEnterpriseScaleSet(e(v),V);break;default:throw new Error("Invalid entity level selected")}Z("submit",P)}catch(p){r(b,Y(p))}finally{r(O,!1)}}_r(()=>{ue()}),hr(),Fr(ke,{$$events:{close:()=>Z("close")},children:(p,V)=>{var P=pt(),F=a(o(P),2),ge=o(F);{var be=g=>{var M=st(),K=o(M),fe=o(K,!0);s(K),s(M),_(()=>X(fe,e(b))),f(g,M)};D(ge,g=>{e(b)&&g(be)})}var j=a(ge,2),ae=a(o(j),2);T(ae),s(j);var oe=a(j,2),se=o(oe),pe=a(o(se),2),W=o(pe),le=a(W,2),me=a(le,2);s(pe),s(se),s(oe);var ve=a(oe,2);{var t=g=>{var M=gt(),K=kr(M),fe=a(o(K),2),Pe=o(fe),Me=o(Pe),Pr=o(Me);pr(),s(Me);var Mr=a(Me,2);{var Er=l=>{var h=lt();f(l,h)},Tr=l=>{var h=dt();_(()=>{e(v),he(()=>{e(n),e(m)})});var E=o(h),Le=o(E);s(E),E.value=E.__value="";var ie=a(E);vr(ie,1,()=>e(m),fr,(N,x)=>{var U=it(),ye=o(U);{var zr=Q=>{var de=Be();_(()=>X(de,`${e(x).owner??""}/${e(x).name??""} (${e(x).endpoint?.name||"Unknown endpoint"})`)),f(Q,de)},Gr=Q=>{var de=Be();_(()=>X(de,`${e(x).name??""} (${e(x).endpoint?.name||"Unknown endpoint"})`)),f(Q,de)};D(ye,Q=>{e(n)==="repository"?Q(zr):Q(Gr,!1)})}s(U);var br={};_(()=>{br!==(br=e(x).id)&&(U.value=(U.__value=e(x).id)??"")}),f(N,U)}),s(h),_(()=>X(Le,`Select a ${e(n)??""}`)),xe(h,()=>e(v),N=>r(v,N)),f(l,h)};D(Mr,l=>{e(L)?l(Er):l(Tr,!1)})}s(Pe);var Ke=a(Pe,2),Rr=a(o(Ke),2);{var Dr=l=>{var h=nt();f(l,h)},Ar=l=>{var h=ut();_(()=>{e(k),he(()=>{e(S)})});var E=o(h);E.value=E.__value="";var Le=a(E);vr(Le,1,()=>e(S),fr,(ie,N)=>{var x=ct(),U=o(x,!0);s(x);var ye={};_(()=>{X(U,e(N).name),ye!==(ye=e(N).name)&&(x.value=(x.__value=e(N).name)??"")}),f(ie,x)}),s(h),xe(h,()=>e(k),ie=>r(k,ie)),f(l,h)};D(Rr,l=>{e(C)?l(Dr):l(Ar,!1)})}s(Ke),s(fe),s(K);var Ee=a(K,2),Qe=a(o(Ee),2),Te=o(Qe),Xe=a(o(Te),2);T(Xe),s(Te);var Re=a(Te,2),Ye=a(o(Re),2);T(Ye),s(Re);var De=a(Re,2),Ae=a(o(De),2);_(()=>{e(B),he(()=>{})});var Ie=o(Ae);Ie.value=Ie.__value="linux";var Ze=a(Ie);Ze.value=Ze.__value="windows",s(Ae),s(De);var er=a(De,2),ze=a(o(er),2);_(()=>{e(J),he(()=>{})});var Ge=o(ze);Ge.value=Ge.__value="amd64";var rr=a(Ge);rr.value=rr.__value="arm64",s(ze),s(er),s(Qe),s(Ee);var He=a(Ee,2),tr=a(o(He),2),je=o(tr),ar=a(o(je),2);T(ar),s(je);var Ne=a(je,2),or=a(o(Ne),2);T(or),s(Ne);var sr=a(Ne,2),lr=a(o(sr),2);T(lr),s(sr),s(tr),s(He);var ir=a(He,2),Ue=a(o(ir),2),qe=o(Ue),dr=a(o(qe),2);T(dr),s(qe);var nr=a(qe,2),cr=a(o(nr),2);T(cr),s(nr),s(Ue);var Oe=a(Ue,2),Ir=a(o(Oe),2);Wr(Ir,{rows:4,placeholder:"{}",get value(){return e(G)},set value(l){r(G,l)},$$legacy:!0}),s(Oe);var ur=a(Oe,2),gr=o(ur);T(gr),pr(2),s(ur),s(ir),_(l=>X(Pr,`${l??""} `),[()=>e(n).charAt(0).toUpperCase()+e(n).slice(1)]),H(Xe,()=>e(u),l=>r(u,l)),H(Ye,()=>e(y),l=>r(y,l)),xe(Ae,()=>e(B),l=>r(B,l)),xe(ze,()=>e(J),l=>r(J,l)),H(ar,()=>e(I),l=>r(I,l)),H(or,()=>e(A),l=>r(A,l)),H(lr,()=>e(z),l=>r(z,l)),H(dr,()=>e(d),l=>r(d,l)),H(cr,()=>e(ee),l=>r(ee,l)),Jr(gr,()=>e(re),l=>r(re,l)),f(g,M)};D(ve,g=>{e(n)&&g(t)})}var c=a(ve,2),We=o(c),$e=a(We,2),Sr=o($e);{var Cr=g=>{var M=bt();f(g,M)},$r=g=>{var M=Be("Create Scale Set");f(g,M)};D(Sr,g=>{e(O)?g(Cr):g($r,!1)})}s($e),s(c),s(F),s(P),_(()=>{Ve(W,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"}`),Ve(le,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"}`),Ve(me,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"}`),$e.disabled=e(O)||!e($)||!e(n)||!e(v)||!e(k)||!e(u)||!e(y)}),H(ae,()=>e($),g=>r($,g)),ne("click",W,()=>te("repository")),ne("click",le,()=>te("organization")),ne("click",me,()=>te("enterprise")),ne("click",We,()=>Z("close")),ne("submit",F,Vr(Ce)),f(p,P)},$$slots:{default:!0}}),wr()}const vt={};var ft=w('<div class="space-y-6"><!> <!></div> <!> <!> <!>',1);function qt(ke,we){xr(we,!1);const[Z,O]=Or(),b=()=>Lr(Xr,"$eagerCache",Z),n=i(),m=i(),S=i(),L=i();let C=i([]),$=i(!0),v=i(""),k=i(""),u=i(1),y=i(25),A=i(!1),I=i(!1),z=i(!1),d=i(null);async function B(t){try{r(v,""),r(A,!1),_e.success("Scale Set Created","Scale set has been created successfully.")}catch(c){throw r(v,Y(c)),c}}async function J(t){if(e(d))try{await R.updateScaleSet(e(d).id,t),_e.success("Scale Set Updated",`Scale set ${e(d).name} has been updated successfully.`),r(I,!1),r(d,null)}catch(c){throw c}}async function ee(){if(e(d))try{await R.deleteScaleSet(e(d).id),_e.success("Scale Set Deleted",`Scale set ${e(d).name} has been deleted successfully.`)}catch(t){const c=Y(t);_e.error("Delete Failed",c)}finally{r(z,!1),r(d,null)}}function re(){r(A,!0)}function G(t){r(d,t),r(I,!0)}function ue(t){r(d,t),r(z,!0)}_r(async()=>{try{r($,!0);const t=await yr.getScaleSets();t&&Array.isArray(t)&&r(C,t)}catch(t){vt?.VITEST||console.error("Failed to load scale sets:",t),r(v,Y(t))}finally{r($,!1)}});async function Se(){try{await yr.retryResource("scalesets")}catch(t){console.error("Retry failed:",t)}}const te=[{key:"name",title:"Name",cellComponent:rt,cellProps:{entityType:"scaleset"}},{key:"image",title:"Image",cellComponent:Fe,cellProps:{field:"image",type:"code",showTitle:!0}},{key:"provider",title:"Provider",cellComponent:Fe,cellProps:{field:"provider_name"}},{key:"flavor",title:"Flavor",cellComponent:Fe,cellProps:{field:"flavor"}},{key:"entity",title:"Entity",cellComponent:ot},{key:"endpoint",title:"Endpoint",cellComponent:tt},{key:"status",title:"Status",cellComponent:at,cellProps:{statusType:"enabled"}},{key:"actions",title:"Actions",align:"right",cellComponent:et}],Ce={entityType:"scaleset",primaryText:{field:"name",isClickable:!0,href:"/scalesets/{id}"},secondaryText:{field:"entity_name",computedValue:t=>ce(t)},badges:[{type:"custom",value:t=>({variant:t.enabled?"success":"error",text:t.enabled?"Enabled":"Disabled"})}],actions:[{type:"edit",handler:t=>G(t)},{type:"delete",handler:t=>ue(t)}]};function p(t){r(k,t.detail.term),r(u,1)}function V(t){r(u,t.detail.page)}function P(t){r(y,t.detail.perPage),r(u,1)}function F(t){G(t.detail.item)}function ge(t){ue(t.detail.item)}q(()=>(e(C),b()),()=>{(!e(C).length||b().loaded.scalesets)&&r(C,b().scalesets)}),q(()=>b(),()=>{r($,b().loading.scalesets)}),q(()=>b(),()=>{r(n,b().errorMessages.scalesets)}),q(()=>(e(C),e(k),ce),()=>{r(m,Yr(e(C),e(k),t=>ce(t)))}),q(()=>(e(m),e(y)),()=>{r(S,Math.ceil(e(m).length/e(y)))}),q(()=>(e(u),e(S)),()=>{e(u)>e(S)&&e(S)>0&&r(u,e(S))}),q(()=>(e(m),e(u),e(y)),()=>{r(L,e(m).slice((e(u)-1)*e(y),e(u)*e(y)))}),jr(),hr();var be=ft();Nr(t=>{Ur.title="Scale Sets - GARM"});var j=kr(be),ae=o(j);Br(ae,{title:"Scale Sets",description:"Manage GitHub runner scale sets",actionLabel:"Add Scale Set",$$events:{action:re}});var oe=a(ae,2);{let t=Je(()=>e(n)||e(v)),c=Je(()=>!!e(n));Zr(oe,{get columns(){return te},get data(){return e(L)},get loading(){return e($)},get error(){return e(t)},get searchTerm(){return e(k)},searchPlaceholder:"Search by entity name...",get currentPage(){return e(u)},get perPage(){return e(y)},get totalPages(){return e(S)},get totalItems(){return e(m),mr(()=>e(m).length)},itemName:"scale sets",emptyIconType:"cog",get showRetry(){return e(c)},get mobileCardConfig(){return Ce},$$events:{search:p,pageChange:V,perPageChange:P,retry:Se,edit:F,delete:ge}})}s(j);var se=a(j,2);{var pe=t=>{mt(t,{$$events:{close:()=>r(A,!1),submit:c=>B(c.detail)}})};D(se,t=>{e(A)&&t(pe)})}var W=a(se,2);{var le=t=>{Kr(t,{get scaleSet(){return e(d)},$$events:{close:()=>{r(I,!1),r(d,null)},submit:c=>J(c.detail)}})};D(W,t=>{e(I)&&e(d)&&t(le)})}var me=a(W,2);{var ve=t=>{{let c=Je(()=>(e(d),qr(ce),mr(()=>`Scale Set ${e(d).name} (${ce(e(d))})`)));Qr(t,{title:"Delete Scale Set",message:"Are you sure you want to delete this scale set? This action cannot be undone and will remove all associated runners.",get itemName(){return e(c)},$$events:{close:()=>{r(z,!1),r(d,null)},confirm:ee}})}};D(me,t=>{e(z)&&e(d)&&t(ve)})}f(ke,be),wr(),O()}export{qt as component};
|