UNPKG

@iryu54/stack-monitor

Version:
2 lines (1 loc) 2.43 kB
import{S as v}from"./Section-CIoUqrrC.js";import{d as k,P as h,S as y}from"./router-BlYJbnFA.js";import{T as w}from"./Tabs-BghidEwM.js";import{a as g}from"./axios-BZk75tkI.js";import{_ as V}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{g as u,c as S,o as _,d as p,w as f,b as T,p as B,h as C,q as P,a as b,f as D,s as x}from"./index-Dyc6L6BZ.js";import"./vue.runtime.esm-bundler-CUmbNKcA.js";import"./Markdown-D5RrXO2v.js";import"./Editor-R-oT1rsL.js";const I={components:{SectionCmp:v,Tabs:w,draggableVue:k},name:"StackSingle",setup(){const i=b([]),n=b([]),o=b(null);return D(async()=>{const{data:e}=await g.get("/plugins/services");n.value=e.sort((a,s)=>(a.order||0)-(s.order||0)).map(a=>({label:a.name,id:a.name,icon:a.icon})),x(()=>{var a,s;return(s=(a=o.value)==null?void 0:a.currentTab)==null?void 0:s.id},async()=>{var a,s;(s=(a=o.value)==null?void 0:a.currentTab)!=null&&s.id&&(i.value=await h.filter(y.services.value,async r=>{var c,l;if((l=(c=o==null?void 0:o.value)==null?void 0:c.currentTab)!=null&&l.id){const d=o.value.currentTab.id;if(!r.enabled)return!1;const{data:t}=await g.get("/plugins/services/"+r.label);return!!t.map(m=>m.name).find(m=>m===d)}return!1}))})}),{tabRef:o,services:i,tabs:n,setData:function(e,a){e.setDragImage(document.createElement("div"),100,100)},async restart(e){await e.restart()},async stop(e){await e.stop()},goTo(e){var a;(a=window.open(e,"_blank"))==null||a.focus()},async openInVsCode(e){e.openInVsCode()},async openFolder(e){e.openFolder()}}}},M={class:"stack-multiple"},F={class:"tab"};function E(i,n,o,e,a,s){const r=u("section-cmp"),c=u("draggableVue"),l=u("tabs");return _(),S("div",M,[p(l,{tabs:e.tabs,showLabels:!1,ref:"tabRef",height:"100%"},{default:f(({tab:d})=>[T("div",F,[p(c,B({modelValue:e.services,"onUpdate:modelValue":n[0]||(n[0]=t=>e.services=t)},{animation:300},{setData:e.setData,"item-key":"label",class:"services"}),{item:f(({element:t})=>[p(r,{class:"service-container",headerBold:!0,noBodyPadding:!0,header:t.label,actions:[{click:()=>e.goTo(t.git.home),icon:"fab fa-github"},{click:()=>e.goTo(t.url),icon:"fas fa-globe"},{click:()=>e.openFolder(t),icon:"fas fa-folder"}]},{default:f(()=>[(_(),C(P(d.id),{service:t,key:t.label,isInMultiMode:!0,noStyle:!0},null,8,["service"]))]),_:2},1032,["header","actions"])]),_:2},1040,["modelValue","setData"])])]),_:1},8,["tabs"])])}const O=V(I,[["render",E],["__scopeId","data-v-493839fe"]]);export{O as default};