2 lines
7.7 KiB
JavaScript
2 lines
7.7 KiB
JavaScript
|
|
import"../chunks/DsnmJJEf.js";import{i as Le}from"../chunks/B3Pzt0F_.js";import{p as Ne,o as We,A as qe,l as He,a as je,f as A,h as Ge,b as M,t as q,c as x,d as Re,g as e,m as l,s as o,u as s,$ as Ve,j as f,r as g,k as d,v as le,y as Je,B as de,q as m,n as Ke}from"../chunks/D8EpLgQ1.js";import{i as h,s as Qe,a as Xe}from"../chunks/5WA7h8uK.js";import{c as Ye,g as _}from"../chunks/CiE1LlKV.js";import{p as Ze}from"../chunks/C41YH50Q.js";import{g as ce}from"../chunks/CTf6mQoE.js";import{b as H}from"../chunks/CoIRRsD9.js";import{U as et}from"../chunks/CclkODgu.js";import{D as ue}from"../chunks/KQ2xQpA3.js";import{E as tt,P as at,a as nt}from"../chunks/BmGWMSQm.js";import{D as ot,I as rt}from"../chunks/DDhBTdDt.js";import{g as fe}from"../chunks/BGVHQGl-.js";import{W as it}from"../chunks/Dbd6PPbz.js";import{C as st}from"../chunks/CwqI2jFH.js";import{w as j}from"../chunks/u94nIB4-.js";import{t as C}from"../chunks/BEkVdVE1.js";var lt=A('<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>'),dt=A('<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>'),ct=A("<!> <!> <!> <!> <!> <!>",1),ut=A('<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 Tt(ge,me){Ne(me,!1);const[pe,ve]=Qe(),G=()=>Xe(Ze,"$page",pe),w=l();let a=l(null),c=l([]),p=l([]),F=l(!0),I=l(""),O=l(!1),D=l(!1),E=l(!1),T=l(!1),u=l(null),P=null,b=l();async function R(){if(e(w))try{o(F,!0),o(I,"");const[t,n,r]=await Promise.all([_.getOrganization(e(w)),_.listOrganizationPools(e(w)).catch(()=>[]),_.listOrganizationInstances(e(w)).catch(()=>[])]);o(a,t),o(c,n),o(p,r)}catch(t){o(I,t instanceof Error?t.message:"Failed to load organization")}finally{o(F,!1)}}function ye(t,n){const{events:r}=t;return{...n,events:r}}async function he(t){if(e(a))try{await _.updateOrganization(e(a).id,t),await R(),C.success("Organization Updated",`Organization ${e(a).name} has been updated successfully.`),o(O,!1)}catch(n){throw n}}async function _e(){if(e(a)){try{await _.deleteOrganization(e(a).id),ce(`${H}/organizations`)}catch(t){o(I,t instanceof Error?t.message:"Failed to delete organization")}o(D,!1)}}async function be(){if(e(u))try{await _.deleteInstance(e(u).name),C.success("Instance Deleted",`Instance ${e(u).name} has been deleted successfully.`),o(E,!1),o(u,null)}catch(t){const n=t instanceof Error?t.message:"Failed to delete instance";C.error("Delete Failed",n),o(E,!1),o(u,null)}}function ze(t){o(u,t),o(E,!0)}function $e(){o(T,!0)}async function xe(t){try{if(!e(a))return;await _.createOrganizationPool(e(a).id,t.detail),C.success("Pool Created",`Pool has been created successfully for organization ${e(a).name}.`),o(T,!1)}catch(n){throw n}}function V(){e(b)&&Je(b,e(b).scrollTop=e(b).scrollHeight)}function we(t){if(t.operation==="update"){const n=t.payload;if(e(a)&&n.id===e(a).id){const r=e(a).events?.length||0,i=n.events?.length||0;o(a,ye(e(a),n)),i>r&&setTimeout(()=>{V()},100)}}else if(t.ope
|