import{i as p,x,d as w,c as n,a as s,f as i,u as d,t as l,F as h,e as A,v as L,b as V,r as _,h as F,o as a,n as M}from"./index-CXwCk-SR.js";import{u as N}from"./useQuery-DB4moXtm.js";import{_ as P}from"./_plugin-vue_export-helper-DlAUqK2U.js";function R(){const v=N({queryKey:["oap-config"],queryFn:()=>x.oapOps.config(),staleTime:6e4,refetchOnWindowFocus:!1}),f=p(()=>v.data.value??null),g=p(()=>{var u;return((u=f.value)==null?void 0:u.reachable)??!1}),c=p(()=>{var u;return((u=f.value)==null?void 0:u.entries)??[]});return{isLoading:v.isLoading,data:f,reachable:g,entries:c,refetch:v.refetch}}const T={class:"cfg"},S={class:"page-head"},q={key:0,class:"last-error block"},B={class:"hint"},D={key:1,class:"empty"},E={class:"toolbar"},I={class:"count"},U={key:0,class:"empty"},W={class:"modblock-head"},z={class:"modname"},K={class:"modcount"},Q={class:"cfg-table"},$={class:"ckey"},j=w({__name:"ConfigView",setup(v){const{reachable:f,entries:g,data:c,isLoading:u,refetch:b}=R(),y=F(""),k=p(()=>{const r=y.value.trim().toLowerCase(),e=new Map;for(const o of g.value){if(r&&!o.key.toLowerCase().includes(r)&&!o.value.toLowerCase().includes(r))continue;const t=e.get(o.module)??[];t.push({key:o.key,value:o.value}),e.set(o.module,t)}return[...e.entries()].map(([o,t])=>({module:o,rows:t})).sort((o,t)=>o.module.localeCompare(t.module))}),C=p(()=>k.value.reduce((r,e)=>r+e.rows.length,0));function O(r){return r==="******"}return(r,e)=>{var o;return a(),n("div",T,[s("header",S,[e[2]||(e[2]=s("div",null,[s("div",{class:"kicker"},"Operate · OAP configuration"),s("h1",null,"Runtime config"),s("p",{class:"lede"},[i(" The connected OAP's resolved configuration, read from the admin port's "),s("code",null,"/debugging/config/dump"),i(" and grouped by module. Secret values (passwords, tokens, access keys) are masked to "),s("code",null,"******"),i(" by OAP itself. Read-only — change config on the OAP side and restart. ")])],-1)),s("button",{type:"button",class:"refresh",onClick:e[0]||(e[0]=t=>d(b)())},"refresh")]),!d(f)&&((o=d(c))!=null&&o.error)?(a(),n("div",q,[e[9]||(e[9]=s("strong",null,"Admin host unreachable",-1)),s("code",null,l(d(c).error),1),s("p",B,[e[3]||(e[3]=i(" Tried ",-1)),s("code",null,l(d(c).adminUrl)+"/debugging/config/dump",1),e[4]||(e[4]=i(". Confirm the OAP ",-1)),e[5]||(e[5]=s("code",null,"admin-server",-1)),e[6]||(e[6]=i(" module is on (",-1)),e[7]||(e[7]=s("code",null,"SW_ADMIN_SERVER=default",-1)),e[8]||(e[8]=i(") and the port is exposed. ",-1))])])):d(u)&&!d(c)?(a(),n("div",D,"Reading data…")):(a(),n(h,{key:2},[s("div",E,[A(s("input",{"onUpdate:modelValue":e[1]||(e[1]=t=>y.value=t),type:"text",class:"filter",placeholder:"Filter keys or values…",spellcheck:"false"},null,512),[[L,y.value]]),s("span",I,l(C.value)+" of "+l(d(g).length)+" keys",1)]),k.value.length===0?(a(),n("div",U,"No keys match “"+l(y.value)+"”.",1)):V("",!0),(a(!0),n(h,null,_(k.value,t=>(a(),n("section",{key:t.module,class:"modblock"},[s("header",W,[s("code",z,l(t.module),1),s("span",K,l(t.rows.length),1)]),s("table",Q,[s("tbody",null,[(a(!0),n(h,null,_(t.rows,m=>(a(),n("tr",{key:m.key},[s("td",$,[s("code",null,l(m.key),1)]),s("td",{class:M(["cval",{empty:m.value==="",masked:O(m.value)}])},[s("code",null,l(m.value===""?"(empty)":m.value),1)],2)]))),128))])])]))),128))],64))])}}}),X=P(j,[["__scopeId","data-v-f8159027"]]);export{X as default};
