2025-08-21 20:35:10 +00:00
|
|
|
import"../chunks/DsnmJJEf.js";import{i as We}from"../chunks/zNh6Oe5P.js";import{p as qe,o as He,A as je,l as Ge,a as Re,f as S,h as Ve,b as C,t as H,c as x,d as Je,u as i,n as de,v as ce,g as e,m as l,j as f,k as d,s as o,$ as Ke,r as m,y as Qe,B as ue,q as g}from"../chunks/sWNKMed7.js";import{i as h,s as Xe,a as Ye}from"../chunks/Ccl3fNd2.js";import{d as A,c as Ze,g as _}from"../chunks/D30EsFKH.js";import{p as et}from"../chunks/DubtptHG.js";import{g as fe}from"../chunks/CeO1pnaq.js";import{U as tt}from"../chunks/DAUYzF7s.js";import{D as me}from"../chunks/B6BdCO3z.js";import{E as at,P as nt,a as ot}from"../chunks/B-C7pZX9.js";import{D as rt,I as it}from"../chunks/MZdleLKl.js";import{g as ge}from"../chunks/DyvUHRqW.js";import{e as j}from"../chunks/BZiHL9L3.js";import{W as st}from"../chunks/CHldIK8x.js";import{C as lt}from"../chunks/CLrK9xMi.js";import{w as G}from"../chunks/BuuPrWMc.js";import{t as E}from"../chunks/BZUCTtPY.js";var dt=S('<div class="p-6 text-center"><div class="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto"></div> <p class="mt-2 text-sm text-gray-500 dark:text-gray-400">Loading organization...</p></div>'),ct=S('<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>'),ut=S("<!> <!> <!> <!> <!> <!>",1),ft=S('<div class="space-y-6"><nav class="flex" aria-label="Breadcrumb"><ol class="inline-flex items-center space-x-1 md:space-x-3"><li class="inline-flex items-center"><a class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white"><svg class="w-3 h-3 mr-2.5" fill="currentColor" viewBox="0 0 20 20"><path d="M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z"></path></svg> Organizations</a></li> <li><div class="flex items-center"><svg class="w-3 h-3 text-gray-400 mx-1" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd"></path></svg> <span class="ml-1 text-sm font-medium text-gray-500 md:ml-2 dark:text-gray-400"> </span></div></li></ol></nav> <!></div> <!> <!> <!> <!>',1);function Pt(pe,ve){qe(ve,!1);const[ye,he]=Xe(),R=()=>Ye(et,"$page",ye),I=l();let a=l(null),c=l([]),p=l([]),B=l(!0),O=l(""),D=l(!1),T=l(!1),w=l(!1),P=l(!1),u=l(null),M=null,b=l();async function V(){if(e(I))try{o(B,!0),o(O,"");const[t,n,r]=await Promise.all([_.getOrganization(e(I)),_.listOrganizationPools(e(I)).catch(()=>[]),_.listOrganizationInstances(e(I)).catch(()=>[])]);o(a,t),o(c,n),o(p,r)}catch(t){o(O,j(t))}finally{o(B,!1)}}function _e(t,n){const{events:r}=t;return{...n,events:r}}async function be(t){if(e(a))try{await _.updateOrganization(e(a).id,t),await V(),E.success("Organization Updated",`Organization ${e(a).name} has been updated successfully.`),o(D,!1)}catch(n){throw n}}async function ze(){if(e(a)){try{await _.deleteOrganization(e(a).id),fe(A("/organizations"))}catch(t){const n=j(t);E.error("Delete Failed",n)}o(T,!1)}}async function $e(){if(e(u))try{await _.deleteInstance(e(u).name),E.success("Instance Deleted",`Instance ${e(u).name} has been deleted successfully.`),o(w,!1),o(u,null)}catch(t){const n=j(t);E.error("Delete Failed",n),o(w,!1),o(u,null)}}function xe(t){o(u,t),o(w,!0)}function Ie(){o(P,!0)}async function we(t){try{if(!e(a))return;await _.createOrganizationPool(e(a).id,t.detail),E.success("Pool Created",`Pool has been created successfully for organization ${e(a).name}.`),o(P,!1)}catch(n){throw n}}function J(){e(b)&&Qe(b,e(b).scrollTop=e(b).scrollHeight)}function Ee(t){if(t.operation==="update"){const n=t.payload;if(e(a)&&n.id===e(a).id){const r=e(a).events?.length||0,s=n.events?.length||0;o(a,_e(e(a),n)),s>r&&setTimeout(()=>{J()},100)}}else if(t.operation==="delete"){const n=t.payload.id||t.payload;e(a)&&e(a).id===n&&fe(A("/organizations"))}}function Oe(t){if(!e(a))return;
|