MOON
Server: Apache
System: Linux server1.studioinfinity.com.br 2.6.32-954.3.5.lve1.4.90.el6.x86_64 #1 SMP Tue Feb 21 12:26:30 UTC 2023 x86_64
User: artinside (517)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/netdata/usr/local/local/share/netdata/web/v3/4959.dc3f26f3626ccf9b7c60.chunk.js
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"8b1701d6db299c2b7259bc89c3ef365137725d5e"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7c05f254-544d-4007-9031-5741c76ed225",e._sentryDebugIdIdentifier="sentry-dbid-7c05f254-544d-4007-9031-5741c76ed225")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[4959],{57738(e,t,o){o.d(t,{L:()=>y});o(98992),o(8872);var n=o(96540),r=o(76667),a=o(30569),s=o(63872),l=o(19186),i=o(10602),d=o(24609),c=o(30731),u=o(96957),h=o(67294),x=o(45706),p=o(3319);const g=e=>"function"===e.type&&"feed"===e.flavour,m=(e,t)=>{const o=t[0]||null;return Object.entries(e).reduce((e,t)=>{let[n,r]=t;const{pristine:a,data:s,columns:l,aggregations:i,aggregatedView:d,acceptedParams:c,requiredParams:u,...h}=r;return"chart"===h.type?e[n]={...h,nodesScope:[]}:(e=>"function"===e.type&&!g(e))(h)?e[n]={...h,selectedNodeIds:o?[o]:[]}:g(h)?e[n]={...h,selectedNodeIds:[]}:e[n]="selectedNodeIds"in h?{...h,selectedNodeIds:[]}:h,e},{})},y=()=>{const e=(0,r.Zp)(),[t,o]=(0,s.A)(),g=(0,d.vt)(),y=(0,l.ID)(),b=(0,d.bq)(),f=(0,l.QW)(),j=(0,i.CK)(),v=(0,i.nj)(),{sendLog:w}=(0,p.A)();return(0,a.yF)((0,n.useCallback)(async(n,r,a)=>{if(v)try{const{data:o}=await(0,c.f7)(g,y,a),{layout:n,containerIds:s,containers:l,cards:i,dashboard:d}=(0,x.S)(o),p=m(i,j),v=`Copy of ${d.name}`,{data:k}=await(0,c.k9)(g,y,{name:v}),S={version:k.version+1||2,snapshot:{uiState:{layout:n,containerIds:s,containers:l,cards:p,respectNodesScope:d.respectNodesScope,duplicate:{id:a}}}};await(0,c.mQ)(g,y,k.id,S),r((0,u._d)(k.id),{name:v,...S,spaceId:g,roomId:y,...k,loaded:!0}),r((0,h.hZ)(y),{...k,spaceId:g,roomId:y}),w({feature:"DuplicatedCustomDashboard",isSuccess:!0,dashboardId:k.id}),t({header:"Dashboards",text:"Dashboard duplicated!"}),e(`/spaces/${b}/rooms/${f}/dashboards/${k.slug}`,{state:{showDuplicateWizard:!0}})}catch(s){o(s)}else o({header:"Dashboards",text:"Please wait for nodes to finish loading."})},[g,y,b,f,j,v,e,t,o,w]))}},74959(e,t,o){o.d(t,{J:()=>Nn,A:()=>An});var n=o(96540),r=o(38429),a=o(76667),s=o(98591),l=o(85660),i=o(96957),d=o(78385),c=o(57068),u=o(6393),h=o(19186),x=o(87083),p=o(24013),g=(o(98992),o(81454),o(29263)),m=o(24609),y=o(77814),b=(o(74423),o(3949),o(25509),o(65223),o(60321),o(41927),o(11632),o(64377),o(66771),o(12516),o(68931),o(52514),o(35694),o(52774),o(49536),o(21926),o(94483),o(16215),o(30569)),f=o(1011),j=o(33718);const v={text:j.cY,chart:j.Pk,nodeGrid:j.Lj,nodeList:j.Ng,nodeStats:j.wj,alertStatus:j.z6,alertsPerNode:j.fB,hourlyAlerts:j.XG,statsOverview:j.$2,dataRetention:j.fD,alertNodes:j.Sp,replicationStats:j.G4},w=(e,t)=>"chart"===e.type?((e,t)=>{const{type:o,layout:n,context:r,...a}=e;return{...j.kG,...j.Pk,id:(0,f.A)(),contextScope:[r],nodesScope:t,...a}})(e,t):((e,t)=>{const{type:o,layout:n,...r}=e,a=v[o];return((e,t)=>"nodesScope"in e?{...e,nodesScope:t}:"selectedNodeIds"in e?{...e,selectedNodeIds:t}:e)({...j.kG,...a,id:(0,f.A)(),...r},t)})(e,t),k=e=>(0,b.yF)((t,o,n,r)=>{const a=t((0,c.kY)({id:e,key:"layout"})),s=t((0,c.kY)({id:e,key:"containerIds"}))[0]||"A",l=(e=>{let t=0;return Object.values(e).forEach(e=>{e.forEach(e=>{const o=e.top+e.height;o>t&&(t=o)})}),t})(a),d=((e,t)=>{let o=0,n=t,r=0;return e.map(e=>{const{w:t,h:a}=e.layout;o+t>12&&(n+=r,o=0,r=0);const s={left:o,top:n,width:t,height:a,minWidth:1,minHeight:1};return o+=t,r=Math.max(r,a),s})})(n.cards,l),h=[];n.cards.forEach((t,n)=>{const a=w(t,r),l={...d[n],id:a.id};h.push(a.id),o((0,u.nG)({id:e,resourceId:a.id}),a),o((0,c.xB)(e),e=>({...e,[s]:[...e[s]||[],l]}))}),o((0,i.Qx)({id:e,key:"cardIds"}),e=>[...e,...h]),o((0,c.MX)(e),e=>e.includes(s)?e:[...new Set([...e,s])])}),S=[{id:"server-overview",name:"Server Overview",description:"Node status, CPU, memory, disk, and network at a glance",category:"infrastructure",contexts:["system.cpu","system.ram","disk.space","system.net"],cards:[{type:"text",textType:"title",text:"Server Overview",layout:{w:12,h:1}},{type:"nodeStats",layout:{w:4,h:4}},{type:"nodeGrid",layout:{w:8,h:4}},{type:"chart",context:"system.cpu",title:"Top Nodes by CPU Utilization",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"system.ram",title:"Top Nodes by Memory Usage",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"disk.space",title:"Top Nodes by Disk Space",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"system.net",title:"Top Nodes by Network Traffic",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}}]},{id:"server-deep-dive",name:"Server Deep Dive",description:"Comprehensive single-server metrics: load, CPU, memory, disk, network, and more",category:"infrastructure",contexts:["system.load","system.cpu","system.ram","system.net","disk.io","disk.space","system.interrupts","system.fds","mem.pgfaults"],cards:[{type:"text",textType:"title",text:"Server Metrics",layout:{w:12,h:1}},{type:"chart",context:"system.load",title:"System Load Average",layout:{w:6,h:6}},{type:"chart",context:"system.cpu",title:"CPU Utilization",layout:{w:6,h:6}},{type:"chart",context:"system.ram",title:"Memory Usage",layout:{w:6,h:6}},{type:"chart",context:"system.net",title:"Network Traffic",layout:{w:6,h:6}},{type:"chart",context:"disk.io",title:"Disk I/O",layout:{w:6,h:6}},{type:"chart",context:"disk.space",title:"Top Partitions by Disk Space",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["instance"],layout:{w:6,h:6}},{type:"chart",context:"disk.space",title:"Disk Space Distribution",chartLibrary:"d3pie",groupBy:["percentage-of-instance"],layout:{w:6,h:6}},{type:"chart",context:"system.interrupts",title:"System Interrupts",layout:{w:6,h:6}},{type:"chart",context:"system.fds",title:"Open File Descriptors",layout:{w:6,h:6}},{type:"chart",context:"mem.pgfaults",title:"Memory Page Faults",layout:{w:6,h:6}},{type:"chart",context:"mem.committed",title:"Committed Memory",layout:{w:6,h:6}}]},{id:"disk-performance",name:"Disk Performance",description:"I/O throughput, IOPS, latency, utilization, and space across disks",category:"infrastructure",contexts:["disk.io","disk.ops","disk.await","disk.space","disk.util"],cards:[{type:"text",textType:"title",text:"Disk Performance",layout:{w:12,h:1}},{type:"chart",context:"disk.io",title:"Top Disks by I/O Throughput",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["device"],layout:{w:6,h:6}},{type:"chart",context:"disk.ops",title:"Top Disks by IOPS",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["device"],layout:{w:6,h:6}},{type:"chart",context:"disk.await",title:"Top Disks by Latency",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["device"],layout:{w:6,h:6}},{type:"chart",context:"disk.util",title:"Top Disks by Utilization",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["device"],layout:{w:6,h:6}},{type:"chart",context:"disk.space",title:"Disk Space Distribution",chartLibrary:"d3pie",groupBy:["percentage-of-instance"],layout:{w:6,h:6}},{type:"chart",context:"disk.space",title:"Top Mounts by Disk Space",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["instance"],layout:{w:6,h:6}}]},{id:"container-overview",name:"Container Overview",description:"CPU, memory, network, and I/O across all containers",category:"containers",contexts:["cgroup.cpu","cgroup.mem_usage","cgroup.net_net","cgroup.io"],cards:[{type:"text",textType:"title",text:"Container Monitoring",layout:{w:12,h:1}},{type:"chart",context:"cgroup.cpu",title:"Top Containers by CPU Usage",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["instance"],layout:{w:6,h:6}},{type:"chart",context:"cgroup.mem_usage",title:"Top Containers by Memory Usage",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["instance"],layout:{w:6,h:6}},{type:"chart",context:"cgroup.mem_usage",title:"Memory Distribution",chartLibrary:"d3pie",groupBy:["percentage-of-instance"],layout:{w:6,h:6}},{type:"chart",context:"cgroup.net_net",title:"Top Containers by Network Traffic",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["instance"],layout:{w:6,h:6}},{type:"chart",context:"cgroup.io",title:"Top Containers by I/O",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["instance"],layout:{w:6,h:6}}]},{id:"kubernetes-overview",name:"Kubernetes Overview",description:"CPU, memory, network, and throttling across Kubernetes namespaces",category:"containers",contexts:["k8s.cgroup.cpu","k8s.cgroup.mem_usage","k8s.cgroup.net_net","k8s.cgroup.throttled_duration"],cards:[{type:"text",textType:"title",text:"Kubernetes Overview",layout:{w:12,h:1}},{type:"chart",context:"k8s.cgroup.cpu",title:"Top Namespaces by CPU",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["k8s_namespace"],layout:{w:6,h:6}},{type:"chart",context:"k8s.cgroup.mem_usage",title:"Top Namespaces by Memory",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["k8s_namespace"],layout:{w:6,h:6}},{type:"chart",context:"k8s.cgroup.net_net",title:"Top Namespaces by Network Traffic",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["k8s_namespace"],layout:{w:6,h:6}},{type:"chart",context:"k8s.cgroup.throttled_duration",title:"Top Namespaces by CPU Throttling",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["k8s_namespace"],layout:{w:6,h:6}}]},{id:"network-device-overview",name:"Network Device Overview",description:"Traffic, errors, status, and CPU for SNMP-monitored network devices",category:"network",contexts:["snmp.device_net_interface_traffic","snmp.device_prof_cpu_usage","snmp.device_net_interface_errors","snmp.device_net_interface_oper_status"],cards:[{type:"text",textType:"title",text:"Network Monitoring",layout:{w:12,h:1}},{type:"nodeGrid",layout:{w:12,h:4}},{type:"chart",context:"snmp.device_net_interface_traffic",title:"Top Devices by Interface Traffic",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"snmp.device_net_interface_errors",title:"Top Devices by Interface Errors",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"snmp.device_net_interface_oper_status",title:"Top Devices by Interface Status",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"snmp.device_prof_cpu_usage",title:"Top Devices by CPU Usage",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}}]},{id:"firewall-metrics",name:"Firewall Metrics",description:"Network traffic, SNMP CPU, system CPU, and memory for firewall devices",category:"network",contexts:["snmp.device_net_interface_traffic","snmp.device_prof_cpu_usage","system.cpu","system.ram"],cards:[{type:"text",textType:"title",text:"Firewall Metrics",layout:{w:12,h:1}},{type:"chart",context:"snmp.device_net_interface_traffic",title:"Top Devices by Network Traffic",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"snmp.device_prof_cpu_usage",title:"Top Devices by CPU Usage",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"system.cpu",title:"Top Nodes by System CPU",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"system.ram",title:"Top Nodes by Memory Usage",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}}]},{id:"dns-network-health",name:"DNS & Network Health",description:"Ping latency, packet loss, and DNS query performance",category:"network",contexts:["ping.host_rtt","ping.host_packet_loss","dns_query.query_time","dns_query.query_status"],cards:[{type:"text",textType:"title",text:"DNS & Network Health",layout:{w:12,h:1}},{type:"chart",context:"ping.host_rtt",title:"Top Hosts by Round-Trip Time",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["host"],layout:{w:6,h:6}},{type:"chart",context:"ping.host_packet_loss",title:"Top Hosts by Packet Loss",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["host"],layout:{w:6,h:6}},{type:"chart",context:"dns_query.query_time",title:"Top DNS Servers by Query Time",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["server"],layout:{w:6,h:6}},{type:"chart",context:"dns_query.query_status",title:"DNS Query Status",chartLibrary:"bars",groupBy:["dimension"],layout:{w:6,h:6}}]},{id:"web-server-overview",name:"Web Server Overview",description:"Connections, requests, traffic, and workers for Nginx and Apache servers",category:"applications",contexts:["nginx.connections","nginx.requests","apache.connections","apache.requests","apache.net","apache.workers"],cards:[{type:"text",textType:"title",text:"Web Server Overview",layout:{w:12,h:1}},{type:"chart",context:"nginx.connections",title:"Top Nodes by Nginx Connections",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"nginx.requests",title:"Top Nodes by Nginx Requests",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"apache.connections",title:"Top Nodes by Apache Connections",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"apache.requests",title:"Top Nodes by Apache Requests",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"apache.net",title:"Top Nodes by Apache Traffic",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"apache.workers",title:"Top Nodes by Apache Workers",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}}]},{id:"database-overview",name:"Database Overview",description:"Queries, connections, traffic, and storage for MySQL and Postgres",category:"applications",contexts:["mysql.queries","mysql.connections","mysql.net","postgres.connections_utilization","postgres.db_size"],cards:[{type:"text",textType:"title",text:"Database Overview",layout:{w:12,h:1}},{type:"chart",context:"mysql.queries",title:"Top Nodes by MySQL Queries",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"mysql.connections",title:"Top Nodes by MySQL Connections",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"mysql.net",title:"Top Nodes by MySQL Traffic",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"postgres.connections_utilization",title:"Top Nodes by Postgres Connection Usage",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"postgres.db_size",title:"Top Databases by Size",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}}]},{id:"endpoint-monitoring",name:"Endpoint Monitoring",description:"Availability and response time for HTTP-checked endpoints",category:"applications",contexts:["httpcheck.response_time","httpcheck.status"],cards:[{type:"text",textType:"title",text:"Endpoint Monitoring",layout:{w:12,h:1}},{type:"chart",context:"httpcheck.status",title:"Endpoint Status by URL",chartLibrary:"bars",groupBy:["label"],groupByLabel:["url"],layout:{w:6,h:6}},{type:"chart",context:"httpcheck.response_time",title:"Top Endpoints by Response Time",dimensionsSort:"valueDesc",groupBy:["label"],groupByLabel:["url"],layout:{w:6,h:6}}]},{id:"certificate-expiry",name:"Certificate & Domain Expiry",description:"SSL certificate and domain registration expiration monitoring",category:"applications",contexts:["x509check.time_until_expiration","whoisquery.time_until_expiration"],cards:[{type:"text",textType:"title",text:"Certificate & Domain Expiry",layout:{w:12,h:1}},{type:"chart",context:"x509check.time_until_expiration",title:"Certificates by Time Until Expiry",dimensionsSort:"valueAsc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["source"],layout:{w:6,h:6}},{type:"chart",context:"whoisquery.time_until_expiration",title:"Domains by Time Until Expiry",dimensionsSort:"valueAsc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["domain"],layout:{w:6,h:6}}]}];o(54520);const C=(e,t)=>{const o=new Set(t),n=e.filter(e=>((e,t)=>{if(e.has(t))return!0;if(!t.includes("*"))return!1;const o=new RegExp("^"+t.replace(/\./g,"\\.").replace(/\*/g,".*")+"$");return[...e].some(e=>o.test(e))})(o,e));return{matched:n.length,total:e.length}};var I=o(74848);const T=e=>{let{matched:t,total:o}=e;const n=((e,t)=>0===e?"textLite":e===t?"success":"warning")(t,o);return(0,I.jsx)(r.Flex,{padding:[1,2],round:1,background:"elementBackground",alignItems:"center",children:(0,I.jsxs)(r.Text,{color:n,fontSize:"10px",strong:!0,children:[t,"/",o," metrics available"]})})},F={text:"border",chart:"primary",nodeGrid:"success",nodeStats:"warning",nodeList:"disabled",alertStatus:"error",alertsPerNode:"error",hourlyAlerts:"warning",statsOverview:"accent",dataRetention:"disabled",alertNodes:"error",replicationStats:"accent"},N=e=>{let{preset:t}=e;const{cards:o}=t;let n=0,a=0,s=0;const l=o.map((e,t)=>{const{w:o,h:l}=e.layout;n+o>12&&(a+=s,n=0,s=0);const i={position:"absolute",left:16*n,top:4*a,width:16*o-1,height:4*l-1};return n+=o,s=Math.max(s,l),(0,I.jsx)(r.Flex,{round:1,background:F[e.type]||"border",backgroundOpacity:.3,border:{side:"all",color:F[e.type]||"border"},style:i},t)}),i=4*(a+s);return(0,I.jsx)(r.Flex,{position:"relative",width:"192px",height:`${i}px`,children:l})},A=e=>{let{preset:t,availability:o,onClick:n}=e;return(0,I.jsxs)(r.Flex,{column:!0,gap:2,padding:[3],round:1,border:{side:"all",color:"border"},background:"mainBackground",cursor:"pointer",_hover:{border:{side:"all",color:"primary"}},onClick:n,"data-testid":`preset-card-${t.id}`,children:[(0,I.jsx)(r.Flex,{justifyContent:"center",padding:[2],children:(0,I.jsx)(N,{preset:t})}),(0,I.jsx)(r.Text,{strong:!0,children:t.name}),(0,I.jsx)(r.TextSmall,{color:"textDescription",children:t.description}),(0,I.jsx)(T,{matched:o.matched,total:o.total})]})};var L=o(10602),B=o(42721);const D=e=>{let{preset:t,onApply:o,onBack:a}=e;const s=(0,L.CK)(),[l,i]=(0,n.useState)([]);return(0,I.jsxs)(r.Flex,{column:!0,gap:4,padding:[4],height:"100%",children:[(0,I.jsxs)(r.Flex,{column:!0,gap:2,children:[(0,I.jsx)(r.H4,{children:t.name}),(0,I.jsx)(r.Text,{color:"textLite",children:"Select which nodes these charts should display data from. Leave empty to include all nodes."})]}),(0,I.jsx)(r.Flex,{flex:!0,overflow:{vertical:"auto"},children:(0,I.jsx)(B.A,{nodeIds:s,selectedNodeIds:l,setSelectedNodeIds:i,multi:!0})}),(0,I.jsxs)(r.Flex,{gap:2,justifyContent:"flex-end",children:[(0,I.jsx)(r.Button,{label:"Back",flavour:"hollow",onClick:a}),(0,I.jsx)(r.Button,{label:"Apply template",onClick:()=>o(l)})]})]})},_=[{id:"infrastructure",name:"Infrastructure",icon:"node"},{id:"containers",name:"Containers",icon:"container"},{id:"network",name:"Network",icon:"networkingStack"},{id:"applications",name:"Applications",icon:"applicationsSolid"}],M=e=>{let{category:t,isActive:o,onClick:n}=e;return(0,I.jsxs)(r.Flex,{alignItems:"center",gap:2,padding:[2,3],round:.5,cursor:"pointer",background:o?"primary":void 0,backgroundOpacity:o?.1:void 0,_hover:o?void 0:{background:"primary",backgroundOpacity:.05},onClick:n,"data-testid":`preset-category-${t.id}`,children:[(0,I.jsx)(r.Icon,{name:t.icon,color:o?"primary":"text",width:"16px",height:"16px"}),(0,I.jsx)(r.Text,{color:o?"primary":"text",strong:o,children:t.name})]})},z=e=>{let{categories:t,activeCategoryId:o,onSelect:n}=e;return(0,I.jsx)(r.Flex,{column:!0,gap:1,padding:[2],width:"180px",flex:"shrink",children:t.map(e=>(0,I.jsx)(M,{category:e,isActive:o===e.id,onClick:()=>n(e.id)},e.id))})},O=e=>{let{presets:t,availableContexts:o,onSelect:n}=e;return(0,I.jsx)(r.Flex,{column:!0,gap:4,padding:[4],flex:!0,children:t.map(e=>(0,I.jsx)(A,{preset:e,availability:C(e.contexts,o),onClick:()=>n(e)},e.id))})},E=e=>{let{dashboardId:t,onClose:o}=e;const a=(0,m.vt)(),s=(0,h.ID)(),{charts:l}=(0,y.A)(a,s),i=k(t),[d,c]=(0,n.useState)(_[0].id),[u,x]=(0,n.useState)(null),p=(0,n.useMemo)(()=>Object.keys(l),[l]),b=(0,n.useMemo)(()=>{return e=d,S.filter(t=>t.category===e);var e},[d]),f=e=>{i(u,e),o()};return u?(0,I.jsx)(r.Layer,{position:"center",backdrop:!0,onClickOutside:o,onEsc:o,children:(0,I.jsxs)(r.Flex,{column:!0,background:"mainBackground",round:2,width:"600px",height:{max:"80vh"},border:{side:"all",color:"border"},children:[(0,I.jsx)(g.z,{title:"Select Nodes",isSubmodal:!0,onClose:()=>x(null)}),(0,I.jsx)(D,{preset:u,onApply:f,onBack:()=>x(null)})]})}):(0,I.jsx)(r.Layer,{position:"center",backdrop:!0,onClickOutside:o,onEsc:o,children:(0,I.jsxs)(r.Flex,{column:!0,background:"mainBackground",round:2,width:"800px",height:{max:"80vh"},border:{side:"all",color:"border"},children:[(0,I.jsx)(g.z,{title:"Dashboard Templates",onClose:o}),(0,I.jsxs)(r.Flex,{flex:!0,overflow:"hidden",children:[(0,I.jsx)(z,{categories:_,activeCategoryId:d,onSelect:c}),(0,I.jsx)(r.Flex,{flex:!0,overflow:{vertical:"auto"},border:{side:"left",color:"border"},children:(0,I.jsx)(O,{presets:b,availableContexts:p,onSelect:x})})]})]})})},P=e=>{let{dashboardId:t,compact:o,...a}=e;const[,l]=(0,s.A)("addChartModal"),[i,d]=(0,n.useState)(!1),[c,u]=(0,n.useState)(null),x=(0,p.TG)().length>0,b=(0,m.vt)(),f=(0,h.ID)(),{charts:j}=(0,y.A)(b,f),v=k(t),w=(0,n.useMemo)(()=>Object.keys(j),[j]),T=(0,n.useMemo)(()=>(e=>{const t=S.map(t=>{const o=C(t.contexts,e);return{preset:t,availability:o,ratio:o.total>0?o.matched/o.total:0}});return t.sort((e,t)=>t.ratio-e.ratio),t.slice(0,4)})(w),[w]),F=e=>{v(c,e),u(null)};return c?(0,I.jsx)(r.Layer,{position:"center",backdrop:!0,onClickOutside:()=>u(null),onEsc:()=>u(null),children:(0,I.jsxs)(r.Flex,{column:!0,background:"mainBackground",round:2,width:"600px",height:{max:"80vh"},border:{side:"all",color:"border"},children:[(0,I.jsx)(g.z,{title:"Select Nodes",isSubmodal:!0,onClose:()=>u(null)}),(0,I.jsx)(D,{preset:c,onApply:F,onBack:()=>u(null)})]})}):(0,I.jsxs)(r.Flex,{column:!0,alignItems:"center",justifyContent:"center",overflow:{vertical:"auto"},flex:!0,basis:0,"data-testid":"dashboardBlankSlate",...a,children:[x?(0,I.jsx)(I.Fragment,{children:!o&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(r.Text,{margin:[0,0,4],children:"Based on your setup we recommend these templates to start with"}),(0,I.jsx)(r.Flex,{gap:6,wrap:!0,children:T.map(e=>{let{preset:t,availability:o}=e;return(0,I.jsx)(r.Flex,{width:"220px",children:(0,I.jsx)(A,{preset:t,availability:o,onClick:()=>u(t)})},t.id)})}),(0,I.jsx)(r.Text,{margin:[8,0,4],color:"textLite",children:"or you can start building your own dashboard from scratch!"}),(0,I.jsxs)(r.Flex,{gap:2,children:[(0,I.jsx)(r.Button,{onClick:l,label:"Add chart","data-testid":"dashboardBlankSlate-addChart"}),(0,I.jsx)(r.Button,{flavour:"hollow",onClick:()=>d(!0),label:"Browse templates","data-testid":"dashboardBlankSlate-browseTemplates"})]})]})}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(r.Text,{textAlign:"center",children:"You don't have any available node to retrieve charts from."}),(0,I.jsx)(r.Text,{textAlign:"center",children:"Please verify your nodes' state and/or connect a new node to Netdata"})]}),i&&(0,I.jsx)(E,{dashboardId:t,onClose:()=>d(!1)})]})};var U=o(882);const q="20px",R=(0,U.css)(["background-image:radial-gradient( circle,"," ",",transparent "," );background-size:"," ",";background-position:center center;"],(0,r.getColor)("borderSecondary"),"1px","1px",q,q),$=(0,U.default)(r.Flex).attrs(e=>{let{active:t}=e;return{width:"100%",flex:!0,overflow:"hidden",...t&&{background:"mainBackground"}}}).withConfig({displayName:"gridBackground__GridBackground",componentId:"sc-86s97v-0"})(["",""],e=>{let{active:t}=e;return t&&R});o(72577);var G=o(32788),V=o(47410),K=o(23226),H=o(5907),W=o(21e3),Q=o(87733),Y=o(67012),J=o(28657),Z=o(87398),X=o(13752),ee=o(92815),te=o(72582),oe=o(78072),ne=o(91832),re=o(23565),ae=o(52795),se=o(54251),le=o(45087);const ie=()=>(0,I.jsxs)(r.Flex,{column:!0,width:"300px",gap:1,children:[(0,I.jsx)(r.TextSmall,{strong:!0,children:"Not finding a chart?"}),(0,I.jsxs)(r.TextSmall,{children:["When selecting",(0,I.jsx)(r.TextSmall,{strong:!0,margin:[0,1],children:"All Nodes"}),"you search and add charts using their context. The outcome will be a composite chart over All Nodes, like on the Overview tab."]}),(0,I.jsxs)(r.TextSmall,{children:["When you select a",(0,I.jsx)(r.TextSmall,{strong:!0,margin:[0,1],children:"specific Node"}),"you search and add charts using their name. The result is a specific chart over the node selected, like on Single Node tab."]})]}),de=()=>(0,I.jsx)(le.A,{isBasic:!0,plain:!0,content:ie,align:"bottom",children:(0,I.jsx)(r.Icon,{name:"question",color:"textDescription",size:"small"})}),ce=e=>{let{spaceId:t,roomId:o,value:a,onChange:s,options:l,testid:i,selectedNodeIds:d,metadata:c}=e;const[u,h]=(0,n.useState)(),x=a?.value,p=(0,Z.eg)(),g=(0,re.CS)({type:"chart",entity:x,path:"/"}),m=(0,Q.K)({spaceId:t,roomId:o}),y=(0,n.useMemo)(()=>{p.getNodes({id:"newDashboardChart"}).forEach(e=>e.destroy());const{info:e,valueRange:t,height:n,colors:r}=(0,W.Ay)(c),a=p.makeChart({attributes:{id:"newDashboardChart",contextScope:[x],host:m,roomId:o,info:e,valueRange:t,height:n+207,enabledNavigation:!1,nodesScope:d,...r&&{colors:r},toolboxElements:[oe.default,te.default,X.default,ee.default,ne.A]}});p.getRoot().appendChild(a),h((0,ae.A)(a.getAttributes()));const s=a.getAttribute("chartLibrary");return a.setAttributes({...u,...(0,ae.A)(g,!0)}),(0,se.A)(a,s,a.getAttribute("chartLibrary")),a},[p,x]);return(0,Y.A)(()=>{if(!y||!g)return;const e=y.getAttribute("chartLibrary");y.updateAttributes({...u,...(0,ae.A)(g,!0)}),(0,se.A)(y,e,y.getAttribute("chartLibrary")),y.trigger("fetch")},[y,o,x,g,u]),(0,n.useLayoutEffect)(()=>()=>y.destroy(),[]),(0,I.jsxs)(r.Flex,{gap:6,column:!0,children:[(0,I.jsxs)(r.Flex,{gap:2,column:!0,"data-testid":i,children:[(0,I.jsxs)(r.Flex,{gap:2,children:[(0,I.jsx)(r.H5,{children:"Chart context"}),(0,I.jsx)(de,{})]}),(0,I.jsx)(r.Select,{options:l,value:a,onChange:s,isClearable:!0,form:i})]}),a&&(0,I.jsx)(r.Flex,{height:{min:"320px"},column:!0,children:(0,I.jsx)(J.A,{chart:y,margin:[2,0,0]})})]})};var ue=o(43116);const he={label:"All Nodes",value:"all-nodes"},xe={label:"All Nodes (no reachable nodes)",value:"all-nodes",isDisabled:!0},pe=e=>{let{id:t,isLive:o,nodeStatus:n,name:r}=e;return{label:o?r:`${r} (${n})`,value:t,isDisabled:!o}},ge=e=>({value:e,label:e}),me=e=>{let{id:t,onClose:o}=e;const a=(0,m.vt)(),s=(0,h.ID)(),l=(0,i.fz)(t,"name"),d=(0,h.XA)("name"),c=(0,L.CK)(),u=(0,p.BU)().length>0,x=(0,L.nj)(),b=(0,p.Gt)(c),f=(0,H.nM)(t),j=u?he:xe,[v,w]=(0,n.useState)(j.value),[k,S]=(0,n.useState)(null),C=(0,n.useMemo)(()=>[j,...b.map(pe)],[b]),T=(0,n.useMemo)(()=>C.find(e=>{let{value:t}=e;return t===v}),[C,v]),F=(0,n.useCallback)(e=>{w(e?.value||j.value),S(null)},[]),N=(0,n.useMemo)(()=>v===j.value?[]:[v],[v]),{charts:A,error:B}=(0,y.A)(a,s,N),D=(0,n.useMemo)(()=>Object.keys(A).sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:"accent",ignorePunctuation:!0})).map(ge),[A]);(0,n.useEffect)(()=>{D.length&&T&&S(e=>e||D[0].value)},[k,D,T]);const _=(0,n.useMemo)(()=>k&&ge(k),[k]),M=(0,n.useCallback)(e=>S(e?.value),[]),z=A[k],O=(0,Z.eg)(),E=(0,n.useCallback)(()=>{const e=O.getNode({id:"newDashboardChart"}),t=(0,ae.h)(e.getAttributes());f(t.contextScope,t,()=>setTimeout(o))},[v,z]),P=!k,[,U]=(0,K.A)();return(0,n.useEffect)(()=>(U(!0),()=>U(!1))),(0,I.jsx)(G.GO,{onClose:o,children:B?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(g.z,{onClose:o,title:"Add Chart to Dashboard"}),(0,I.jsx)(G.Yv,{height:"100%",padding:[0,8],children:(0,I.jsx)(ue.A,{error:B})})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(g.z,{onClose:o,title:"Add Chart to Dashboard",children:(0,I.jsx)(r.Button,{label:"Add chart",icon:"plus",onClick:E,disabled:P,"data-testid":"addChartModal-addChart-button"})}),(0,I.jsxs)(V.U,{children:["Add Charts to ",l]}),(0,I.jsx)(G.Yv,{overflow:"visible",children:(0,I.jsxs)(r.Flex,{gap:6,column:!0,children:[(0,I.jsxs)(r.Flex,{gap:2,column:!0,"data-testid":"addChartModal-selectNodes",children:[(0,I.jsxs)(r.H5,{children:["Nodes in ",d]}),(0,I.jsx)(r.Select,{options:C,value:T,onChange:F,isLoading:!x,isClearable:!0,form:"addChartModal-selectNodes"})]}),_&&(0,I.jsx)(ce,{id:t,spaceId:a,roomId:s,value:_,onChange:M,options:D,testid:"addChartModal-selectChart",selectedNodeIds:N,metadata:A[k]})]})})]})})};var ye=o(28864),be=o(44245),fe=o(63872);o(37550);const je=e=>"function"===e.type&&"feed"!==e.flavour,ve=e=>"chart"===e.type||("function"===e.type&&"feed"===e.flavour||"function"!==e.type&&"selectedNodeIds"in e),we=e=>{const t=(0,u._S)(e);return(0,n.useMemo)(()=>(e=>{const t=Object.values(e),o=t.some(ve),n=t.filter(je),r=[{type:"global",hasNodeFilter:o}];return n.forEach(e=>{r.push({type:"singleNode",cardId:e.id,cardTitle:e.customTitle||e.displayName||e.id,flavour:e.flavour})}),r})(t||{}),[t])};var ke=o(38757);const Se=e=>{let{name:t,setName:o,isNameValid:n,setIsNameValid:a,globalNodeIds:s,setGlobalNodeIds:l,hasNodeFilter:i}=e;const d=(0,L.CK)();return(0,I.jsxs)(r.Flex,{column:!0,gap:4,children:[(0,I.jsx)(ke.A,{value:t,label:"Dashboard Name",onChange:e=>o(e.target.value),isValid:n,setIsValid:a,"data-testid":"duplicateWizard-name-input"}),i&&(0,I.jsxs)(r.Flex,{column:!0,gap:2,children:[(0,I.jsx)(r.Text,{strong:!0,children:"Select Nodes"}),(0,I.jsx)(B.A,{nodeIds:d,selectedNodeIds:s,setSelectedNodeIds:l})]})]})},Ce={fn:"Function",logs:"Logs",function:"Function"},Ie=e=>{let{cardTitle:t,flavour:o,selectedNodeId:n,setSelectedNodeId:a}=e;const s=(0,L.CK)();return(0,I.jsxs)(r.Flex,{column:!0,gap:4,children:[(0,I.jsxs)(r.Flex,{column:!0,gap:1,children:[(0,I.jsx)(r.Text,{strong:!0,children:t}),(0,I.jsxs)(r.Text,{color:"textLite",children:[Ce[o]||"Function"," card"]})]}),(0,I.jsxs)(r.Flex,{column:!0,gap:2,children:[(0,I.jsx)(r.Text,{strong:!0,children:"Select Node"}),(0,I.jsx)(B.A,{nodeIds:s,selectedNodeIds:n?[n]:[],setSelectedNodeIds:e=>a(e[0]||null),multi:!1})]})]})},Te=e=>{let{dashboardId:t,onClose:o}=e;const{name:s,slug:l}=(0,i.fz)(t),d=(0,L.CK)(),c=we(t),x=(0,a.Zp)(),p=(0,h.r9)(),m=(0,be.DF)(),[y,f]=(0,n.useState)(0),[j,v]=(0,n.useState)(s),[w,k]=(0,n.useState)(!0),[S,C]=(0,n.useState)([]),[T,F]=(0,n.useState)(()=>{const e={};return c.forEach(t=>{"singleNode"===t.type&&(e[t.cardId]=d[0]||null)}),e}),N=(0,ye.DH)(t),A=c[y],B=y===c.length-1,D=0===y,[_,M]=(0,n.useState)(!1),[,z]=(0,fe.A)(),O=(0,b.yF)((0,n.useCallback)((e,o)=>{const n=e((0,u.nG)({id:t}));Object.entries(n).forEach(e=>{let[n,r]=e;"chart"===r.type&&S.length>0?o((0,u.nG)({id:t,resourceId:n}),e=>({...e,nodesScope:S})):"function"===r.type&&"feed"!==r.flavour&&T[n]?o((0,u.nG)({id:t,resourceId:n}),e=>({...e,selectedNodeIds:[T[n]]})):("function"===r.type&&"feed"===r.flavour&&S.length>0||"selectedNodeIds"in r&&S.length>0)&&o((0,u.nG)({id:t,resourceId:n}),e=>({...e,selectedNodeIds:S}))}),o((0,i.Qx)({id:t}),e=>({...e,duplicate:null,...j!==s?{name:j}:{}}))},[t,S,T,j,s])),E=(0,b.yF)((0,n.useCallback)((e,o)=>{o((0,i.Qx)({id:t}),e=>({...e,duplicate:null}))},[t])),P=(0,n.useCallback)(async()=>{M(!0),O();try{const{data:e}=await N(),{slug:n}=e;if(n!==l){const e=`${p}/dashboards/${n}`;m({id:t,slug:n,path:e}),x(e,{replace:!0})}o()}catch(e){z(e),M(!1)}},[O,N,o,z,l,p,m,t,x]),U=(0,n.useCallback)(async()=>{M(!0),E();try{await N(),o()}catch(e){z(e),M(!1)}},[E,N,o,z]),q=(0,n.useCallback)(()=>{B?P():f(e=>e+1)},[B,P]),R=(0,n.useCallback)(()=>{f(e=>Math.max(0,e-1))},[]);return(0,I.jsxs)(G.GO,{onClose:o,"data-testid":"duplicateWizard-modal",children:[(0,I.jsx)(g.z,{onClose:o,title:"Set Up Duplicate",children:(0,I.jsx)(r.Flex,{gap:2,children:(0,I.jsx)(r.Button,{label:"Skip, I'll keep it as is",flavour:"hollow",onClick:U,disabled:_,"data-testid":"duplicateWizard-skip"})})}),(0,I.jsx)(G.Yv,{children:(0,I.jsxs)(r.Flex,{column:!0,gap:4,children:[(0,I.jsxs)(r.Text,{color:"textLite",children:["Step ",y+1," of ",c.length]}),"global"===A.type&&(0,I.jsx)(Se,{name:j,setName:v,isNameValid:w,setIsNameValid:k,globalNodeIds:S,setGlobalNodeIds:C,hasNodeFilter:A.hasNodeFilter}),"singleNode"===A.type&&(0,I.jsx)(Ie,{cardTitle:A.cardTitle,flavour:A.flavour,selectedNodeId:T[A.cardId],setSelectedNodeId:e=>F(t=>({...t,[A.cardId]:e}))}),(0,I.jsxs)(r.Flex,{justifyContent:"between",gap:2,children:[!D&&(0,I.jsx)(r.Button,{label:"Back",flavour:"hollow",onClick:R,"data-testid":"duplicateWizard-back"}),(0,I.jsx)(r.Flex,{flex:!0}),(0,I.jsx)(r.Button,{label:B?"Complete":"Next",onClick:q,disabled:!w||_,isLoading:_,"data-testid":"duplicateWizard-next"})]})]})})]})};var Fe=o(88255),Ne=o(65380),Ae=o(42790),Le=o(83330),Be=o(60908),De=(o(8872),o(85163)),_e=o(71123);const Me=function(e,t){let{containerIds:o,containers:n,layout:r}=e,{extraKey:a}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s={},l=o.reduce((e,o)=>{const l=(0,_e.bj)(r[o],"vertical");return e[o]={...n[o],level:0,id:o,subMenuIds:l.reduce((e,n)=>{let{id:r}=n;return"text"!==t(r).type&&e.push(`${o}|${r}`),e},[]),subMenuChartIds:[],link:`${(0,De.A)(`menu_${o}`)}`,forceVisibility:!0,arFlavour:"anomaly",extraKey:a},l.forEach(e=>{const n=`${o}|${e.id}`,r=t(e.id);"text"!==r.type&&(s[n]={name:r.title,level:1,id:n,menuId:o,chartIds:[],link:`${(0,De.A)(`menu_${o}_submenu_${n}`)}`,arFlavour:"anomaly",showAR:!1,extraKey:a})}),e},{});return{menuIds:o,menuById:l,subMenuById:s}};var ze=o(6304),Oe=o(57738),Ee=o(99728),Pe=o(67294),Ue=o(51262),qe=o(39175);const Re=e=>{let{id:t}=e;const[o,a]=(0,i.TN)({id:t,key:"name"}),[s,l]=(0,n.useState)(o||"");(0,n.useEffect)(()=>{l(o||"")},[o]);const d=(0,n.useCallback)(e=>{l(e.target.value)},[]),c=(0,n.useCallback)(()=>{s!==o&&a(s||"Untitled Dashboard")},[s,o,a]);return(0,I.jsx)(r.TextInput,{value:s,onChange:d,onBlur:c,placeholder:"Untitled Dashboard","data-testid":"dashboardHeader-title-input",width:"180px"})},$e=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];!function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{navigator:o}=(0,n.useContext)(a._3),r=(0,a.zy)();(0,n.useEffect)(()=>{if(!t)return;const n=o.block(t=>{const o={...t,retry(){n(),t.retry()}};e(o)});return n},[o,e,t,r])}((0,n.useCallback)(t=>{"REPLACE"!==t.action?window.confirm(e)&&t.retry():t.retry()},[e]),t)},Ge="Are you sure you want to leave this dashboard?\nChanges will be lost.";var Ve=o(51571);const Ke=e=>{let{id:t}=e;const[,o]=(0,fe.A)(),n=(0,ye.DH)(t,{onFail:o}),r=(0,i.fz)(t,"processing"),a=(0,i.fz)(t,"isOwner"),s=(0,i.zN)(t);return(0,I.jsx)(Ve.A,{permission:a?"dashboard:UpdateSelf":"dashboard:Update",label:"Save",onClick:()=>n(),disabled:s,isLoading:r,"data-testid":"dashboardHeaderActionBar-save-button","data-ga":"action-bar::click-save::cust-dashboard"})},He=e=>{let{id:t}=e;const o=(e=>{const t=(0,i.zN)(e),o=(0,ye.Cb)(e),r=(0,d.x3)();return(0,n.useCallback)(()=>{if(!t){if(!window.confirm(Ge))return;o()}r(!1)},[t,o,r])})(t);return(0,I.jsxs)(r.Flex,{gap:2,alignItems:"center",children:[(0,I.jsx)(Ke,{id:t}),(0,I.jsx)(r.Button,{label:"Exit",flavour:"hollow",onClick:o,"data-testid":"dashboardHeaderActionBar-exit-button","data-ga":"action-bar::click-exit::cust-dashboard"})]})},We=(0,n.memo)(He);var Qe=o(74891),Ye=o(93912);const Je=(0,Qe.A)(r.Toggle),Ze=(0,I.jsxs)(Ye.A,{title:"Apply global filters",description:"Controls which nodes each card queries.",children:[(0,I.jsxs)(r.Text,{color:"tooltipText",children:[(0,I.jsx)(r.Text,{strong:!0,color:"tooltipText",children:"When ON"})," ","\u2014 every card uses the dashboard's global node filter."]}),(0,I.jsxs)(r.Text,{color:"tooltipText",children:[(0,I.jsx)(r.Text,{strong:!0,color:"tooltipText",children:"When OFF"})," ","\u2014 cards with their own node selection use that selection; cards without one fall back to the global filter."]}),(0,I.jsx)(r.TextSmall,{color:"tooltipText",italic:!0,children:"Single-node cards (e.g. a function or logs card with one node picked) always use their selected node regardless of this toggle."})]}),Xe=e=>{let{id:t,...o}=e;const[r,a]=(0,i.TN)({id:t,key:"respectNodesScope"}),s=(0,ye.DH)(t),l=(0,n.useCallback)(()=>{a(!r),s()},[r,a]);return(0,I.jsx)(Je,{...o,colored:!0,onChange:l,checked:!r,margin:[0],labelRight:"Apply global filters",tooltip:Ze})};var et=o(67916),tt=o(12273),ot=o(81214);const nt=e=>{let{dashboardId:t,spaceId:o,roomId:a,onClose:s}=e;const[l,i]=(0,n.useState)(!1),[d,c]=(0,n.useState)(null),[u,h]=(0,n.useState)(!1),[{after:x,before:p}]=(0,Ae.N9)();return(0,I.jsx)(r.Modal,{backdropProps:{backdropBlur:!0},onClickOutside:s,onEsc:s,children:(0,I.jsxs)(r.ModalContent,{width:"600px",children:[(0,I.jsxs)(r.ModalHeader,{children:["TV Mode URL",(0,I.jsx)(r.ModalCloseButton,{onClose:s})]}),(0,I.jsx)(r.ModalBody,{column:!0,gap:4,children:d?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(tt.FU,{children:d}),(0,I.jsxs)(r.Flex,{alignItems:"center",background:"warningBackground",gap:4,padding:[3,3],round:!0,children:[(0,I.jsx)(r.Text,{color:"warning",children:"\u26a0\ufe0f"}),(0,I.jsx)(r.Text,{children:"This URL contains a unique access token. Keep it secure and only share with trusted users."})]})]}):(0,I.jsx)(r.Text,{children:"Generate a shareable TV mode URL for this dashboard. A new access token will be created automatically."})}),(0,I.jsxs)(r.ModalFooter,{gap:2,children:[(0,I.jsx)(r.Button,{flavour:"hollow",onClick:s,children:"Cancel"}),d?(0,I.jsx)(r.Button,{onClick:async()=>{if(d)try{await(0,ot.A)(d)&&(h(!0),setTimeout(()=>h(!1),2e3))}catch(e){console.error("Failed to copy URL:",e)}},children:u?"Copied!":"Copy URL"}):(0,I.jsx)(r.Button,{onClick:async()=>{i(!0);try{const e=function(e,t,o,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const s=window.location.origin,l=new URLSearchParams(location.search).get("agent");return`${s}/webviews/dashboards/${t}?space_id=${o}&room_id=${n}${l?`&agent=${l}`:""}#token=${e}&after=${r}&before=${a}`}((await(0,et.Ey)({description:`TV Mode - Dashboard ${t}`,scope:"scope:all"})).data.token,t,o,a,x,p);c(e)}catch(e){console.error("Failed to create token:",e)}finally{i(!1)}},disabled:l,children:l?"Generating...":"Generate a new URL"})]})]})})};var rt=o(46587);const at=(0,Qe.A)(r.Button),st=e=>{let{dashboardId:t,spaceId:o,roomId:a,iconOnly:s,small:l}=e;const i=(0,rt.uW)("isAnonymous"),[d,c]=(0,n.useState)(!1),u=(0,n.useMemo)(()=>i?"Sign in first to generate a TV mode URL":"Generate TV Mode URL",[i]);return(0,I.jsxs)(I.Fragment,{children:[s?(0,I.jsx)(r.IconButton,{icon:"monitoring",tooltip:u,flavour:"hollow",small:l,onClick:()=>c(!0),"data-testid":"tv-button",disabled:i}):(0,I.jsx)(at,{flavour:"hollow",icon:"monitoring",tooltip:u,onClick:()=>c(!0),"data-testid":"tv-button",textTransform:"none",disabled:i,noWrapper:!0,children:"TV mode"}),d&&(0,I.jsx)(nt,{dashboardId:t,spaceId:o,roomId:a,onClose:()=>c(!1)})]})},lt=e=>{let{id:t,onOpenDuplicateWizard:o}=e;const{name:a,spaceId:s,roomId:l,duplicate:c}=(0,i.fz)(t),u=(0,d.x3)(),h=(0,Oe.L)(),x=(0,Ee.JT)("dashboard:Create"),p=(0,Pe.q)(),{hasLimitations:g,maxDashboards:m}=(0,Ue.A)(),y=p.some(e=>e===qe.LA),b=x&&!(g&&p.length-(y?1:0)>=m),[f,,j,v]=(0,ze.A)(),w=(0,n.useCallback)(()=>{v(),h(t)},[t,h,v]);return(0,I.jsxs)(r.Flex,{justifyContent:"between",alignItems:"center",padding:[4,0],"data-testid":"dashboardHeader",children:[(0,I.jsx)(r.Text,{color:"text",children:a||"Untitled Dashboard"}),(0,I.jsxs)(r.Flex,{gap:2,alignItems:"center",children:[c&&(0,I.jsx)(r.IconButton,{icon:"gear",tooltip:"Set up duplicate",flavour:"hollow",small:!0,onClick:o,"data-testid":"dashboardHeader-updateDuplicate-button","data-ga":"header::click-update-duplicate::cust-dashboard"}),(0,I.jsx)(r.IconButton,{icon:"settings",tooltip:"Edit dashboard",flavour:"hollow",small:!0,onClick:()=>u(!0),"data-testid":"dashboardHeader-edit-button","data-ga":"header::click-edit::cust-dashboard"}),(0,I.jsx)(r.IconButton,{icon:"copy",tooltip:b?"Duplicate dashboard":"Cannot duplicate",flavour:"hollow",small:!0,onClick:j,disabled:!b,"data-testid":"dashboardHeader-duplicate-button","data-ga":"header::click-duplicate::cust-dashboard"}),(0,I.jsx)(st,{dashboardId:t,spaceId:s,roomId:l,iconOnly:!0,small:!0})]}),f&&(0,I.jsx)(r.ConfirmationDialog,{title:"Duplicate dashboard",message:`A new dashboard named "Copy of ${a||"Untitled Dashboard"}" will be created in this room with the same layout and card configuration. Node selections will be reset so you can configure them for the new dashboard.`,confirmLabel:"Duplicate",handleConfirm:w,handleDecline:v,isConfirmPositive:!0,hideIcon:!0,"data-testid":"dashboardHeader-duplicate-confirm","data-ga":"header::confirm-duplicate::cust-dashboard"})]})},it=e=>{let{id:t}=e;return(0,I.jsxs)(r.Flex,{justifyContent:"between",alignItems:"center",padding:[4,0],"data-testid":"dashboardHeader",children:[(0,I.jsx)(Re,{id:t}),(0,I.jsxs)(r.Flex,{gap:4,alignItems:"center",children:[(0,I.jsx)(Xe,{id:t}),(0,I.jsx)(We,{id:t})]})]})},dt=e=>{let{id:t,isEditMode:o,onOpenDuplicateWizard:n}=e;return o?(0,I.jsx)(it,{id:t}):(0,I.jsx)(lt,{id:t,onOpenDuplicateWizard:n})},ct=(0,n.memo)(dt);var ut=o(85877);const ht="typography",xt="metrics",pt="functions",gt="logs",mt="feed",yt="infrastructure",bt="roomOverview",ft="presets",jt=[{id:ht,icon:"text_add",tooltip:"Typography"},{id:xt,icon:"room_overview",tooltip:"Metrics"},{id:pt,icon:"live",tooltip:"Live"},{id:gt,icon:"logs",tooltip:"Logs"},{id:mt,icon:"feed",tooltip:"Events"},{id:yt,icon:"nodes_hollow",tooltip:"Infrastructure"},{id:bt,icon:"room_home",tooltip:"Room Overview"},{id:ft,icon:"dashboard",tooltip:"Templates"}],vt=(0,U.default)(r.Flex).attrs(e=>{let{$active:t}=e;return{alignItems:"center",justifyContent:"center",cursor:"pointer",padding:[3,4],round:.5,border:{side:"all",color:"primary"},background:t?"primary":"transparent",_hover:t?{background:"primary"}:{background:"primary",backgroundOpacity:.1},zIndex:51}}).withConfig({displayName:"toolbar__ToolbarButtonContainer",componentId:"sc-18uufnr-0"})(["transition:background 0.15s;"]),wt=e=>{let{id:t,icon:o,tooltip:n,isActive:a,onClick:s}=e;return(0,I.jsx)(vt,{"data-testid":`toolbar-button-${t}`,$active:a,onClick:s,title:n,children:(0,I.jsx)(r.Icon,{name:o,color:a?"mainBackground":"primary",width:"16px",height:"16px"})})},kt=()=>{const e=(0,d.wz)(),t=(0,d.ww)();return(0,I.jsx)(r.Flex,{"data-testid":"palette-toolbar",column:!0,alignItems:"center",justifyContent:"center",padding:[0,2],gap:6,height:"100%",children:jt.map(o=>(0,I.jsx)(wt,{id:o.id,icon:o.icon,tooltip:o.tooltip,isActive:e===o.id,onClick:()=>t(o.id)},o.id))})};var St=o(25616);const Ct=e=>{let{item:t}=e;const{context:o,metadata:a,nodeIds:s}=t,l=(0,Z.eg)(),i=(0,m.vt)(),d=(0,h.ID)(),c=(0,Q.K)({spaceId:i,roomId:d}),u=`preview-${o}`,x=(0,n.useMemo)(()=>{l.getNodes({id:u}).forEach(e=>e.destroy());const{info:e,valueRange:t,height:n,colors:r}=(0,W.Ay)(a),i=l.makeChart({attributes:{id:u,contextScope:[o],host:c,roomId:d,info:e,valueRange:t,height:(n||0)+207,enabledNavigation:!1,nodesScope:s,...r&&{colors:r}}});return l.getRoot().appendChild(i),i},[l,o,u,c,d,a,s]);return(0,n.useLayoutEffect)(()=>()=>x.destroy(),[x]),(0,I.jsx)(r.Flex,{height:{min:"320px"},column:!0,children:(0,I.jsx)(J.A,{chart:x,margin:[2,0,0]})})};var It=o(31522),Tt=o(65067),Ft=o(56452);const Nt=e=>{let{item:t}=e;const{selectedNodeIds:o,groupBy:n=[],colorBy:a=It.jZ}=t.config,s=(0,L.CK)(),l=(0,L.nj)(),i=o?.length?o:s,d=(0,p.Gt)(i);return(0,I.jsxs)(Tt.A,{column:!0,overflow:"hidden",background:"elementBackground",border:{side:"all",color:"borderSecondary"},children:[(0,I.jsx)(r.Flex,{padding:[2,3],children:(0,I.jsx)(r.Text,{strong:!0,children:"Node Grid"})}),(0,I.jsx)(r.Flex,{flex:!0,overflow:"auto",children:(0,I.jsx)(Ft.A,{nodes:d,groupBy:n,colorBy:a,loaded:l})})]})};var At=o(49181),Lt=o(59092);const Bt={nodeStatus:e=>(0,At.GM)(e.state),alertStatus:e=>{if((e.alerts_critical||0)>0)return"Critical";return(e.alerts_warning||0)>0?"Warning":"No alerts"}},Dt=e=>{let{item:t}=e;const{selectedNodeIds:o,groupBy:a}=t.config,s=(0,L.CK)(),l=(0,L.nj)(),i=o?.length?o:s,d=(0,p.Gt)(i),c=(0,n.useMemo)(()=>(e=>{const t={reachable:0,stale:1,unreachable:2,created:3};return[...e].sort((e,o)=>(t[e.state]??4)-(t[o.state]??4))})(d),[d]),u=(0,n.useMemo)(()=>{const e=Bt[a];if(!e)return null;const t={};return c.forEach(o=>{const n=e(o);t[n]||(t[n]=[]),t[n].push(o)}),Object.entries(t)},[c,a]);return(0,I.jsxs)(Tt.A,{column:!0,overflow:"hidden",background:"elementBackground",border:{side:"all",color:"borderSecondary"},children:[(0,I.jsx)(r.Flex,{padding:[2,3],children:(0,I.jsx)(r.Text,{strong:!0,children:`Node List (${d.length})`})}),(0,I.jsx)(r.Flex,{flex:!0,column:!0,overflow:"auto",children:(0,I.jsx)(Lt.A,{nodes:c,groupedNodes:u,loaded:l,nodeCount:d.length})})]})};var _t=o(41716),Mt=o(19075),zt=o(94230);const Ot=e=>{let{item:t}=e;const{selectedNodeIds:o}=t.config,a=(0,_t.s)("ids")||[],s=(0,_t.s)("loaded"),l=(0,Mt.Gq)(a),i=(0,n.useMemo)(()=>o?.length?new Set(o):null,[o]),{critical:d,warning:c}=(0,n.useMemo)(()=>(i?l.filter(e=>i.has(e.nodeId)):l).reduce((e,t)=>{let{status:o}=t;return e[o]=(e[o]||0)+1,e},{critical:0,warning:0,clear:0}),[l,i]);return(0,I.jsxs)(Tt.A,{column:!0,overflow:"hidden",background:"elementBackground",border:{side:"all",color:"borderSecondary"},children:[(0,I.jsx)(r.Flex,{padding:[2,3],children:(0,I.jsx)(r.Text,{strong:!0,children:"Alert Status"})}),(0,I.jsx)(r.Flex,{flex:!0,column:!0,overflow:"hidden",children:(0,I.jsx)(zt.A,{critical:d,warning:c,loaded:s})})]})};var Et=o(95760);const Pt=e=>{let{item:t}=e;const{selectedNodeIds:o}=t.config,a=(0,L.CK)(),s=o?.length?o:a,l=(0,p.Gt)(s),i=(0,L.nj)(),d=(0,_t.s)("ids")||[],c=(0,_t.s)("loaded"),u=(0,Mt.Gq)(d),h=i&&c,x=(0,n.useMemo)(()=>{const e={};return u.forEach(t=>{if(!t.nodeId)return;e[t.nodeId]||(e[t.nodeId]={critical:[],warning:[]});const o=t.status?.toLowerCase();"critical"===o?e[t.nodeId].critical.push(t):"warning"===o&&e[t.nodeId].warning.push(t)}),l.map(t=>({node:t,criticalAlerts:e[t.id]?.critical||[],warningAlerts:e[t.id]?.warning||[]})).filter(e=>{let{criticalAlerts:t,warningAlerts:o}=e;return t.length>0||o.length>0}).sort((e,t)=>{const o=1e3*e.criticalAlerts.length+e.warningAlerts.length;return 1e3*t.criticalAlerts.length+t.warningAlerts.length-o})},[l,u]);return(0,I.jsxs)(Tt.A,{column:!0,overflow:"hidden",background:"elementBackground",border:{side:"all",color:"borderSecondary"},children:[(0,I.jsx)(r.Flex,{padding:[2,3],children:(0,I.jsx)(r.Text,{strong:!0,children:"Alerts Per Node"})}),(0,I.jsx)(r.Flex,{flex:!0,column:!0,overflow:"auto",children:(0,I.jsx)(Et.A,{nodesWithAlerts:x,nodeCount:l.length,loaded:h})})]})};var Ut=o(52346);const qt=72e5,Rt=3e5,$t=e=>{let{item:t}=e;const{selectedNodeIds:o}=t.config,a=(0,_t.s)("ids")||[],s=(0,_t.s)("loaded"),l=(0,Mt.Gq)(a),i=(0,L.CK)(),d=o?.length?o:i,{buckets:c,maxTotal:u,totalAlerts:h}=(0,n.useMemo)(()=>{const e=Date.now(),t=e-qt,n=Array.from({length:24},(e,o)=>({ts:t+o*Rt,critical:0,warning:0})),r=o?.length?l.filter(e=>d.includes(e.nodeId)):l;r.forEach(o=>{if(!o.lastUpdated)return;const r=1e3*o.lastUpdated;if(r<t||r>e)return;const a=Math.floor((r-t)/Rt);if(a<0||a>=24)return;const s=o.status?.toLowerCase();"critical"===s?n[a].critical++:"warning"===s&&n[a].warning++});const a=Math.max(...n.map(e=>e.critical+e.warning),1),s=r.filter(o=>{const n=o.status?.toLowerCase();if("critical"!==n&&"warning"!==n)return!1;if(!o.lastUpdated)return!1;const r=1e3*o.lastUpdated;return r>=t&&r<=e}).length;return{buckets:n,maxTotal:a,totalAlerts:s}},[l,o,d]);return(0,I.jsxs)(Tt.A,{column:!0,overflow:"hidden",background:"elementBackground",border:{side:"all",color:"borderSecondary"},children:[(0,I.jsx)(r.Flex,{padding:[2,3],children:(0,I.jsx)(r.Text,{strong:!0,children:`Alerts by Hour (${h})`})}),(0,I.jsx)(r.Flex,{flex:!0,column:!0,overflow:"hidden",padding:[2],children:(0,I.jsx)(Ut.A,{buckets:c,maxTotal:u,totalAlerts:h,loaded:s})})]})};var Gt=o(77125);const Vt=e=>{let{item:t}=e;const{selectedNodeIds:o,visibleItems:a}=t.config,s=(0,L.CK)(),l=o?.length?o:s,i=(0,p.Gt)(l),d=(0,L.nj)(),c=(0,_t.s)("ids")||[],u=(0,_t.s)("loaded"),h=(0,Mt.Gq)(c),x=d&&u,g=(0,n.useMemo)(()=>new Set(l),[l]),m=(0,n.useMemo)(()=>{const e={Live:0,Stale:0,Offline:0,Unseen:0};return i.forEach(t=>{const o=(0,At.GM)(t.state);e[o]=(e[o]||0)+1}),e},[i]),{critical:y,warning:b,clear:f}=(0,n.useMemo)(()=>(o?.length?h.filter(e=>g.has(e.nodeId)):h).reduce((e,t)=>{let{status:o}=t;return e[o]=(e[o]||0)+1,e},{critical:0,warning:0,clear:0}),[h,o,g]);return(0,I.jsxs)(Tt.A,{column:!0,overflow:"hidden",background:"elementBackground",border:{side:"all",color:"borderSecondary"},children:[(0,I.jsx)(r.Flex,{padding:[2,3],children:(0,I.jsx)(r.Text,{strong:!0,children:`Nodes (${Object.values(m).reduce((e,t)=>e+t,0)})`})}),(0,I.jsx)(r.Flex,{flex:!0,column:!0,overflow:"auto",children:(0,I.jsx)(Gt.A,{statusCounts:m,critical:y,warning:b,clear:f,visibleItems:a,loaded:x})})]})};var Kt=o(58533),Ht=o(87242);const Wt=[],Qt=e=>{let{item:t}=e;const{visibleItems:o}=t.config||{},{loaded:a,metricsCollected:s=0}=(0,Kt.VH)(),l=(0,m.vt)(),i=(0,h.ID)(),{charts:d,loaded:c,error:u}=(0,y.A)(l,i,Wt),x=Object.keys(d).length,{loaded:p,value:g}=(0,Mt.oU)(),b=g?.length||0,f=(0,n.useMemo)(()=>[{id:"metrics",label:"Metrics available",value:s,loaded:a},{id:"charts",label:"Charts visualized",value:x,loaded:c&&!u},{id:"alerts",label:"Alerts configured",value:b,loaded:p}].filter(e=>!o||o.includes(e.id)),[s,a,x,c,u,b,p,o]);return(0,I.jsxs)(Tt.A,{column:!0,overflow:"hidden",background:"elementBackground",border:{side:"all",color:"borderSecondary"},children:[(0,I.jsx)(r.Flex,{padding:[2,3],children:(0,I.jsx)(r.Text,{strong:!0,children:"Stats Overview"})}),(0,I.jsx)(r.Flex,{flex:!0,alignItems:"center",justifyContent:"center",gap:4,children:(0,I.jsx)(Ht.A,{stats:f})})]})};var Yt=o(46025);const Jt=e=>{let{item:t}=e;const{dataRetention:o,loaded:n}=(0,Kt.VH)();return(0,I.jsxs)(Tt.A,{column:!0,overflow:"hidden",background:"elementBackground",border:{side:"all",color:"borderSecondary"},children:[(0,I.jsx)(r.Flex,{padding:[2,3],children:(0,I.jsx)(r.Text,{strong:!0,children:"Data Retention per Node"})}),(0,I.jsx)(r.Flex,{flex:!0,overflow:"hidden",padding:[2,3,3],children:n?o?.length?(0,I.jsx)(Yt.A,{dataRetention:o}):(0,I.jsx)(r.Flex,{flex:!0,alignItems:"center",justifyContent:"center",children:(0,I.jsx)(r.Text,{color:"textLite",children:"No retention data"})}):(0,I.jsx)(r.Flex,{flex:!0,alignItems:"center",justifyContent:"center",children:(0,I.jsx)(r.Text,{color:"textLite",children:"Loading..."})})})]})};var Zt=o(7761),Xt=o(39431);const eo=e=>{let{item:t}=e;const{visibleItems:o}=t.config||{},n=(0,Zt.jg)();return(0,I.jsxs)(Tt.A,{column:!0,overflow:"hidden",background:"transparent",border:{side:"all",color:"borderSecondary"},children:[(0,I.jsx)(r.Flex,{padding:[2,3],children:(0,I.jsx)(r.Text,{strong:!0,children:"Nodes with most alerts (24h)"})}),(0,I.jsx)(r.Flex,{flex:!0,column:!0,overflow:"auto",gap:3,children:(0,I.jsx)(Xt.A,{alertsStats:n,visibleItems:o,loaded:n.loaded})})]})};var to=o(19529);const oo=e=>{let{item:t}=e;const{visibleItems:o}=t.config||{},{loaded:a,totalParents:s,totalChildren:l,totalStandalone:i,replicationFactor:d}=(0,Zt.c8)(),c=(0,n.useMemo)(()=>[{label:"Parents",value:s,color:["blue","indigo"],id:"parents"},{label:"Children",value:l,color:["purple","lilac"],id:"children"},{label:"Standalone",value:i,color:["yellow","yellow120"],id:"standalone"}].filter(e=>!o||o.includes(e.id)),[s,l,i,o]),u=(0,n.useMemo)(()=>[{label:"None",value:d?.r_1||0,color:It.q5.r_1,id:"none"},{label:"Single",value:d?.r_2||0,color:It.q5.r_2,id:"single"},{label:"Multi",value:d?.["r_*"]||0,color:It.q5["r_*"],id:"multi"}].filter(e=>!o||o.includes(e.id)),[d,o]);return(0,I.jsxs)(Tt.A,{column:!0,overflow:"hidden",background:"elementBackground",border:{side:"all",color:"borderSecondary"},children:[(0,I.jsx)(r.Flex,{padding:[2,3],children:(0,I.jsx)(r.Text,{strong:!0,children:"Replication"})}),(0,I.jsx)(r.Flex,{flex:!0,column:!0,overflow:"auto",gap:3,children:(0,I.jsx)(to.A,{topologyData:c,replicationData:u,loaded:a})})]})};o(33110);var no=o(81989),ro=o(44252),ao=o(13607),so=o(26571),lo=o(81445),io=o(71488);const co=(0,n.lazy)(()=>Promise.all([o.e(7986),o.e(6370)]).then(o.bind(o,20675))),uo=(0,n.lazy)(()=>Promise.all([o.e(5219),o.e(8723)]).then(o.bind(o,78723))),ho=e=>{let{item:t}=e;const{selectedFn:o,flavour:a,visibleItems:s,nodeIds:l,fnType:i,flowView:d,acceptedParams:c,functionParamsFilters:u,defaultCharts:h,displayName:x}=t.config,p=(0,so.A)({selectedFn:o,selectedNodeIds:l,fnType:i,flowView:d,acceptedParams:c,functionParamsFilters:u,enablePolling:!1}),{loading:g,loaded:m,data:y,columns:b,error:f,sortedColumns:j,sortColumn:v,sortDirection:w,columnVisibility:k,pinnedColumns:S,groupByColumns:C,manualSorting:T,charts:F,onRefresh:N,histogram:A,availableHistograms:L,customCharts:B}=p,D=!s||s.includes("charts"),_=!s||s.includes("table"),M=D&&!!h?.length,z=D&&!!A,O=D&&!!B,E="feed"===a,P=(0,n.useCallback)(()=>{},[]);return(0,I.jsxs)(Tt.A,{column:!0,overflow:"hidden",background:"transparent",border:{side:"all",color:"borderSecondary"},children:[(0,I.jsx)(r.Flex,{padding:[2,3],children:(0,I.jsx)(r.Text,{strong:!0,children:x||o||"Function"})}),(0,I.jsxs)(r.Flex,{flex:!0,column:!0,overflow:"hidden",children:[!m&&g&&(0,I.jsx)(r.Flex,{flex:!0,alignItems:"center",justifyContent:"center",children:(0,I.jsx)(r.Text,{color:"textLite",children:"Loading..."})}),f&&(0,I.jsx)(r.Flex,{padding:[2,3],alignItems:"center",children:(0,I.jsx)(r.Text,{color:"error",children:"string"===typeof f?f:f.errorMessage||"Error"})}),m&&"flows"===i&&(0,I.jsx)(n.Suspense,{fallback:null,children:(0,I.jsx)(co,{flowView:d,flowRows:p.flowRows,flowColumns:p.flowColumns,flowGroupByKeys:p.flowGroupByKeys,flowTimeseries:p.flowTimeseries,flowMapFlows:p.flowMapFlows,visibleItems:s,selectedFn:o,selectedNodeIds:l})}),m&&"topology"===i&&(0,I.jsx)(n.Suspense,{fallback:null,children:(0,I.jsx)(uo,{topologyGraph:p.topologyGraph,topologyActorRows:p.topologyActorRows,presentation:p.presentation,filterKey:JSON.stringify(u||{})})}),m&&(!i||"table"===i)&&(M||_||z||O)&&(0,I.jsxs)(r.Flex,{flex:!0,column:!0,overflow:"hidden",gap:2,children:[z&&(0,I.jsx)(no.A,{..._&&{height:"380px"},histogram:A,availableHistograms:L,data:y,histogramId:A?.id,filters:(u||{})[A?.id]||null,onFiltersChange:P,toolboxReload:e=>{let{disabled:t}=e;return(0,I.jsx)(ao.A,{onRefresh:N,loading:g,testId:"preview-function-histogram",dataGa:"preview-function-histogram"})},hideToolbox:!0,nodeIds:l,fn:o}),M&&(0,I.jsx)(io.A,{defaultCharts:h,charts:F,data:y,columns:b,groupByColumns:C,loaded:m,selectedFn:o,onRefresh:N,loading:g,compact:_,hideToolbox:!0}),O&&(0,I.jsx)(ro.A,{customCharts:B,data:y,containerWidth:0,paramsKey:{extraKey:"preview"}}),_&&(0,I.jsx)(lo.A,{title:(0,I.jsx)(ao.A,{onRefresh:N,loading:g,testId:"preview-function-table",dataGa:"preview-function-table"}),data:y,columns:b,sortedColumns:j,sortColumn:v,sortDirection:w,columnVisibility:k,pinnedColumns:S,groupByColumns:C,loaded:m,manualSorting:T,isFeed:E})]}),m&&(!i||"table"===i)&&!M&&!_&&!z&&!O&&(0,I.jsx)(r.Flex,{flex:!0,alignItems:"center",justifyContent:"center",children:(0,I.jsx)(r.Text,{color:"textLite",children:D?"No chart data":"No table data"})})]})]})},xo={chart:Ct,text:null,nodeGrid:Nt,nodeList:Dt,alertStatus:Ot,alertsPerNode:Pt,hourlyAlerts:$t,nodeStats:Vt,statsOverview:Qt,dataRetention:Jt,alertNodes:eo,replicationStats:oo,function:ho},po=e=>{let{item:t}=e;const o=xo[t.type];return o?(0,I.jsx)(St.Ay,{fallback:(0,I.jsx)(St.dK,{canRetry:!1}),children:(0,I.jsx)(o,{item:t})}):null},go=e=>{let{items:t}=e;return(0,I.jsx)(r.Flex,{column:!0,gap:3,overflow:"auto",width:"100%",children:t.map(e=>(0,I.jsx)(po,{item:e},e.type+"-"+(e.context||e.config?.textType||e.config?.selectedFn||"")))})},mo=e=>{let{title:t}=e;return(0,I.jsx)(r.Text,{color:"text",fontSize:"12px",lineHeight:"16px",children:t})},yo=e=>{let{label:t="Import",onClick:o,disabled:n}=e;return(0,I.jsx)(r.Flex,{justifyContent:"end",padding:[4,0],children:(0,I.jsx)(r.Button,{label:t,onClick:o,disabled:n})})},bo={title:!1,subtitle:!1,body:!1},fo={title:r.H1,subtitle:r.H4,body:r.TextBig},jo=e=>{let{type:t,label:o,preview:n,checked:a,onToggle:s}=e;const l=fo[t];return(0,I.jsxs)(r.Flex,{column:!0,gap:2,padding:[2,3],border:{side:"all",color:"border"},width:"100%",height:{min:"78px"},children:[(0,I.jsxs)(r.Flex,{alignItems:"center",gap:1,children:[(0,I.jsx)(r.Checkbox,{checked:a,onChange:s}),(0,I.jsx)(r.Text,{color:"text",children:o})]}),(0,I.jsx)(l,{color:"textFocus",children:n})]})},vo=e=>{let{dashboardId:t,onPreviewChange:o}=e;const[a,s]=(0,n.useState)(bo),l=(0,H.Kv)(t),i=(0,d.WM)(),c=e=>s(t=>({...t,[e]:!t[e]}));(0,n.useEffect)(()=>{if(!o)return;const e=[];a.title&&e.push({type:"text",config:{textType:"title"}}),a.subtitle&&e.push({type:"text",config:{textType:"subtitle"}}),a.body&&e.push({type:"text",config:{textType:"body"}}),o(e)},[a,o]);const u=a.title||a.subtitle||a.body;return(0,I.jsxs)(r.Flex,{column:!0,gap:2,flex:!0,children:[(0,I.jsx)(mo,{title:"Titles and text"}),(0,I.jsxs)(r.Flex,{column:!0,gap:2.5,children:[(0,I.jsx)(jo,{type:"title",label:"Title",preview:"Heading 1",checked:a.title,onToggle:()=>c("title")}),(0,I.jsx)(jo,{type:"subtitle",label:"Subtitle",preview:"Heading 2",checked:a.subtitle,onToggle:()=>c("subtitle")}),(0,I.jsx)(jo,{type:"body",label:"Body",preview:"Lorem Ipsum",checked:a.body,onToggle:()=>c("body")})]}),(0,I.jsx)(yo,{label:"Import components",onClick:()=>{let e=null;a.title&&(e=l({dashboardId:t,textType:"title"})),a.subtitle&&(e=l({dashboardId:t,textType:"subtitle"})),a.body&&(e=l({dashboardId:t,textType:"body"})),s(bo),i(null),e&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=document.querySelector(`[data-id="${e}"]`);t&&t.scrollIntoView({behavior:"smooth",block:"nearest"})})})},disabled:!u})]})};var wo=o(95932);const ko=e=>{let{label:t}=e;return(0,I.jsx)(r.Text,{color:"textLite",fontSize:"11px",lineHeight:"14px",children:t})};var So=o(98054),Co=o(33099),Io=o(47427);const To=e=>{let{children:t,...o}=e;return(0,I.jsx)(r.Flex,{alignItems:"center",gap:2,padding:[1,2],cursor:"pointer",_hover:{background:"borderSecondary"},...o,children:t})},Fo=e=>{let{dashboardId:t,onPreviewChange:o}=e;const[a,s]=(0,n.useState)(new Set),[l,i]=(0,n.useState)(null),[c,u]=(0,n.useState)(null),[h,x]=(0,n.useState)([]),[p,g]=(0,n.useState)({}),m=(0,L.CK)(),y=(0,wo.A)(p,{nodeIds:m,selectedNodeIds:h}),{menuIds:b,menuById:f,roomCharts:j}=(0,Co.A)(y),v=(0,H.nM)(t),w=(0,d.WM)(),k=(0,Z.eg)();(0,n.useEffect)(()=>{if(!o)return;const e=setTimeout(()=>{const e=Array.from(a).filter(e=>j[e]).map(e=>({type:"chart",context:e,metadata:j[e],nodeIds:y}));o(e)},150);return()=>clearTimeout(e)},[a,y,j,o]);const S=(0,n.useMemo)(()=>c?b.filter(e=>{const t=f[e];return!!t&&t.contexts?.some(e=>c.has(e))}):b,[b,f,c]),C=(0,n.useMemo)(()=>{if(!l||!f[l])return[];const e=(f[l].contexts||[]).filter(e=>j[e]).map(e=>({id:e,context:e,title:j[e].title||e}));return c?e.filter(e=>c.has(e.context)):e},[l,f,j,c]),T=(0,n.useCallback)(e=>{s(t=>{const o=new Set(t);return o.has(e)?o.delete(e):o.add(e),o})},[]),F=(0,n.useCallback)(()=>{const e=y.length>0?{nodesScope:y}:{},t=Array.from(a),o=t.length;let n=null;t.forEach((t,r)=>{const a=1===o||3===o&&2===r?12:6;let s={};const l=k.getNode({id:`preview-${t}`});l&&(s=(0,ae.h)(l.getAttributes())),v([t],{...e,...s,itemLayout:{width:a}},e=>{n=e.id})}),s(new Set),w(null),n&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{const e=document.querySelector(`[data-id="${n}"]`);e&&e.scrollIntoView({behavior:"smooth",block:"nearest"})})})},[a,v,y,w,k]),N=(0,n.useCallback)(e=>e.contexts?.some(e=>j[e]),[j]),A=a.size>0,D=b.length>0;return(0,I.jsxs)(r.Flex,{column:!0,height:"100%",gap:1,overflow:"hidden",children:[(0,I.jsx)(mo,{title:"Metrics"}),(0,I.jsx)(ko,{label:"Select Nodes"}),(0,I.jsx)(B.A,{nodeIds:m,selectedNodeIds:h,setSelectedNodeIds:x,filters:p,setFilters:g}),(0,I.jsx)(ko,{label:"Select Metrics"}),(0,I.jsx)(Io.A,{onFilteredContextIdsChange:u}),(0,I.jsxs)(r.Flex,{height:"100%",overflow:"hidden",children:[(0,I.jsx)(r.Flex,{column:!0,width:"280px",overflow:{vertical:"auto"},padding:[2,0],border:{side:"right",color:"borderSecondary"},children:D?(0,I.jsx)(So.A,{menuIds:S,menuById:f,selectedId:l,onSelect:i,isItemVisible:N}):(0,I.jsx)(r.Flex,{padding:[4],justifyContent:"center",children:(0,I.jsx)(r.Text,{color:"textLite",children:"Loading categories..."})})}),(0,I.jsxs)(r.Flex,{column:!0,flex:!0,overflow:{vertical:"auto"},padding:[2,0],children:[!l&&(0,I.jsx)(r.Flex,{padding:[4],justifyContent:"center",children:(0,I.jsx)(r.Text,{color:"textLite",children:"Select a category"})}),l&&0===C.length&&(0,I.jsx)(r.Flex,{padding:[4],justifyContent:"center",children:(0,I.jsx)(r.Text,{color:"textLite",children:"No metrics in this category"})}),C.map(e=>(0,I.jsxs)(To,{onClick:()=>T(e.context),children:[(0,I.jsx)(r.Checkbox,{checked:a.has(e.context),onChange:t=>{t.stopPropagation(),T(e.context)}}),(0,I.jsx)(r.Text,{ellipsis:!0,children:e.title})]},e.id))]})]}),(0,I.jsx)(yo,{label:A?`Import (${a.size})`:"Import",onClick:F,disabled:!A})]})};var No=o(16373),Ao=o(7414);const Lo=e=>{let{value:t,onChange:o}=e;return(0,I.jsx)(r.TextInput,{value:t,onChange:e=>o(e.target.value),placeholder:"Search functions...",iconLeft:(0,I.jsx)(r.Icon,{name:"magnify",color:"textLite",size:"small"}),width:"100%",height:"32px"})};var Bo=o(15744),Do=o(33479);const _o=e=>e.name,Mo=e=>e.slug,zo=e=>e?e[0].toUpperCase()+e.slice(1):"",Oo=(e,t)=>{const o=[];return e.forEach(e=>{const n=t[e];n?.isFunction?o.push(e):n?.descendantIds&&o.push(...n.descendantIds)}),o},Eo=(e,t)=>(t[e.value]={name:e.fullLabel||e.label,shortName:zo(e.label),slug:e.value,isFunction:!0},e.value),Po=(e,t)=>{const o=`group:${e.parent}`,n=[];return e.subgroups?.forEach(e=>n.push(Po(e,t))),e.children?.forEach(e=>n.push(Eo(e,t))),t[o]={name:zo(e.parent),childrenIds:n,descendantIds:Oo(n,t)},o},Uo=(e,t)=>{const o=e.title.toLowerCase().replace(/\s+/g,"-"),n=[];return e.items.forEach(e=>{"group"===e.type?n.push(Po(e.data,t)):"standalone"===e.type||"leaf"===e.type?n.push(Eo(e.data,t)):"category"===e.type&&n.push(Uo(e.data,t))}),t[o]={name:e.title,icon:e.icon,childrenIds:n,descendantIds:Oo(n,t)},o},qo=(e,t)=>(0,n.useMemo)(()=>{const o=t?e.filter(e=>e.name.toLowerCase().includes(t.toLowerCase())):e,{categories:n,groups:r,standalone:a}=(0,Do.GS)(o,Mo,_o,":",Bo.A),s={},l=[];return n.forEach(e=>l.push(Uo(e,s))),r.forEach(e=>l.push(Po(e,s))),a.forEach(e=>l.push(Eo(e,s))),{menuIds:l,menuById:s}},[e,t]);var Ro=o(84103);const $o={type:"table"},Go=(e,t,o)=>{const[r,a]=(0,n.useState)({loading:!1,data:null,error:null}),s=(0,h.ID)(),l=(0,p.yN)(t),i=(0,n.useRef)(!1);return(0,n.useEffect)(()=>{if(!e)return void a({loading:!1,data:null,error:null});if("feed"===o)return void a({loading:!1,data:$o,error:null});if(!t?.length)return void a({loading:!1,data:null,error:null});i.current=!1,a(e=>({...e,loading:!0,error:null}));const n=Date.now();return(0,Ro.JJ)({roomId:s,cloudNodeIds:l,nodeIds:t,fn:e,after:n-9e5,before:n,transactionId:(0,f.A)()}).then(e=>{if(i.current)return;a({loading:!1,data:e?.data||e,error:null})}).catch(e=>{i.current||a({loading:!1,data:null,error:e})}),()=>{i.current=!0}},[e,s,t?.length,l?.[0]]),r};var Vo=o(380);const Ko=e=>{let{flowView:t,onFlowViewChange:o,visibleItems:a,onVisibleItemsChange:s}=e;const l=(0,n.useCallback)(e=>{const t=e.target.value,n=(0,Ao.l3)(t);o(t),s(n.visibleItems)},[o,s]);Ao.KC.find(e=>e.id===t)||Ao.KC[0];return(0,I.jsx)(r.Flex,{column:!0,gap:2,children:Ao.KC.map(e=>{const o=t===e.id;return(0,I.jsxs)(r.Flex,{column:!0,gap:2,children:[(0,I.jsx)(r.RadioButton,{label:e.label,value:e.id,checked:o,onChange:l}),o&&e.items.length>1&&(0,I.jsx)(r.Flex,{padding:[0,0,0,6],children:(0,I.jsx)(Vo.A,{items:e.items,selected:a||[],onChange:s})})]},e.id)})})},Ho=e=>{let{flavour:t,functionInfo:o,flowView:n,visibleItems:r,onFlowViewChange:a,onVisibleItemsChange:s}=e;if("flows"===o?.type)return(0,I.jsx)(Ko,{flowView:n,onFlowViewChange:a,visibleItems:r,onVisibleItemsChange:s});const l=(0,Ao.nV)(o,t);return l.length<=1?null:(0,I.jsx)(Vo.A,{items:l,selected:r||[],onChange:s})},Wo={fn:"Live",logs:"Logs",feed:"Events"},Qo={fn:"Select Function",logs:"Logs Viewer",feed:"Select Event"},Yo=e=>{let{flavour:t,dashboardId:o,onPreviewChange:a}=e;const[s,l]=(0,n.useState)([]),[i,c]=(0,n.useState)({}),[u,h]=(0,n.useState)(""),[x,p]=(0,n.useState)(null),[g,m]=(0,n.useState)(null),[y,b]=(0,n.useState)(null),[f,j]=(0,n.useState)({}),v="feed"===t,w=(0,L.CK)();(0,n.useEffect)(()=>{!v&&0===s.length&&w.length>0&&l([w[0]])},[v,w]);const k=(0,wo.A)(i,{nodeIds:w,selectedNodeIds:s}),{loaded:S,value:C}=(0,No.vx)({},t),T=(0,n.useMemo)(()=>k.length?C.filter(e=>k.some(t=>e.nodes?.[t])):C,[C,k]),{menuIds:F,menuById:N}=qo(T,u),A=F.length>1||!!N[F[0]]?.childrenIds?.length;(0,n.useEffect)(()=>{if(!x||!N[x]){for(const e of F){const t=N[e];if(t?.isFunction)return void p(e);if(t?.descendantIds?.length)return void p(t.descendantIds[0])}p(null)}},[F,N]);const D=(0,H.VI)(o),_=(0,d.WM)(),M="feed"!==t,z=k.length>0,O=z||M?k:w,{loading:E,data:P}=Go(x,O,t);(0,n.useEffect)(()=>{a&&a(x&&!E&&P?[{type:"function",config:{selectedFn:x,flavour:t,visibleItems:y,flowView:g,nodeIds:O,fnType:P.type||"",displayName:N[x]?.name||"",defaultCharts:P.defaultCharts||[],acceptedParams:P.acceptedParams||[],functionParamsFilters:f}}]:[])},[x,y,g,f,O,P,E,a,t,N]);const U=(0,n.useCallback)(e=>{p(t=>t===e?null:e),m(null),b(null),j({})},[]);(0,n.useEffect)(()=>{if(!P?.type)return;const e=(0,Ao.Om)(P.type);m(e.flowView||null),b(e.visibleItems)},[x,P?.type]);const q=!!x&&!!P&&!E&&(!M||z),R=(0,n.useCallback)(()=>{if(!q)return;const e=D({dashboardId:o,flavour:t,selectedFn:x,displayName:N[x]?.name||"",selectedNodeIds:O,visibleItems:y,flowView:g,fnType:P.type||"",defaultCharts:P.defaultCharts||[],acceptedParams:P.acceptedParams||[],requiredParams:P.requiredParams||[],columns:P.columns||{},functionParamsFilters:f});_(null),e&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=document.querySelector(`[data-id="${e}"]`);t&&t.scrollIntoView({behavior:"smooth",block:"nearest"})})})},[q,D,o,t,x,N,O,y,g,P,f,_]);return M&&!z?(0,I.jsxs)(r.Flex,{column:!0,height:"100%",gap:1,overflow:"hidden",children:[(0,I.jsx)(mo,{title:Wo[t]||"Live"}),(0,I.jsx)(ko,{label:"Select Node"}),(0,I.jsx)(B.A,{nodeIds:w,selectedNodeIds:s,setSelectedNodeIds:l,filters:i,setFilters:c,multi:!1}),(0,I.jsx)(r.Flex,{flex:!0,alignItems:"center",justifyContent:"center",children:(0,I.jsx)(r.Text,{color:"textLite",children:"Select a node to see available functions"})})]}):(0,I.jsxs)(r.Flex,{column:!0,height:"100%",gap:1,overflow:"hidden",children:[(0,I.jsx)(mo,{title:Wo[t]||"Live"}),"feed"!==t&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(ko,{label:v?"Select Nodes":"Select Node"}),(0,I.jsx)(B.A,{nodeIds:w,selectedNodeIds:s,setSelectedNodeIds:l,filters:i,setFilters:c,multi:v})]}),!v&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(ko,{label:"Search"}),(0,I.jsx)(Lo,{value:u,onChange:h})]}),(0,I.jsxs)(r.Flex,{height:"100%",overflow:"hidden",children:[A&&(0,I.jsxs)(r.Flex,{column:!0,width:"280px",overflow:{vertical:"auto"},padding:[2,0],border:{side:"right",color:"borderSecondary"},children:[(0,I.jsx)(ko,{label:Qo[t]||"Select Function"}),F.length>0?(0,I.jsx)(So.A,{menuIds:F,menuById:N,selectedId:x,onSelect:U}):(0,I.jsx)(r.Flex,{padding:[4],justifyContent:"center",children:(0,I.jsx)(r.Text,{color:"textLite",children:S?"No functions available":"Loading functions..."})})]}),(0,I.jsxs)(r.Flex,{column:!0,flex:!0,overflow:{vertical:"auto"},padding:[2],children:[!x&&(0,I.jsx)(r.Flex,{padding:[4],justifyContent:"center",children:(0,I.jsx)(r.Text,{color:"textLite",children:S?"No functions available":"Loading functions..."})}),x&&E&&(0,I.jsx)(r.Flex,{padding:[4],justifyContent:"center",children:(0,I.jsx)(r.Text,{color:"textLite",children:"Loading function info..."})}),x&&!E&&P&&(0,I.jsxs)(r.Flex,{column:!0,gap:2,children:[(0,I.jsx)(r.Text,{strong:!0,children:N[x]?.name||x}),(0,I.jsx)(Ho,{flavour:t,functionInfo:P,flowView:g,visibleItems:y,onFlowViewChange:m,onVisibleItemsChange:b})]})]})]}),(0,I.jsx)(yo,{label:"Import",onClick:R,disabled:!q})]})};o(30670),o(71517),o(11379),o(93777),o(14190),o(12359),o(86097),o(17273),o(27415),o(19929),o(37583),o(55122),o(20230),o(57268),o(79733);const Jo=e=>{let{children:t,...o}=e;return(0,I.jsx)(r.Flex,{column:!0,round:1,overflow:"hidden",border:{side:"all",color:"borderSecondary"},background:"mainBackground",...o,children:t})},Zo="nodeGrid",Xo="nodeList",en="alertStatus",tn="alertsPerNode",on="hourlyAlerts",nn={Live:"success",Stale:"warning",Offline:"textLite",Unseen:"textDescription"},rn=e=>{let{nodeStatusCounts:t}=e;if(0===Object.values(t).reduce((e,t)=>e+t,0))return(0,I.jsx)(Jo,{padding:[2],children:(0,I.jsx)(r.Text,{color:"textLite",fontSize:"10px",children:"No nodes"})});const o=Object.entries(t).flatMap(e=>{let[t,o]=e;return Array.from({length:o},(e,o)=>({key:`${t}-${o}`,color:nn[t]}))});return(0,I.jsx)(Jo,{padding:[2],children:(0,I.jsx)(r.Flex,{gap:1,flexWrap:!0,children:o.slice(0,96).map(e=>{let{key:t,color:o}=e;return(0,I.jsx)(r.Flex,{width:"8px",height:"8px",round:"50%",background:o},t)})})})},an=e=>{let{nodes:t}=e;const o=t.slice(0,4);return 0===o.length?(0,I.jsx)(Jo,{children:(0,I.jsx)(r.Text,{color:"textLite",fontSize:"10px",padding:[1],children:"No nodes"})}):(0,I.jsxs)(Jo,{children:[o.map((e,t)=>(0,I.jsxs)(r.Flex,{alignItems:"center",padding:[1],gap:2,border:t<o.length-1?{side:"bottom",color:"borderSecondary"}:void 0,children:[(0,I.jsx)(r.Text,{fontSize:"10px",flex:!0,truncate:!0,children:e.name}),(0,I.jsx)(r.Flex,{flex:!0}),(0,I.jsx)(r.Flex,{width:"8px",height:"8px",round:"50%",background:nn[(0,At.GM)(e.state)]})]},e.id)),t.length>4&&(0,I.jsx)(r.Flex,{padding:[1],justifyContent:"center",children:(0,I.jsxs)(r.Text,{fontSize:"9px",color:"textLite",children:["+",t.length-4," more"]})})]})},sn=e=>{let{alertCounts:t}=e;return(0,I.jsx)(Jo,{children:(0,I.jsxs)(r.Flex,{children:[(0,I.jsxs)(r.Flex,{column:!0,alignItems:"center",justifyContent:"center",padding:[2],flex:!0,background:"error",backgroundOpacity:.2,children:[(0,I.jsx)(r.Text,{fontSize:"10px",color:"error",children:"Critical"}),(0,I.jsx)(r.Text,{fontSize:"20px",strong:!0,color:"error",children:t.critical})]}),(0,I.jsxs)(r.Flex,{column:!0,alignItems:"center",justifyContent:"center",padding:[2],flex:!0,background:"warning",backgroundOpacity:.2,children:[(0,I.jsx)(r.Text,{fontSize:"10px",color:"warning",children:"Warning"}),(0,I.jsx)(r.Text,{fontSize:"20px",strong:!0,color:"warning",children:t.warning})]})]})})},ln=e=>{let{alertsByNode:t}=e;const o=t.slice(0,3);return 0===o.length?(0,I.jsx)(Jo,{padding:[2],children:(0,I.jsx)(r.Text,{color:"textLite",fontSize:"10px",children:"No alerts"})}):(0,I.jsxs)(Jo,{padding:[2],children:[o.map(e=>(0,I.jsxs)(r.Flex,{alignItems:"center",gap:2,margin:[0,0,1,0],children:[(0,I.jsx)(r.Text,{fontSize:"11px",truncate:!0,flex:!0,children:e.name}),(0,I.jsxs)(r.Flex,{gap:1,alignItems:"center",children:[e.critical>0&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(r.Flex,{width:"6px",height:"6px",round:"50%",background:"error"}),(0,I.jsx)(r.Text,{fontSize:"10px",color:"textLite",children:e.critical})]}),e.warning>0&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(r.Flex,{width:"6px",height:"6px",round:"50%",background:"warning"}),(0,I.jsx)(r.Text,{fontSize:"10px",color:"textLite",children:e.warning})]})]})]},e.nodeId)),t.length>3&&(0,I.jsxs)(r.Text,{fontSize:"9px",color:"textLite",children:["+",t.length-3," more"]})]})},dn=e=>{let{buckets:t}=e;const o=Math.max(1,...t.map(e=>e.critical+e.warning));return(0,I.jsx)(Jo,{padding:[2],children:(0,I.jsx)(r.Flex,{alignItems:"end",justifyContent:"center",gap:1,height:"50px",children:t.map((e,t)=>{const n=e.critical+e.warning,a=Math.max(2,Math.round(n/o*48)),s=e.critical>0?"error":e.warning>0?"warning":"mainBackgroundDisabled";return(0,I.jsx)(r.Flex,{width:"6px",height:`${a}px`,background:s,round:1},t)})})})},cn=e=>{let{nodeStatusCounts:t}=e;const o=Object.values(t).reduce((e,t)=>e+t,0);return(0,I.jsxs)(Jo,{padding:[2],children:[(0,I.jsx)(r.Flex,{justifyContent:"space-around",children:Object.entries(nn).map(e=>{let[o,n]=e;return(0,I.jsxs)(r.Flex,{column:!0,alignItems:"center",gap:0,children:[(0,I.jsx)(r.Flex,{width:"8px",height:"8px",round:"50%",background:n}),(0,I.jsx)(r.Text,{fontSize:"10px",children:t[o]||0})]},o)})}),o>0&&(0,I.jsx)(r.Flex,{justifyContent:"center",margin:[1,0,0,0],children:(0,I.jsxs)(r.Text,{fontSize:"9px",color:"textLite",children:[o," nodes"]})})]})},un=e=>{let{children:t,...o}=e;return(0,I.jsx)(r.Flex,{column:!0,gap:2,flex:!0,width:{min:0},...o,children:t})},hn=e=>{let{label:t,checked:o,onToggle:n}=e;return(0,I.jsx)(r.Checkbox,{checked:o,onChange:n,label:t})},xn=e=>{let{dashboardId:t,onPreviewChange:o}=e;const[a,s]=(0,n.useState)([]),[l,i]=(0,n.useState)({}),[c,u]=(0,n.useState)(new Set),[h,x]=(0,n.useState)({nodeStats:[]}),g=(0,L.CK)(),m=(0,wo.A)(l,{nodeIds:g,selectedNodeIds:a}),y=(0,p.Gt)(g),b=(0,_t.s)("ids")||[],f=(0,Mt.Gq)(b),j=(0,n.useMemo)(()=>{if(0===m.length)return y;const e=new Set(m);return y.filter(t=>e.has(t.id))},[y,m]),v=(0,n.useMemo)(()=>{const e={Live:0,Stale:0,Offline:0,Unseen:0};return j.forEach(t=>{const o=(0,At.GM)(t.state);e[o]=(e[o]||0)+1}),e},[j]),w=(0,n.useMemo)(()=>{if(0===m.length)return f;const e=new Set(m);return f.filter(t=>e.has(t.nodeId))},[f,m]),k=(0,n.useMemo)(()=>{const e={critical:0,warning:0,clear:0};return w.forEach(t=>{void 0!==e[t.status]&&e[t.status]++}),e},[w]),S=(0,n.useMemo)(()=>{const e={};w.forEach(t=>{e[t.nodeId]||(e[t.nodeId]={critical:0,warning:0}),"critical"===t.status&&e[t.nodeId].critical++,"warning"===t.status&&e[t.nodeId].warning++});const t=new Map(j.map(e=>[e.id,e.name]));return Object.entries(e).map(e=>{let[o,n]=e;return{nodeId:o,name:t.get(o)||o,...n}}).sort((e,t)=>1e3*t.critical+t.warning-(1e3*e.critical+e.warning))},[w,j]),C=(0,n.useMemo)(()=>{const e=Array.from({length:24},()=>({critical:0,warning:0}));return w.forEach(t=>{if(!t.lastUpdated)return;const o=new Date(1e3*t.lastUpdated).getHours();"critical"===t.status&&e[o].critical++,"warning"===t.status&&e[o].warning++}),e},[w]),T=(0,d.WM)(),F=(0,H.hu)(t),N=(0,H.Pp)(t),A=(0,H.Rt)(t),D=(0,H.HR)(t),_=(0,H.h$)(t),M=(0,H.Qv)(t),z=(0,n.useCallback)(e=>{u(t=>{const o=new Set(t);return o.has(e)?o.delete(e):o.add(e),o})},[]),O=(0,n.useCallback)((e,t)=>{x(o=>({...o,[e]:t}))},[]),E=(0,n.useCallback)(()=>{const e=m.length>0?{selectedNodeIds:m}:{};let t=null;c.forEach(o=>{switch(o){case Zo:t=F(e);break;case Xo:t=N(e);break;case en:t=A(e);break;case tn:t=D(e);break;case on:t=_(e)}}),h.nodeStats.length>0&&(t=M({...e,visibleItems:h.nodeStats})),u(new Set),x({nodeStats:[]}),T(null),t&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{const e=document.querySelector(`[data-id="${t}"]`);e&&e.scrollIntoView({behavior:"smooth",block:"nearest"})})})},[c,h,m,T,F,N,A,D,_,M]),P=c.size>0||h.nodeStats.length>0;return(0,n.useEffect)(()=>{if(!o)return;if(!P)return void o([]);const e=[...c].map(e=>({type:e,config:{selectedNodeIds:m}}));h.nodeStats.length>0&&e.push({type:"nodeStats",config:{selectedNodeIds:m,visibleItems:h.nodeStats}}),o(e)},[P,c,h,m,o]),(0,I.jsxs)(r.Flex,{column:!0,height:"100%",overflow:"hidden",children:[(0,I.jsx)(mo,{title:"Infrastructure"}),(0,I.jsxs)(r.Flex,{column:!0,flex:!0,overflow:"auto",padding:[3],gap:4,children:[(0,I.jsx)(B.A,{nodeIds:g,selectedNodeIds:a,setSelectedNodeIds:s,filters:l,setFilters:i}),(0,I.jsxs)(r.Flex,{gap:3,children:[(0,I.jsxs)(un,{children:[(0,I.jsx)(hn,{label:"Node grid",checked:c.has(Zo),onToggle:()=>z(Zo)}),(0,I.jsx)(rn,{nodeStatusCounts:v})]}),(0,I.jsxs)(un,{children:[(0,I.jsx)(hn,{label:"Node List",checked:c.has(Xo),onToggle:()=>z(Xo)}),(0,I.jsx)(an,{nodes:j})]})]}),(0,I.jsxs)(r.Flex,{column:!0,gap:3,children:[(0,I.jsx)(r.Text,{strong:!0,children:"Alerts"}),(0,I.jsxs)(r.Flex,{gap:3,children:[(0,I.jsxs)(un,{children:[(0,I.jsx)(hn,{label:"Alert Status",checked:c.has(en),onToggle:()=>z(en)}),(0,I.jsx)(sn,{alertCounts:k})]}),(0,I.jsxs)(un,{children:[(0,I.jsx)(hn,{label:"Alerts per Node",checked:c.has(tn),onToggle:()=>z(tn)}),(0,I.jsx)(ln,{alertsByNode:S})]})]}),(0,I.jsxs)(un,{children:[(0,I.jsx)(hn,{label:"Hourly Alerts",checked:c.has(on),onToggle:()=>z(on)}),(0,I.jsx)(dn,{buckets:C})]})]}),(0,I.jsx)(Vo.f,{label:"Node Stats",items:Ao.Qu.nodeStats,selected:h.nodeStats,onChange:e=>O("nodeStats",e),children:(0,I.jsx)(cn,{nodeStatusCounts:v})})]}),(0,I.jsx)(yo,{label:"Import",onClick:E,disabled:!P})]})},pn="dataRetention",gn=()=>(0,I.jsx)(Jo,{padding:[2],children:(0,I.jsxs)(r.Flex,{justifyContent:"space-around",children:[(0,I.jsxs)(r.Flex,{column:!0,alignItems:"center",children:[(0,I.jsx)(r.Text,{fontSize:"8px",color:"textLite",children:"Metrics"}),(0,I.jsx)(r.Text,{fontSize:"14px",strong:!0,children:"1.2K"})]}),(0,I.jsxs)(r.Flex,{column:!0,alignItems:"center",children:[(0,I.jsx)(r.Text,{fontSize:"8px",color:"textLite",children:"Charts"}),(0,I.jsx)(r.Text,{fontSize:"14px",strong:!0,children:"340"})]}),(0,I.jsxs)(r.Flex,{column:!0,alignItems:"center",children:[(0,I.jsx)(r.Text,{fontSize:"8px",color:"textLite",children:"Alerts"}),(0,I.jsx)(r.Text,{fontSize:"14px",strong:!0,children:"52"})]})]})}),mn=e=>{let{alertsByNode:t}=e;const o=t.slice(0,3);return(0,I.jsxs)(Jo,{padding:[2],children:[(0,I.jsx)(r.Flex,{alignItems:"end",justifyContent:"center",gap:1,height:"30px",children:o.map(e=>{const t=e.critical+e.warning,n=Math.max(1,...o.map(e=>e.critical+e.warning)),a=Math.max(4,Math.round(t/n*28));return(0,I.jsxs)(r.Flex,{width:"12px",height:`${a}px`,round:1,children:[e.critical>0&&(0,I.jsx)(r.Flex,{flex:!0,background:"error",round:1}),e.warning>0&&(0,I.jsx)(r.Flex,{flex:!0,background:"warning",round:1})]},e.nodeId)})}),0===o.length&&(0,I.jsx)(r.Text,{fontSize:"10px",color:"textLite",children:"No alerts"})]})},yn=()=>(0,I.jsx)(Jo,{padding:[2],children:(0,I.jsx)(r.Flex,{alignItems:"end",justifyContent:"center",gap:2,height:"30px",children:[18,24,12,20,8].map((e,t)=>(0,I.jsx)(r.Flex,{width:"8px",height:`${e}px`,background:"primary",round:1},t))})}),bn=()=>(0,I.jsx)(Jo,{padding:[2],children:(0,I.jsxs)(r.Flex,{justifyContent:"space-around",children:[(0,I.jsxs)(r.Flex,{column:!0,alignItems:"center",children:[(0,I.jsx)(r.Text,{fontSize:"8px",color:"textLite",children:"Parents"}),(0,I.jsx)(r.Text,{fontSize:"12px",strong:!0,children:"P"})]}),(0,I.jsxs)(r.Flex,{column:!0,alignItems:"center",children:[(0,I.jsx)(r.Text,{fontSize:"8px",color:"textLite",children:"Children"}),(0,I.jsx)(r.Text,{fontSize:"12px",strong:!0,children:"C"})]}),(0,I.jsxs)(r.Flex,{column:!0,alignItems:"center",children:[(0,I.jsx)(r.Text,{fontSize:"8px",color:"textLite",children:"Standalone"}),(0,I.jsx)(r.Text,{fontSize:"12px",strong:!0,children:"S"})]})]})}),fn=e=>{let{children:t,...o}=e;return(0,I.jsx)(r.Flex,{column:!0,gap:2,flex:!0,width:{min:0},...o,children:t})},jn=e=>{let{label:t,checked:o,onToggle:n}=e;return(0,I.jsx)(r.Checkbox,{checked:o,onChange:n,label:t})},vn=e=>{let{dashboardId:t,onPreviewChange:o}=e;const[a,s]=(0,n.useState)(new Set),[l,i]=(0,n.useState)({statsOverview:[],alertNodes:[],replicationStats:[]}),c=(0,L.CK)(),u=(0,p.Gt)(c),h=(0,_t.s)("ids")||[],x=(0,Mt.Gq)(h),g=(0,n.useMemo)(()=>{const e={};x.forEach(t=>{e[t.nodeId]||(e[t.nodeId]={critical:0,warning:0}),"critical"===t.status&&e[t.nodeId].critical++,"warning"===t.status&&e[t.nodeId].warning++});const t=new Map(u.map(e=>[e.id,e.name]));return Object.entries(e).map(e=>{let[o,n]=e;return{nodeId:o,name:t.get(o)||o,...n}}).sort((e,t)=>1e3*t.critical+t.warning-(1e3*e.critical+e.warning))},[x,u]),m=(0,d.WM)(),y=(0,H.fM)(t),b=(0,H.Vs)(t),f=(0,H.ez)(t),j=(0,H.cj)(t),v=(0,n.useCallback)(e=>{s(t=>{const o=new Set(t);return o.has(e)?o.delete(e):o.add(e),o})},[]),w=(0,n.useCallback)((e,t)=>{i(o=>({...o,[e]:t}))},[]),k=Object.values(l).some(e=>e.length>0),S=a.size>0||k;(0,n.useEffect)(()=>{if(!o)return;if(!S)return void o([]);const e=Array.from(a).map(e=>({type:e,config:{}}));Object.entries(l).forEach(t=>{let[o,n]=t;n.length>0&&e.push({type:o,config:{visibleItems:n}})}),o(e)},[S,a,l,o]);const C=(0,n.useCallback)(()=>{let e=null;a.forEach(t=>{if(t===pn)e=b({})}),Object.entries(l).forEach(t=>{let[o,n]=t;if(0===n.length)return;const r={statsOverview:y,alertNodes:f,replicationStats:j}[o];r&&(e=r({visibleItems:n}))}),s(new Set),i({statsOverview:[],alertNodes:[],replicationStats:[]}),m(null),e&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=document.querySelector(`[data-id="${e}"]`);t&&t.scrollIntoView({behavior:"smooth",block:"nearest"})})})},[a,l,m,y,b,f,j]);return(0,I.jsxs)(r.Flex,{column:!0,height:"100%",overflow:"hidden",children:[(0,I.jsx)(mo,{title:"Room Overview"}),(0,I.jsxs)(r.Flex,{column:!0,flex:!0,overflow:"auto",padding:[3],gap:4,children:[(0,I.jsx)(Vo.f,{label:"Stats Overview",items:Ao.Qu.statsOverview,selected:l.statsOverview,onChange:e=>w("statsOverview",e),children:(0,I.jsx)(gn,{})}),(0,I.jsx)(Vo.f,{label:"Alert Nodes",items:Ao.Qu.alertNodes,selected:l.alertNodes,onChange:e=>w("alertNodes",e),children:(0,I.jsx)(mn,{alertsByNode:g})}),(0,I.jsxs)(fn,{children:[(0,I.jsx)(jn,{label:"Data Retention",checked:a.has(pn),onToggle:()=>v(pn)}),(0,I.jsx)(yn,{})]}),(0,I.jsx)(Vo.f,{label:"Replication",items:Ao.Qu.replicationStats,selected:l.replicationStats,onChange:e=>w("replicationStats",e),children:(0,I.jsx)(bn,{})})]}),(0,I.jsx)(yo,{label:"Import",onClick:C,disabled:!S})]})},wn={[ht]:vo,[xt]:Fo,[pt]:e=>(0,I.jsx)(Yo,{...e,flavour:"fn"}),[gt]:e=>(0,I.jsx)(Yo,{...e,flavour:"logs"}),[mt]:e=>(0,I.jsx)(Yo,{...e,flavour:"feed"}),[yt]:xn,[bt]:vn},kn={[ht]:718,[xt]:680,[pt]:680,[gt]:680,[mt]:680,[yt]:680,[bt]:680},Sn={top:"top",left:"right"},Cn=(0,U.default)(r.Flex).withConfig({displayName:"palette__AnimatedContainer",componentId:"sc-112dxl5-0"})(["transition:width 0.2s ease-out;max-width:calc(100vw - 200px);"]),In=e=>{let{panelId:t,dashboardId:o,targetRef:a,onClose:s}=e;const[l,i]=(0,n.useState)([]),d=(0,n.useMemo)(()=>wn[t],[t]),c=kn[t]||680,u=l.length>0,h=l.some(e=>{const{fnType:t,flowView:o}=e.config||{};return"topology"===t||!("flows"!==t||!o||"table-sankey"===o)})?640:420;const x=u?c+h:c;return d&&a.current?(0,I.jsx)(r.Drop,{align:Sn,target:a.current,onEsc:s,onClickOutside:s,dataDrop:"palette-panel-drop",zIndex:68,backdrop:!0,backdropProps:{background:["transparent","full"],zIndex:50},margin:[2,0,0,2],children:(0,I.jsxs)(Cn,{width:`${x}px`,height:{max:"80vh"},background:"panelBg",overflow:"hidden",children:[(0,I.jsx)(r.Flex,{width:`${c}px`,padding:[4],children:(0,I.jsx)(d,{dashboardId:o,onPreviewChange:i})}),u&&(0,I.jsx)(r.Flex,{flex:!0,padding:[4],border:{side:"left",color:"borderSecondary"},overflow:"auto",background:"panelBg",children:(0,I.jsx)(go,{items:l})})]})}):null},Tn=e=>{let{dashboardId:t}=e;const o=(0,d.wz)(),a=(0,d.WM)(),s=(0,n.useRef)(null),l=(0,n.useCallback)(()=>a(null),[]);return(0,I.jsxs)(r.Flex,{ref:s,height:"100%",children:[(0,I.jsx)(kt,{}),o===ft&&(0,I.jsx)(E,{dashboardId:t,onClose:l}),o&&o!==ft&&(0,I.jsx)(In,{panelId:o,dashboardId:t,targetRef:s,onClose:l},o)]})},Fn=()=>((0,Ne.A)(),null),Nn=(0,n.memo)(e=>{let{id:t,roomId:o,nodeIds:r=[],isOnTV:h}=e;const[x,,,p]=(0,s.A)("addChartModal"),{fullyLoaded:g,cardIds:m,name:y}=(0,i.fz)(t),b=(0,d.tD)(),f=(0,d.x3)(),j=(0,n.useRef)(!1);(0,n.useEffect)(()=>{g&&!j.current&&(j.current=!0,f(0===m.length))},[g,m.length,f]);const v=(0,a.zy)(),w=(0,a.Zp)(),[k,S]=(0,n.useState)(!1);(0,n.useEffect)(()=>{g&&v.state?.showDuplicateWizard&&(S(!0),w(v.pathname,{replace:!0,state:{}}))},[g]);const C=(0,n.useCallback)(()=>S(!0),[]),T=(0,n.useCallback)(()=>S(!1),[]);(e=>{const t=(0,i.zN)(e),o=(0,d.tD)();$e(Ge,o&&!t)})(t);const[F,{width:N}]=(0,l.A)(),[A,L]=(0,Ae.N9)("chartName",{key:o,extraKey:t,flavour:"val"}),B=(0,c.Xc)(t),D=(0,u.T6)(t);return(0,I.jsx)(Be.Ay,{feature:"custom-dashboard",children:(0,I.jsx)(Kt.Ay,{dashboardId:t,children:(0,I.jsxs)(Le.A,{getObject:D,ids:B,getMenu:Me,extraKey:t,children:[(0,I.jsx)(Fn,{}),!h&&b&&(0,I.jsx)(Tn,{dashboardId:t}),(0,I.jsxs)(Fe.A,{ref:F,overflow:"hidden",background:"mainBackground",padding:[0,4],children:[!h&&(0,I.jsx)(ct,{id:t,isEditMode:b,onOpenDuplicateWizard:C}),g&&m.length>0&&(0,I.jsx)($,{active:b&&!h,children:(0,I.jsx)(ut.A,{id:t,containerWidth:N,initialChartName:A,onChartNameChange:L,isOnTV:h})}),g&&0===m.length&&!h&&(0,I.jsx)($,{active:!0,children:(0,I.jsx)(P,{dashboardId:t})}),x&&!h&&(0,I.jsx)(me,{id:t,onClose:p}),k&&(0,I.jsx)(Te,{dashboardId:t,onClose:T})]})]})})})}),An=(0,n.memo)(e=>{let{id:t,isOnTV:o}=e;const n=(0,h.ID)(),r=(0,x.w7)({extraKey:"dashboard",merge:!1,scoped:!0}),a=(0,p.TG)(r);return(0,I.jsx)(Nn,{id:t,roomId:n,nodeIds:a,isOnTV:o})})}}]);