import{r as a,j as e,R,C as S,u as g,s as _,a as j,F as k,P as I,B as C,S as D,b as E}from"./main-BzPVmAp-.js";import L from"./index-CDeD9lyT.js";import{c as M,C as N,I as O}from"./index-BfzdirmR.js";import{C as b}from"./index-7u0Bo8e4.js";import{L as c}from"./index-RAxRq3bL.js";import{R as w}from"./RedoOutlined-d_QTXv-s.js";import{A as F}from"./index-Cl0Hi3Gl.js";import"./index-CUuSmggi.js";import"./addEventListener-CzbSevz3.js";import"./usePagination-CGdUxo17.js";import"./Table-kIlrKW-9.js";import"./Dropdown-Clv_Pvnt.js";import"./index-BZ6Sq__j.js";import"./index-SGIbgpRk.js";import"./callSuper-CKCGYiRV.js";const P=`
# Bioinformatics Reactive Analysis and Visualization Engine(BRAVE)

![](/brave-api/img/logo.png)
`,ee=()=>{const[o,p]=a.useState(P);return e.jsx("div",{style:{maxWidth:"1800px",margin:"1rem auto"},children:e.jsxs(R,{children:[e.jsx(S,{xs:24,sm:12,md:12,lg:12,xl:12,style:{padding:"0 0.5rem"},children:e.jsx(b,{children:e.jsx(L,{data:o})})}),e.jsx(S,{xs:24,sm:6,md:6,lg:6,xl:6,style:{padding:"0 0.5rem"},children:e.jsx(z,{keys:["traefik","code-server","notebook","rstudio"]})}),e.jsx(S,{xs:24,sm:6,md:6,lg:6,xl:6,style:{padding:"0 0.5rem"},children:e.jsx(A,{})})]})})},z=({keys:o})=>{const[p,f]=a.useState(),[d,x]=a.useState(!1),{baseURL:m}=g(s=>s.user),[y,u]=_.useMessage(),i=g(s=>s.global.sseData),[h,v]=a.useState([]);a.useEffect(()=>{try{const s=JSON.parse(i);h.includes(s.analysis_id)&&n()}catch{}},[i]);const n=async()=>{x(!0);const s=await j.post("/container/list-container-key",{container_key:o});v(s.data.map(t=>t.container_id));const r=Object.fromEntries(s.data.map(t=>[t.container_key,t])),l=o.map(t=>r[t]?r[t]:{key:t});f(l),x(!1)};return a.useEffect(()=>{n()},[m]),e.jsxs(b,{title:"Cloud App",size:"small",loading:d,extra:e.jsx(e.Fragment,{children:e.jsx(w,{style:{cursor:"pointer"},onClick:()=>n()})}),children:[u,e.jsx(c,{className:"demo-loadmore-list",loading:d,itemLayout:"vertical",dataSource:p,renderItem:s=>e.jsx(e.Fragment,{children:s!=null&&s.name?e.jsx(e.Fragment,{children:e.jsx(c.Item,{actions:[e.jsx(N,{record:s,reload:n,traefikUI:s.name=="traefik"})],children:e.jsx(D,{avatar:!0,title:!1,loading:s.loading,active:!0,children:e.jsx(c.Item.Meta,{avatar:e.jsx("img",{draggable:!1,width:100,alt:"logo",src:s.img}),title:e.jsx("p",{style:{wordWrap:"break-word"},children:s.image}),description:s.name})})})}):e.jsx(k,{align:"center",style:{padding:"1rem 0"},children:e.jsx(I,{title:"Install?",onConfirm:async()=>{const r=M.find(t=>t.container_key==(s==null?void 0:s.key));r||y.error(`${name} templete not exist!`);const l=JSON.parse(JSON.stringify(r));l.envionment=JSON.stringify(r.envionment),l.labels=JSON.stringify(r.labels),console.log(l),await j.post("/container/add-or-update-container",l),n()},children:e.jsxs(C,{size:"small",color:"cyan",variant:"solid",children:["Install ",s==null?void 0:s.key]})})})})})]})},A=()=>{const[o,p]=a.useState([]),[f,d]=a.useState(!1),{baseURL:x}=g(s=>s.user),[m,y]=a.useState(),u=g(s=>s.global.sseData),{modal:i,openModal:h,closeModal:v}=E();a.useEffect(()=>{try{const s=JSON.parse(u);(s.event=="analysis_complete"||s.event=="analysis_failed"||s.event=="analysis_started")&&(n(!1),y(s))}catch{}},[u]);const n=async s=>{d(!0);const r=await j.get(`/container/list-running-container?force=${s}`);p(r.data),d(!1)};return a.useEffect(()=>{n(!1)},[x]),e.jsxs(b,{size:"small",title:e.jsx(e.Fragment,{children:e.jsx(k,{justify:"space-between",align:"center",children:e.jsx("div",{children:"Running Container"})})}),extra:e.jsx(e.Fragment,{children:e.jsx(w,{style:{cursor:"pointer"},onClick:()=>n(!0)})}),style:{marginBottom:"1rem"},children:[m&&e.jsx(F,{message:`${m.run_id}: ${m.event}`,type:"success"}),e.jsx(c,{className:"demo-loadmore-list",loading:f,itemLayout:"vertical",dataSource:o,renderItem:s=>e.jsx(c.Item,{actions:[e.jsxs(k,{gap:"small",children:[e.jsx(I,{title:"Stop?",onConfirm:async()=>{await j.post(`/container/stop-container-by-run-id/${s.name}`)},children:e.jsx(C,{size:"small",color:"cyan",variant:"solid",children:"Stop"})}),e.jsx(C,{size:"small",color:"cyan",variant:"solid",onClick:()=>{h("inspectPanel",{inspect:"inspect",id:s.name})},children:"Inspect"})]})],children:e.jsx(D,{avatar:!0,title:!1,loading:s.loading,active:!0,children:e.jsx(c.Item.Meta,{title:s.image,description:s.name})})})}),e.jsx(O,{visible:i.key=="inspectPanel"&&i.visible,params:i.params,onClose:v})]})};export{ee as default};
