1import{W as N}from"./UtilityNavbar-C8FXVcN0.js";import K from"./TemplateSidemenu-BL2aXA2k.js";import{_ as V,c as W,w as q,r as z,o as n,b as s,e as E,j as L,v as M,t as r,f as a,F,g as T}from"./index-dzAJSX2f.js";import"./SectionHero-06EruKdm.js";const O={components:{WrapperPage:N,TemplateSidemenu:K},inject:["menus","io"],props:["renderer"],data:()=>({service:"docker_services_ports",items:null,current:null,search:"",portProviders:["ufw","google","aws","azure"]}),async created(){await this.getItems()},methods:{async inspectPort(t="ufw"){const e=prompt("Port to inspect"),l=await this.io.service("ports").get({port:e,provider:t});console.log(l)},async openPort(t="ufw"){const e=prompt("Port to inspect"),l=await this.io.service("ports").create({port:e,provider:t});console.log(l)},async closePort(t="ufw"){const e=prompt("Port to inspect"),l=await this.io.service("ports").remove({port:e,provider:t});console.log(l)},async getItems(){try{const t={};if(this.items&&(t.$limit=this.items.limit,t.$skip=this.items.skip),this.search){t.$or=[];const e=["id","port_external","port_internal","docker_service_id","created_at","updated_at"];for(const l of e){const d={};d[l]={$like:`%${this.search}%`},t.$or.push(d)}}this.items=await this.io.service(this.service).find({query:t})}catch(t){this.items=null,console.error(t)}},next(){this.items&&(this.items.skip+=this.items.limit,this.getItems())},previous(){this.items&&(this.items.skip-=this.items.limit,this.getItems())}}},U={class:"flex h-full flex-col md:flex-row"},G={class:"flex-col flex w-full md:w-1/2 flex-shrink-0"},H={class:"flex px-4"},J={class:"px-4 pt-4 md:hidden flex"},Q=["disabled"],R={class:"text-sm justify-items-center content-center text-center grow"},X=["disabled"],Y={class:"px-4 pt-4 grow"},Z=["onClick"],tt={class:"p-4 hidden md:flex"},et=["disabled"],st={class:"text-sm justify-items-center content-center text-center grow"},ot=["disabled"],it={class:"grow p-4 overflow-auto"},rt={class:"mb-2 p-2 bg-slate-50"},lt=["onClick"],nt=["onClick"],at=["onClick"];function dt(t,e,l,d,ct,i){const A=z("TemplateSidemenu");return n(),W(A,{title:"Applications",renderer:l.renderer},{default:q(()=>{var m,p,u,h,g,f,v,b,k,w,x,P,C,_,y,I,S,$,j,B,D;return[s("div",U,[s("div",G,[e[7]||(e[7]=s("h2",{class:"font-light text-lg p-4 max-w-full"}," App Ports ",-1)),s("div",H,[E(s("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>t.search=o),placeholder:"Search",onKeypress:e[1]||(e[1]=L((...o)=>i.getItems&&i.getItems(...o),["enter"])),class:"rounded-l bg-slate-50 grow p-2"},null,544),[[M,t.search]]),s("button",{onClick:e[2]||(e[2]=(...o)=>i.getItems&&i.getItems(...o)),class:"hover:bg-slate-200 font-extralight rounded-r p-2 bg-slate-100"}," Search ")]),s("div",J,[s("button",{class:"p-1.5 w-20 hover:bg-slate-200 font-extralight rounded bg-slate-100",disabled:!((m=t.items)!=null&&m.skip),onClick:e[3]||(e[3]=o=>i.previous())}," Previous ",8,Q),s("div",R,r(((p=t.items)==null?void 0:p.skip)+1)+" - "+r(((u=t.items)==null?void 0:u.skip)+((g=(h=t.items)==null?void 0:h.data)==null?void 0:g.length))+" of "+r((f=t.items)==null?void 0:f.total),1),s("button",{class:"p-1.5 w-20 hover:bg-slate-200 font-extralight rounded bg-slate-100",disabled:!t.items||((v=t.items)==null?void 0:v.skip)+((k=(b=t.items)==null?void 0:b.data)==null?void 0:k.length)>=((w=t.items)==null?void 0:w.total),onClick:e[4]||(e[4]=o=>i.next())}," Next ",8,X)]),s("div",Y,[(n(!0),a(F,null,T((x=t.items)==null?void 0:x.data,o=>(n(),a("button",{onClick:c=>t.current=o,class:"rounded hover:bg-slate-200 font-extralight mb-1 text-left w-full bg-slate-50 py-1 px-2"},r(o.port_external)+":"+r(o.port_internal),9,Z))),256))]),s("div",tt,[s("button",{class:"p-1.5 w-20 hover:bg-slate-200 font-extralight rounded bg-slate-100",disabled:!((P=t.items)!=null&&P.skip),onClick:e[5]||(e[5]=o=>i.previous())}," Previous ",8,et),s("div",st,r(((C=t.items)==null?void 0:C.skip)+1)+" - "+r(((_=t.items)==null?void 0:_.skip)+((I=(y=t.items)==null?void 0:y.data)==null?void 0:I.length))+" of "+r((S=t.items)==null?void 0:S.total),1),s("button",{class:"p-1.5 w-20 hover:bg-slate-200 font-extralight rounded bg-slate-100",disabled:!t.items||(($=t.items)==null?void 0:$.skip)+((B=(j=t.items)==null?void 0:j.data)==null?void 0:B.length)>=((D=t.items)==null?void 0:D.total),onClick:e[6]||(e[6]=o=>i.next())}," Next ",8,ot)])]),s("div",it,[e[8]||(e[8]=s("h2",{class:"font-light text-lg max-w-full"}," Details & Actions ",-1)),s("pre",null," "+r(t.current)+` 2 `,1),(n(!0),a(F,null,T(t.portProviders,o=>(n(),a("div",rt,[s("h3",null,r(o),1),s("button",{onClick:c=>i.inspectPort(o),class:"mb-2 mr-2 hover:bg-slate-200 font-extralight rounded-r p-2 bg-slate-100"}," Inspect Port ",8,lt),s("button",{onClick:c=>i.openPort(o),class:"hover:bg-slate-200 font-extralight rounded-r p-2 bg-slate-100"}," Open Port ",8,nt),s("button",{onClick:c=>i.closePort(o),class:"hover:bg-slate-200 font-extralight rounded-r p-2 bg-slate-100"}," Close Port ",8,at)]))),256))])])]}),_:1},8,["renderer"])}const gt=V(O,[["render",dt]]);export{gt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.