import{u as B}from"./useQuery-DB4moXtm.js";import{i as u,x as O,d as R,c as r,a as e,f as a,u as i,t as n,F as g,r as y,o as d,n as k}from"./index-CXwCk-SR.js";import{_ as q}from"./_plugin-vue_export-helper-DlAUqK2U.js";function x(){const p=B({queryKey:["oap-ttl"],queryFn:()=>O.oapOps.ttl(),staleTime:6e4,refetchOnWindowFocus:!1}),c=u(()=>p.data.value??null),v=u(()=>{var l;return((l=c.value)==null?void 0:l.reachable)??!1}),m=u(()=>{var l;return(l=c.value)==null?void 0:l.records}),h=u(()=>{var l;return(l=c.value)==null?void 0:l.metrics});return{isLoading:p.isLoading,data:c,reachable:v,records:m,metrics:h,refetch:p.refetch}}const D={class:"ttl"},M={class:"page-head"},w={key:0,class:"last-error block"},A={key:1,class:"empty"},F={class:"pane"},N={class:"grid"},P={class:"sw-card-head"},V={class:"kpi-body"},E={class:"kpi-value"},H={class:"pane"},$={class:"grid"},z={class:"sw-card-head"},Q={class:"kpi-body"},Z={class:"kpi-value"},G=R({__name:"TtlView",setup(p){const{reachable:c,records:v,metrics:m,data:h,isLoading:l,refetch:T}=x(),C=u(()=>{const o=v.value;return o?[{label:"Normal",hot:o.normal,cold:o.coldNormal,hasCold:!0},{label:"Trace",hot:o.trace,cold:o.coldTrace,hasCold:!0},{label:"Zipkin trace",hot:o.zipkinTrace,cold:o.coldZipkinTrace,hasCold:!0},{label:"Log",hot:o.log,cold:o.coldLog,hasCold:!0},{label:"Browser error log",hot:o.browserErrorLog,cold:o.coldBrowserErrorLog,hasCold:!0}]:[]}),L=u(()=>{const o=m.value;return o?[...o.metadata!==void 0?[{label:"Metadata",hot:o.metadata,hasCold:!1}]:[],{label:"Minute",hot:o.minute,cold:o.coldMinute,hasCold:!0},{label:"Hour",hot:o.hour,cold:o.coldHour,hasCold:!0},{label:"Day",hot:o.day,cold:o.coldDay,hasCold:!0}]:[]});function f(o){return o===void 0?"—":`${o} d`}function _(o){return o.hasCold?o.cold===void 0?"—":o.cold<0?"no cold stage":`cold: ${o.cold} d`:"no cold stage"}return(o,t)=>{var b;return d(),r("div",D,[e("header",M,[t[1]||(t[1]=e("div",null,[e("div",{class:"kicker"},"Operate · Data retention"),e("h1",null,"Time To Live"),e("p",{class:"lede"},[a(" How long the connected OAP keeps each class of data, reported in whole days. "),e("strong",null,"Records"),a(" cover event-style data (traces, logs); "),e("strong",null,"metrics"),a(" cover the aggregated tiers (minute / hour / day) plus metadata. The "),e("code",null,"cold"),a(" value is the cold-stage retention (BanyanDB) — "),e("em",null,"no cold stage"),a(" means cold storage isn't configured. Read-only; change retention on the OAP side. ")])],-1)),e("button",{type:"button",class:"refresh",onClick:t[0]||(t[0]=s=>i(T)())},"refresh")]),!i(c)&&((b=i(h))!=null&&b.error)?(d(),r("div",w,[t[2]||(t[2]=e("strong",null,"OAP unreachable",-1)),e("code",null,n(i(h).error),1),t[3]||(t[3]=e("p",{class:"hint"},[a(" TTL is read from the query / GraphQL port via "),e("code",null,"getRecordsTTL"),a(" / "),e("code",null,"getMetricsTTL"),a(". Confirm "),e("code",null,"oap.queryUrl"),a(" points at a live OAP. ")],-1))])):i(l)&&!i(h)?(d(),r("div",A,"Reading data…")):(d(),r(g,{key:2},[e("section",F,[t[4]||(t[4]=e("header",{class:"pane-head"},[e("h2",null,"Records")],-1)),e("div",N,[(d(!0),r(g,null,y(C.value,s=>(d(),r("div",{key:s.label,class:"sw-card kpi"},[e("div",P,[e("h4",null,n(s.label),1)]),e("div",V,[e("div",E,n(f(s.hot)),1),e("div",{class:k(["kpi-label",{none:s.hasCold&&(s.cold??-1)<0}])},n(_(s)),3)])]))),128))])]),e("section",H,[t[5]||(t[5]=e("header",{class:"pane-head"},[e("h2",null,"Metrics")],-1)),e("div",$,[(d(!0),r(g,null,y(L.value,s=>(d(),r("div",{key:s.label,class:"sw-card kpi"},[e("div",z,[e("h4",null,n(s.label),1)]),e("div",Q,[e("div",Z,n(f(s.hot)),1),e("div",{class:k(["kpi-label",{none:s.hasCold&&(s.cold??-1)<0}])},n(_(s)),3)])]))),128))])])],64))])}}}),U=q(G,[["__scopeId","data-v-5c793d3d"]]);export{U as default};
