1import{d as D,a5 as T,r as h,j as f,a as $,J as o,K as e,v as d,$ as x,F as p,U as b,M as A,Q as a,N as M,O as R,P as _,f as l,L as n,B as V,a8 as F,S as v}from"./vendor-vue-C9I4HdhY.js";import{dh as w,di as C,T as k,K as S,a as H,y as E,P as K}from"./index-Cc-ERo76.js";import{s as U,r as q}from"./relativeTime-BGnoArpS.js";import{p as J,a as O}from"./providerPill-yX1I_yYn.js";import{i as Q}from"./isAdmin-CgLJp51U.js";import{u as z}from"./useNatsSync-BQ8H3YYw.js";import"./vendor-moment-DSem4xRw.js";import"./vendor-editor-markdown-BjRGdLHa.js";import"./vendor-charts-CVpKHQhc.js";import"./vendor-i18n-BYicniCH.js";import"./vendor-motion-yh3LNOre.js";const G={class:"space-y-6"},I={class:"flex items-start justify-between"},W={class:"grid grid-cols-2 gap-3"},X=["onClick"],Y={class:"text-sm font-medium text-gray-700 dark:text-gray-300"},ee={key:0,class:"flex items-center justify-center py-20"},te={class:"grid grid-cols-1 sm:grid-cols-3 gap-4"},se={class:"flex items-center justify-between"},re={class:"text-2xl font-bold text-gray-900 dark:text-gray-100"},ae={class:"grid grid-cols-1 sm:grid-cols-3 gap-4"},ne={class:"flex items-center justify-between"},oe={class:"text-2xl font-bold text-gray-900 dark:text-gray-100"},de={key:0},ie={key:0,class:"rounded-lg bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 px-4 py-3 text-sm text-green-800 dark:text-green-300"},le={key:1,class:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 p-4 space-y-2"},ge={class:"text-sm font-semibold text-red-800 dark:text-red-300"},ce=["onClick"],ue={class:"flex items-center gap-1.5"},me=120*1e3,pe=D({__name:"DnsDashboard",setup(N){const c=T(),u=Q(),i=h([]),m=h([]),g=h(!1),P=f(()=>{const r={provisioning:0,active:0,failed:0};for(const s of i.value)r[s.status]=(r[s.status]??0)+1;return r}),Z=f(()=>{const r={powerdns:0,cloudflare:0,ruledns:0};for(const s of i.value)r[s.provider]=(r[s.provider]??0)+1;return r}),y=f(()=>m.value.filter(r=>r.agent_status!=="online"||!r.agent_last_seen_at?!0:Date.now()-new Date(r.agent_last_seen_at).getTime()>me)),B=[{name:"Zones",path:"/dns/zones",icon:k},{name:"Provider Credentials",path:"/dns/provider-credentials",icon:S}];async function L(){g.value=!0;try{const r=await w.getAll({paginate:null,order:null});i.value=r.data}catch{}if(u)try{const r=await C.getAll({paginate:null,order:null});m.value=r.data}catch{}g.value=!1}return z(w,i,"id"),u&&z(C,m,"id"),$(L),(r,s)=>(n(),o("div",G,[e("div",I,[s[2]||(s[2]=e("div",null,[e("h1",{class:"text-2xl font-bold text-gray-900 dark:text-gray-100"},"DNS"),e("p",{class:"mt-1 text-sm text-gray-500 dark:text-gray-400"},"Zone and record overview across all providers")],-1)),e("button",{type:"button",class:"inline-flex items-center gap-1.5 rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500",onClick:s[0]||(s[0]=t=>d(c).push("/dns/zones/create"))},[...s[1]||(s[1]=[e("svg",{class:"size-4",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{d:"M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z"})],-1),x(" Create Zone ",-1)])])]),e("div",W,[(n(),o(p,null,b(B,t=>e("button",{key:t.path,type:"button",class:"flex items-center gap-2 rounded-lg bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 px-4 py-3 shadow-sm hover:bg-gray-50 dark:hover:bg-gray-800 text-left",onClick:j=>d(c).push(t.path)},[(n(),M(R(t.icon),{class:"size-5 text-indigo-600 dark:text-indigo-400 shrink-0"})),e("span",Y,a(t.name),1)],8,X)),64))]),g.value?(n(),o("div",ee,[...s[3]||(s[3]=[e("svg",{class:"size-7 animate-spin text-indigo-600",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})],-1)])])):(n(),o(p,{key:1},[e("div",null,[s[4]||(s[4]=e("h2",{class:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3"},"Zones by Status",-1)),e("div",te,[(n(),o(p,null,b(["provisioning","active","failed"],t=>e("div",{key:t,class:"rounded-xl bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 p-5 shadow-sm"},[e("div",se,[e("span",{class:_(["inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium capitalize",d(U)(t)])},a(t),3),e("p",re,a(P.value[t]),1)])])),64))])]),e("div",null,[s[5]||(s[5]=e("h2",{class:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3"},"Zones by Provider",-1)),e("div",ae,[(n(),o(p,null,b(["powerdns","cloudflare","ruledns"],t=>e("div",{key:t,class:"rounded-xl bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 p-5 shadow-sm"},[e("div",ne,[e("span",{class:_(["inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",d(J)(t)]
1)},a(d(O)(t)),3),e("p",oe,a(Z.value[t]),1)])])),64))])]),d(u)?(n(),o("div",de,[s[6]||(s[6]=e("h2",{class:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3"},"PowerDNS Fleet Health",-1)),y.value.length===0?(n(),o("div",ie," All "+a(m.value.length)+" server"+a(m.value.length===1?"":"s")+" online and reporting. ",1)):(n(),o("div",le,[e("p",ge,a(y.value.length)+" server"+a(y.value.length===1?"":"s")+" unhealthy or unreachable",1),(n(!0),o(p,null,b(y.value,t=>(n(),o("button",{key:t.id??t.hostname,type:"button",class:"flex w-full items-center justify-between text-left text-sm text-red-700 dark:text-red-400 hover:underline",onClick:j=>d(c).push(`/dns/servers/${t.id}`)},[e("span",ue,[l(d(H),{class:"size-4"}),x(a(t.hostname),1)]),e("span",null,a(t.agent_status)+" · last seen "+a(d(q)(t.agent_last_seen_at)),1)],8,ce))),128))]))])):A("",!0)],64))]))}}),xe={class:"min-h-full bg-gray-50 dark:bg-gray-950"},ye={class:"flex flex-wrap items-center gap-2 px-6 py-4 border-b border-gray-200 dark:border-gray-700 shrink-0"},be={class:"px-4 sm:px-6 lg:px-8 py-8"},Ne=D({name:"DnsDashboard",__name:"index",setup(N){const c=E(),u=Symbol("dns-dashboard-header");return $(()=>{document.title="DNS Dashboard | PlusClouds",c.set(u,{title:"Networking",icon:k,gradient:"linear-gradient(135deg, #0e7490, #06b6d4)",breadcrumbs:[{label:"Networking"},{label:"Dashboard"}]})}),V(()=>c.clear(u)),(i,m)=>{const g=F("RouterLink");return n(),o("div",xe,[e("div",ye,[l(g,{to:"/dns",class:"inline-flex items-center gap-1.5 rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm transition-colors"},{default:v(()=>[l(d(K),{class:"size-4"}),x(" "+a(i.$t("Dashboard")),1)]),_:1}),l(g,{to:"/dns/zones",class:"inline-flex items-center gap-1.5 rounded-md bg-white dark:bg-gray-800 px-3 py-2 text-sm font-semibold text-gray-700 dark:text-gray-200 shadow-sm ring-1 ring-inset ring-gray-300 dark:ring-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"},{default:v(()=>[l(d(k),{class:"size-4"}),x(" "+a(i.$t("Zones")),1)]),_:1}),l(g,{to:"/dns/provider-credentials",class:"inline-flex items-center gap-1.5 rounded-md bg-white dark:bg-gray-800 px-3 py-2 text-sm font-semibold text-gray-700 dark:text-gray-200 shadow-sm ring-1 ring-inset ring-gray-300 dark:ring-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"},{default:v(()=>[l(d(S),{class:"size-4"}),x(" "+a(i.$t("Provider Credentials")),1)]),_:1})]),e("div",be,[l(pe)])])}}});export{Ne 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.