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/3873.f6a2f71fea8a99e031bf.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:"d147606963bc0c498afbaa54c78aa7ffe6a22839"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a903c6c1-3d74-43e2-9077-78d00fd2e480",e._sentryDebugIdIdentifier="sentry-dbid-a903c6c1-3d74-43e2-9077-78d00fd2e480")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[3873],{57738(e,t,n){n.d(t,{L:()=>y});n(98992),n(8872);var o=n(96540),r=n(76667),a=n(30569),s=n(63872),l=n(19186),i=n(10602),d=n(24609),c=n(30731),u=n(92726),h=n(67294),x=n(45706),p=n(3319);const g=e=>"function"===e.type&&"feed"===e.flavour,m=(e,t)=>{const n=t[0]||null;return Object.entries(e).reduce((e,t)=>{let[o,r]=t;const{pristine:a,data:s,columns:l,aggregations:i,aggregatedView:d,acceptedParams:c,requiredParams:u,...h}=r;return"chart"===h.type?e[o]={...h,nodesScope:[]}:(e=>"function"===e.type&&!g(e))(h)?e[o]={...h,selectedNodeIds:n?[n]:[]}:g(h)?e[o]={...h,selectedNodeIds:[]}:e[o]="selectedNodeIds"in h?{...h,selectedNodeIds:[]}:h,e},{})},y=()=>{const e=(0,r.Zp)(),[t,n]=(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,o.useCallback)(async(o,r,a)=>{if(v)try{const{data:n}=await(0,c.f7)(g,y,a),{layout:o,containerIds:s,containers:l,cards:i,dashboard:d}=(0,x.S)(n),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:o,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){n(s)}else n({header:"Dashboards",text:"Please wait for nodes to finish loading."})},[g,y,b,f,j,v,e,t,n,w]))}},31623(e,t,n){n.d(t,{J:()=>Fo,A:()=>No});var o=n(96540),r=n(38429),a=n(76667),s=n(98591),l=n(85660),i=n(92726),d=n(78385),c=n(57068),u=n(6393),h=n(19186),x=n(87083),p=n(24013),g=(n(98992),n(81454),n(29263)),m=n(24609),y=n(77814),b=(n(74423),n(3949),n(25509),n(65223),n(60321),n(41927),n(11632),n(64377),n(66771),n(12516),n(68931),n(52514),n(35694),n(52774),n(49536),n(21926),n(94483),n(16215),n(30569)),f=n(1011),j=n(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:n,layout:o,context:r,...a}=e;return{...j.kG,...j.Pk,id:(0,f.A)(),contextScope:[r],nodesScope:t,...a}})(e,t):((e,t)=>{const{type:n,layout:o,...r}=e,a=v[n];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,n,o,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 n=e.top+e.height;n>t&&(t=n)})}),t})(a),d=((e,t)=>{let n=0,o=t,r=0;return e.map(e=>{const{w:t,h:a}=e.layout;n+t>12&&(o+=r,n=0,r=0);const s={left:n,top:o,width:t,height:a,minWidth:1,minHeight:1};return n+=t,r=Math.max(r,a),s})})(o.cards,l),h=[];o.cards.forEach((t,o)=>{const a=w(t,r),l={...d[o],id:a.id};h.push(a.id),n((0,u.nG)({id:e,resourceId:a.id}),a),n((0,c.xB)(e),e=>({...e,[s]:[...e[s]||[],l]}))}),n((0,i.Qx)({id:e,key:"cardIds"}),e=>[...e,...h]),n((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:"gauge",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}}]}];n(54520);const C=(e,t)=>{const n=new Set(t),o=e.filter(e=>((e,t)=>{if(e.has(t))return!0;if(!t.includes("*"))return!1;const n=new RegExp("^"+t.replace(/\./g,"\\.").replace(/\*/g,".*")+"$");return[...e].some(e=>n.test(e))})(n,e));return{matched:o.length,total:e.length}};var I=n(74848);const T=e=>{let{matched:t,total:n}=e;const o=((e,t)=>0===e?"textLite":e===t?"success":"warning")(t,n);return(0,I.jsx)(r.Flex,{padding:[1,2],round:1,background:"elementBackground",alignItems:"center",children:(0,I.jsxs)(r.Text,{color:o,fontSize:"10px",strong:!0,children:[t,"/",n," 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:n}=t;let o=0,a=0,s=0;const l=n.map((e,t)=>{const{w:n,h:l}=e.layout;o+n>12&&(a+=s,o=0,s=0);const i={position:"absolute",left:16*o,top:4*a,width:16*n-1,height:4*l-1};return o+=n,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:n,onClick:o}=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:o,"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:n.matched,total:n.total})]})};var L=n(10602),B=n(42721);const D=e=>{let{preset:t,onApply:n,onBack:a}=e;const s=(0,L.CK)(),[l,i]=(0,o.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:()=>n(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:n,onClick:o}=e;return(0,I.jsxs)(r.Flex,{alignItems:"center",gap:2,padding:[2,3],round:.5,cursor:"pointer",background:n?"primary":void 0,backgroundOpacity:n?.1:void 0,_hover:n?void 0:{background:"primary",backgroundOpacity:.05},onClick:o,"data-testid":`preset-category-${t.id}`,children:[(0,I.jsx)(r.Icon,{name:t.icon,color:n?"primary":"text",width:"16px",height:"16px"}),(0,I.jsx)(r.Text,{color:n?"primary":"text",strong:n,children:t.name})]})},z=e=>{let{categories:t,activeCategoryId:n,onSelect:o}=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:n===e.id,onClick:()=>o(e.id)},e.id))})},O=e=>{let{presets:t,availableContexts:n,onSelect:o}=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,n),onClick:()=>o(e)},e.id))})},E=e=>{let{dashboardId:t,onClose:n}=e;const a=(0,m.vt)(),s=(0,h.ID)(),{charts:l}=(0,y.A)(a,s),i=k(t),[d,c]=(0,o.useState)(_[0].id),[u,x]=(0,o.useState)(null),p=(0,o.useMemo)(()=>Object.keys(l),[l]),b=(0,o.useMemo)(()=>{return e=d,S.filter(t=>t.category===e);var e},[d]),f=e=>{i(u,e),n()};return u?(0,I.jsx)(r.Layer,{position:"center",backdrop:!0,onClickOutside:n,onEsc:n,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:n,onEsc:n,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:n}),(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:n,...a}=e;const[,l]=(0,s.A)("addChartModal"),[i,d]=(0,o.useState)(!1),[c,u]=(0,o.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,o.useMemo)(()=>Object.keys(j),[j]),T=(0,o.useMemo)(()=>(e=>{const t=S.map(t=>{const n=C(t.contexts,e);return{preset:t,availability:n,ratio:n.total>0?n.matched/n.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:!n&&(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:n}=e;return(0,I.jsx)(r.Flex,{width:"220px",children:(0,I.jsx)(A,{preset:t,availability:n,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=n(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});n(72577);var G=n(32788),V=n(47410),K=n(23226),H=n(5907),W=n(21e3),Q=n(87733),Y=n(67012),J=n(28657),Z=n(87398),X=n(13752),ee=n(92815),te=n(72582),ne=n(78072),oe=n(91832),re=n(23565),ae=n(52795),se=n(54251),le=n(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:n,value:a,onChange:s,options:l,testid:i,selectedNodeIds:d,metadata:c}=e;const[u,h]=(0,o.useState)(),x=a?.value,p=(0,Z.eg)(),g=(0,re.CS)({type:"chart",entity:x,path:"/"}),m=(0,Q.K)({spaceId:t,roomId:n}),y=(0,o.useMemo)(()=>{p.getNodes({id:"newDashboardChart"}).forEach(e=>e.destroy());const{info:e,valueRange:t,height:o,colors:r}=(0,W.Ay)(c),a=p.makeChart({attributes:{id:"newDashboardChart",contextScope:[x],host:m,roomId:n,info:e,valueRange:t,height:o+207,enabledNavigation:!1,nodesScope:d,...r&&{colors:r},toolboxElements:[ne.default,te.default,X.default,ee.default,oe.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,n,x,g,u]),(0,o.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=n(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:n,nodeStatus:o,name:r}=e;return{label:n?r:`${r} (${o})`,value:t,isDisabled:!n}},ge=e=>({value:e,label:e}),me=e=>{let{id:t,onClose:n}=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,o.useState)(j.value),[k,S]=(0,o.useState)(null),C=(0,o.useMemo)(()=>[j,...b.map(pe)],[b]),T=(0,o.useMemo)(()=>C.find(e=>{let{value:t}=e;return t===v}),[C,v]),F=(0,o.useCallback)(e=>{w(e?.value||j.value),S(null)},[]),N=(0,o.useMemo)(()=>v===j.value?[]:[v],[v]),{charts:A,error:B}=(0,y.A)(a,s,N),D=(0,o.useMemo)(()=>Object.keys(A).sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:"accent",ignorePunctuation:!0})).map(ge),[A]);(0,o.useEffect)(()=>{D.length&&T&&S(e=>e||D[0].value)},[k,D,T]);const _=(0,o.useMemo)(()=>k&&ge(k),[k]),M=(0,o.useCallback)(e=>S(e?.value),[]),z=A[k],O=(0,Z.eg)(),E=(0,o.useCallback)(()=>{const e=O.getNode({id:"newDashboardChart"}),t=(0,ae.h)(e.getAttributes());f(t.contextScope,t,()=>setTimeout(n))},[v,z]),P=!k,[,U]=(0,K.A)();return(0,o.useEffect)(()=>(U(!0),()=>U(!1))),(0,I.jsx)(G.GO,{onClose:n,children:B?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(g.z,{onClose:n,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:n,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=n(28864),be=n(44245),fe=n(63872);n(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,o.useMemo)(()=>(e=>{const t=Object.values(e),n=t.some(ve),o=t.filter(je),r=[{type:"global",hasNodeFilter:n}];return o.forEach(e=>{r.push({type:"singleNode",cardId:e.id,cardTitle:e.customTitle||e.displayName||e.id,flavour:e.flavour})}),r})(t||{}),[t])};var ke=n(38757);const Se=e=>{let{name:t,setName:n,isNameValid:o,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=>n(e.target.value),isValid:o,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:n,selectedNodeId:o,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[n]||"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:o?[o]:[],setSelectedNodeIds:e=>a(e[0]||null),multi:!1})]})]})},Te=e=>{let{dashboardId:t,onClose:n}=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,o.useState)(0),[j,v]=(0,o.useState)(s),[w,k]=(0,o.useState)(!0),[S,C]=(0,o.useState)([]),[T,F]=(0,o.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,o.useState)(!1),[,z]=(0,fe.A)(),O=(0,b.yF)((0,o.useCallback)((e,n)=>{const o=e((0,u.nG)({id:t}));Object.entries(o).forEach(e=>{let[o,r]=e;"chart"===r.type&&S.length>0?n((0,u.nG)({id:t,resourceId:o}),e=>({...e,nodesScope:S})):"function"===r.type&&"feed"!==r.flavour&&T[o]?n((0,u.nG)({id:t,resourceId:o}),e=>({...e,selectedNodeIds:[T[o]]})):("function"===r.type&&"feed"===r.flavour&&S.length>0||"selectedNodeIds"in r&&S.length>0)&&n((0,u.nG)({id:t,resourceId:o}),e=>({...e,selectedNodeIds:S}))}),n((0,i.Qx)({id:t}),e=>({...e,duplicate:null,...j!==s?{name:j}:{}}))},[t,S,T,j,s])),E=(0,b.yF)((0,o.useCallback)((e,n)=>{n((0,i.Qx)({id:t}),e=>({...e,duplicate:null}))},[t])),P=(0,o.useCallback)(async()=>{M(!0),O();try{const{data:e}=await N(),{slug:o}=e;if(o!==l){const e=`${p}/dashboards/${o}`;m({id:t,slug:o,path:e}),x(e,{replace:!0})}n()}catch(e){z(e),M(!1)}},[O,N,n,z,l,p,m,t,x]),U=(0,o.useCallback)(async()=>{M(!0),E();try{await N(),n()}catch(e){z(e),M(!1)}},[E,N,n,z]),q=(0,o.useCallback)(()=>{B?P():f(e=>e+1)},[B,P]),R=(0,o.useCallback)(()=>{f(e=>Math.max(0,e-1))},[]);return(0,I.jsxs)(G.GO,{onClose:n,"data-testid":"duplicateWizard-modal",children:[(0,I.jsx)(g.z,{onClose:n,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=n(88255),Ne=n(65380),Ae=n(42790),Le=n(83330),Be=n(60908),De=(n(8872),n(85163)),_e=n(71123);const Me=function(e,t){let{containerIds:n,containers:o,layout:r}=e,{extraKey:a}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s={},l=n.reduce((e,n)=>{const l=(0,_e.bj)(r[n],"vertical");return e[n]={...o[n],level:0,id:n,subMenuIds:l.reduce((e,o)=>{let{id:r}=o;return"text"!==t(r).type&&e.push(`${n}|${r}`),e},[]),subMenuChartIds:[],link:`${(0,De.A)(`menu_${n}`)}`,forceVisibility:!0,arFlavour:"anomaly",extraKey:a},l.forEach(e=>{const o=`${n}|${e.id}`,r=t(e.id);"text"!==r.type&&(s[o]={name:r.title,level:1,id:o,menuId:n,chartIds:[],link:`${(0,De.A)(`menu_${n}_submenu_${o}`)}`,arFlavour:"anomaly",showAR:!1,extraKey:a})}),e},{});return{menuIds:n,menuById:l,subMenuById:s}};var ze=n(6304),Oe=n(57738),Ee=n(99728),Pe=n(67294),Ue=n(51262),qe=n(39175);const Re=e=>{let{id:t}=e;const[n,a]=(0,i.TN)({id:t,key:"name"}),[s,l]=(0,o.useState)(n||"");(0,o.useEffect)(()=>{l(n||"")},[n]);const d=(0,o.useCallback)(e=>{l(e.target.value)},[]),c=(0,o.useCallback)(()=>{s!==n&&a(s||"Untitled Dashboard")},[s,n,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:n}=(0,o.useContext)(a._3),r=(0,a.zy)();(0,o.useEffect)(()=>{if(!t)return;const o=n.block(t=>{const n={...t,retry(){o(),t.retry()}};e(n)});return o},[n,e,t,r])}((0,o.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=n(51571);const Ke=e=>{let{id:t}=e;const[,n]=(0,fe.A)(),o=(0,ye.DH)(t,{onFail:n}),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:()=>o(),disabled:s,isLoading:r,"data-testid":"dashboardHeaderActionBar-save-button","data-ga":"action-bar::click-save::cust-dashboard"})},He=e=>{let{id:t}=e;const n=(e=>{const t=(0,i.zN)(e),n=(0,ye.Cb)(e),r=(0,d.x3)();return(0,o.useCallback)(()=>{if(!t){if(!window.confirm(Ge))return;n()}r(!1)},[t,n,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:n,"data-testid":"dashboardHeaderActionBar-exit-button","data-ga":"action-bar::click-exit::cust-dashboard"})]})},We=(0,o.memo)(He),Qe=e=>{let{id:t,...n}=e;const[a,s]=(0,i.TN)({id:t,key:"respectNodesScope"}),l=(0,ye.DH)(t),d=(0,o.useCallback)(()=>{s(!a),l()},[a,s]);return(0,I.jsx)(r.Toggle,{...n,colored:!0,onChange:d,checked:!a,margin:[0],labelRight:"Apply global filters"})};var Ye=n(67916),Je=n(12273),Ze=n(81214);const Xe=e=>{let{dashboardId:t,spaceId:n,roomId:a,onClose:s}=e;const[l,i]=(0,o.useState)(!1),[d,c]=(0,o.useState)(null),[u,h]=(0,o.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)(Je.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,Ze.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,n,o){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=${n}&room_id=${o}${l?`&agent=${l}`:""}#token=${e}&after=${r}&before=${a}`}((await(0,Ye.Ey)({description:`TV Mode - Dashboard ${t}`,scope:"scope:all"})).data.token,t,n,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 et=n(46587);const tt=(0,n(74891).A)(r.Button),nt=e=>{let{dashboardId:t,spaceId:n,roomId:a,iconOnly:s,small:l}=e;const i=(0,et.uW)("isAnonymous"),[d,c]=(0,o.useState)(!1),u=(0,o.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)(tt,{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)(Xe,{dashboardId:t,spaceId:n,roomId:a,onClose:()=>c(!1)})]})},ot=e=>{let{id:t,onOpenDuplicateWizard:n}=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,o.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:n,"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)(nt,{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"})]})},rt=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)(Qe,{id:t}),(0,I.jsx)(We,{id:t})]})]})},at=e=>{let{id:t,isEditMode:n,onOpenDuplicateWizard:o}=e;return n?(0,I.jsx)(rt,{id:t}):(0,I.jsx)(ot,{id:t,onOpenDuplicateWizard:o})},st=(0,o.memo)(at);var lt=n(85877);const it="typography",dt="metrics",ct="functions",ut="logs",ht="feed",xt="infrastructure",pt="roomOverview",gt="presets",mt=[{id:it,icon:"text_add",tooltip:"Typography"},{id:dt,icon:"room_overview",tooltip:"Metrics"},{id:ct,icon:"live",tooltip:"Live"},{id:ut,icon:"logs",tooltip:"Logs"},{id:ht,icon:"feed",tooltip:"Events"},{id:xt,icon:"nodes_hollow",tooltip:"Infrastructure"},{id:pt,icon:"room_home",tooltip:"Room Overview"},{id:gt,icon:"dashboard",tooltip:"Templates"}],yt=(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;"]),bt=e=>{let{id:t,icon:n,tooltip:o,isActive:a,onClick:s}=e;return(0,I.jsx)(yt,{"data-testid":`toolbar-button-${t}`,$active:a,onClick:s,title:o,children:(0,I.jsx)(r.Icon,{name:n,color:a?"mainBackground":"primary",width:"16px",height:"16px"})})},ft=()=>{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:mt.map(n=>(0,I.jsx)(bt,{id:n.id,icon:n.icon,tooltip:n.tooltip,isActive:e===n.id,onClick:()=>t(n.id)},n.id))})};var jt=n(25616);const vt=e=>{let{item:t}=e;const{context:n,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-${n}`,x=(0,o.useMemo)(()=>{l.getNodes({id:u}).forEach(e=>e.destroy());const{info:e,valueRange:t,height:o,colors:r}=(0,W.Ay)(a),i=l.makeChart({attributes:{id:u,contextScope:[n],host:c,roomId:d,info:e,valueRange:t,height:(o||0)+207,enabledNavigation:!1,nodesScope:s,...r&&{colors:r}}});return l.getRoot().appendChild(i),i},[l,n,u,c,d,a,s]);return(0,o.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 wt=n(31522),kt=n(65067),St=n(56452);const Ct=e=>{let{item:t}=e;const{selectedNodeIds:n,groupBy:o=[],colorBy:a=wt.jZ}=t.config,s=(0,L.CK)(),l=(0,L.nj)(),i=n?.length?n:s,d=(0,p.Gt)(i);return(0,I.jsxs)(kt.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)(St.A,{nodes:d,groupBy:o,colorBy:a,loaded:l})})]})};var It=n(49181),Tt=n(59092);const Ft={nodeStatus:e=>(0,It.GM)(e.state),alertStatus:e=>{if((e.alerts_critical||0)>0)return"Critical";return(e.alerts_warning||0)>0?"Warning":"No alerts"}},Nt=e=>{let{item:t}=e;const{selectedNodeIds:n,groupBy:a}=t.config,s=(0,L.CK)(),l=(0,L.nj)(),i=n?.length?n:s,d=(0,p.Gt)(i),c=(0,o.useMemo)(()=>(e=>{const t={reachable:0,stale:1,unreachable:2,created:3};return[...e].sort((e,n)=>(t[e.state]??4)-(t[n.state]??4))})(d),[d]),u=(0,o.useMemo)(()=>{const e=Ft[a];if(!e)return null;const t={};return c.forEach(n=>{const o=e(n);t[o]||(t[o]=[]),t[o].push(n)}),Object.entries(t)},[c,a]);return(0,I.jsxs)(kt.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)(Tt.A,{nodes:c,groupedNodes:u,loaded:l,nodeCount:d.length})})]})};var At=n(41716),Lt=n(19075),Bt=n(94230);const Dt=e=>{let{item:t}=e;const{selectedNodeIds:n}=t.config,a=(0,At.s)("ids")||[],s=(0,At.s)("loaded"),l=(0,Lt.Gq)(a),i=(0,o.useMemo)(()=>n?.length?new Set(n):null,[n]),{critical:d,warning:c}=(0,o.useMemo)(()=>(i?l.filter(e=>i.has(e.nodeId)):l).reduce((e,t)=>{let{status:n}=t;return e[n]=(e[n]||0)+1,e},{critical:0,warning:0,clear:0}),[l,i]);return(0,I.jsxs)(kt.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)(Bt.A,{critical:d,warning:c,loaded:s})})]})};var _t=n(95760);const Mt=e=>{let{item:t}=e;const{selectedNodeIds:n}=t.config,a=(0,L.CK)(),s=n?.length?n:a,l=(0,p.Gt)(s),i=(0,L.nj)(),d=(0,At.s)("ids")||[],c=(0,At.s)("loaded"),u=(0,Lt.Gq)(d),h=i&&c,x=(0,o.useMemo)(()=>{const e={};return u.forEach(t=>{if(!t.nodeId)return;e[t.nodeId]||(e[t.nodeId]={critical:[],warning:[]});const n=t.status?.toLowerCase();"critical"===n?e[t.nodeId].critical.push(t):"warning"===n&&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:n}=e;return t.length>0||n.length>0}).sort((e,t)=>{const n=1e3*e.criticalAlerts.length+e.warningAlerts.length;return 1e3*t.criticalAlerts.length+t.warningAlerts.length-n})},[l,u]);return(0,I.jsxs)(kt.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)(_t.A,{nodesWithAlerts:x,nodeCount:l.length,loaded:h})})]})};var zt=n(52346);const Ot=72e5,Et=3e5,Pt=e=>{let{item:t}=e;const{selectedNodeIds:n}=t.config,a=(0,At.s)("ids")||[],s=(0,At.s)("loaded"),l=(0,Lt.Gq)(a),i=(0,L.CK)(),d=n?.length?n:i,{buckets:c,maxTotal:u,totalAlerts:h}=(0,o.useMemo)(()=>{const e=Date.now(),t=e-Ot,o=Array.from({length:24},(e,n)=>({ts:t+n*Et,critical:0,warning:0})),r=n?.length?l.filter(e=>d.includes(e.nodeId)):l;r.forEach(n=>{if(!n.lastUpdated)return;const r=1e3*n.lastUpdated;if(r<t||r>e)return;const a=Math.floor((r-t)/Et);if(a<0||a>=24)return;const s=n.status?.toLowerCase();"critical"===s?o[a].critical++:"warning"===s&&o[a].warning++});const a=Math.max(...o.map(e=>e.critical+e.warning),1),s=r.filter(n=>{const o=n.status?.toLowerCase();if("critical"!==o&&"warning"!==o)return!1;if(!n.lastUpdated)return!1;const r=1e3*n.lastUpdated;return r>=t&&r<=e}).length;return{buckets:o,maxTotal:a,totalAlerts:s}},[l,n,d]);return(0,I.jsxs)(kt.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)(zt.A,{buckets:c,maxTotal:u,totalAlerts:h,loaded:s})})]})};var Ut=n(77125);const qt=e=>{let{item:t}=e;const{selectedNodeIds:n,visibleItems:a}=t.config,s=(0,L.CK)(),l=n?.length?n:s,i=(0,p.Gt)(l),d=(0,L.nj)(),c=(0,At.s)("ids")||[],u=(0,At.s)("loaded"),h=(0,Lt.Gq)(c),x=d&&u,g=(0,o.useMemo)(()=>new Set(l),[l]),m=(0,o.useMemo)(()=>{const e={Live:0,Stale:0,Offline:0,Unseen:0};return i.forEach(t=>{const n=(0,It.GM)(t.state);e[n]=(e[n]||0)+1}),e},[i]),{critical:y,warning:b,clear:f}=(0,o.useMemo)(()=>(n?.length?h.filter(e=>g.has(e.nodeId)):h).reduce((e,t)=>{let{status:n}=t;return e[n]=(e[n]||0)+1,e},{critical:0,warning:0,clear:0}),[h,n,g]);return(0,I.jsxs)(kt.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)(Ut.A,{statusCounts:m,critical:y,warning:b,clear:f,visibleItems:a,loaded:x})})]})};var Rt=n(58533),$t=n(87242);const Gt=[],Vt=e=>{let{item:t}=e;const{visibleItems:n}=t.config||{},{loaded:a,metricsCollected:s=0}=(0,Rt.VH)(),l=(0,m.vt)(),i=(0,h.ID)(),{charts:d,loaded:c,error:u}=(0,y.A)(l,i,Gt),x=Object.keys(d).length,{loaded:p,value:g}=(0,Lt.oU)(),b=g?.length||0,f=(0,o.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=>!n||n.includes(e.id)),[s,a,x,c,u,b,p,n]);return(0,I.jsxs)(kt.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)($t.A,{stats:f})})]})};var Kt=n(46025);const Ht=e=>{let{item:t}=e;const{dataRetention:n,loaded:o}=(0,Rt.VH)();return(0,I.jsxs)(kt.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:o?n?.length?(0,I.jsx)(Kt.A,{dataRetention:n}):(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 Wt=n(7761),Qt=n(39431);const Yt=e=>{let{item:t}=e;const{visibleItems:n}=t.config||{},o=(0,Wt.jg)();return(0,I.jsxs)(kt.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)(Qt.A,{alertsStats:o,visibleItems:n,loaded:o.loaded})})]})};var Jt=n(19529);const Zt=e=>{let{item:t}=e;const{visibleItems:n}=t.config||{},{loaded:a,totalParents:s,totalChildren:l,totalStandalone:i,replicationFactor:d}=(0,Wt.c8)(),c=(0,o.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=>!n||n.includes(e.id)),[s,l,i,n]),u=(0,o.useMemo)(()=>[{label:"None",value:d?.r_1||0,color:wt.q5.r_1,id:"none"},{label:"Single",value:d?.r_2||0,color:wt.q5.r_2,id:"single"},{label:"Multi",value:d?.["r_*"]||0,color:wt.q5["r_*"],id:"multi"}].filter(e=>!n||n.includes(e.id)),[d,n]);return(0,I.jsxs)(kt.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)(Jt.A,{topologyData:c,replicationData:u,loaded:a})})]})};n(33110);var Xt=n(81989),en=n(44252),tn=n(13607),nn=n(40580),on=n(81445),rn=n(71488);const an=(0,o.lazy)(()=>Promise.all([n.e(7986),n.e(6370)]).then(n.bind(n,20675))),sn=(0,o.lazy)(()=>Promise.all([n.e(5219),n.e(8723)]).then(n.bind(n,78723))),ln=e=>{let{item:t}=e;const{selectedFn:n,flavour:a,visibleItems:s,nodeIds:l,fnType:i,flowView:d,acceptedParams:c,functionParamsFilters:u,defaultCharts:h,displayName:x}=t.config,p=(0,nn.A)({selectedFn:n,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,o.useCallback)(()=>{},[]);return(0,I.jsxs)(kt.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||n||"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)(o.Suspense,{fallback:null,children:(0,I.jsx)(an,{flowView:d,flowRows:p.flowRows,flowColumns:p.flowColumns,flowGroupByKeys:p.flowGroupByKeys,flowTimeseries:p.flowTimeseries,flowMapFlows:p.flowMapFlows,visibleItems:s,selectedFn:n,selectedNodeIds:l})}),m&&"topology"===i&&(0,I.jsx)(o.Suspense,{fallback:null,children:(0,I.jsx)(sn,{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)(Xt.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)(tn.A,{onRefresh:N,loading:g,testId:"preview-function-histogram",dataGa:"preview-function-histogram"})},hideToolbox:!0,nodeIds:l,fn:n}),M&&(0,I.jsx)(rn.A,{defaultCharts:h,charts:F,data:y,columns:b,groupByColumns:C,loaded:m,selectedFn:n,onRefresh:N,loading:g,compact:_,hideToolbox:!0}),O&&(0,I.jsx)(en.A,{customCharts:B,data:y,containerWidth:0,paramsKey:{extraKey:"preview"}}),_&&(0,I.jsx)(on.A,{title:(0,I.jsx)(tn.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"})})]})]})},dn={chart:vt,text:null,nodeGrid:Ct,nodeList:Nt,alertStatus:Dt,alertsPerNode:Mt,hourlyAlerts:Pt,nodeStats:qt,statsOverview:Vt,dataRetention:Ht,alertNodes:Yt,replicationStats:Zt,function:ln},cn=e=>{let{item:t}=e;const n=dn[t.type];return n?(0,I.jsx)(jt.Ay,{fallback:(0,I.jsx)(jt.dK,{canRetry:!1}),children:(0,I.jsx)(n,{item:t})}):null},un=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)(cn,{item:e},e.type+"-"+(e.context||e.config?.textType||e.config?.selectedFn||"")))})},hn=e=>{let{title:t}=e;return(0,I.jsx)(r.Text,{color:"text",fontSize:"12px",lineHeight:"16px",children:t})},xn=e=>{let{label:t="Import",onClick:n,disabled:o}=e;return(0,I.jsx)(r.Flex,{justifyContent:"end",padding:[4,0],children:(0,I.jsx)(r.Button,{label:t,onClick:n,disabled:o})})},pn={title:!1,subtitle:!1,body:!1},gn={title:r.H1,subtitle:r.H4,body:r.TextBig},mn=e=>{let{type:t,label:n,preview:o,checked:a,onToggle:s}=e;const l=gn[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:n})]}),(0,I.jsx)(l,{color:"textFocus",children:o})]})},yn=e=>{let{dashboardId:t,onPreviewChange:n}=e;const[a,s]=(0,o.useState)(pn),l=(0,H.Kv)(t),i=(0,d.WM)(),c=e=>s(t=>({...t,[e]:!t[e]}));(0,o.useEffect)(()=>{if(!n)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"}}),n(e)},[a,n]);const u=a.title||a.subtitle||a.body;return(0,I.jsxs)(r.Flex,{column:!0,gap:2,flex:!0,children:[(0,I.jsx)(hn,{title:"Titles and text"}),(0,I.jsxs)(r.Flex,{column:!0,gap:2.5,children:[(0,I.jsx)(mn,{type:"title",label:"Title",preview:"Heading 1",checked:a.title,onToggle:()=>c("title")}),(0,I.jsx)(mn,{type:"subtitle",label:"Subtitle",preview:"Heading 2",checked:a.subtitle,onToggle:()=>c("subtitle")}),(0,I.jsx)(mn,{type:"body",label:"Body",preview:"Lorem Ipsum",checked:a.body,onToggle:()=>c("body")})]}),(0,I.jsx)(xn,{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(pn),i(null),e&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=document.querySelector(`[data-id="${e}"]`);t&&t.scrollIntoView({behavior:"smooth",block:"nearest"})})})},disabled:!u})]})};n(23215);var bn=n(50694),fn=n(58243),jn=n(41061);const vn=(e,t,n)=>{const r=(0,p.Gt)(e),a=(0,h.ID)(),s=(0,bn.Jk)(a);return(0,o.useMemo)(()=>{if(t?.length>0)return t;const e=n?Object.entries(n).filter(e=>{let[,t]=e;return t?.length>0}):[];if(0===e.length)return[];return r.filter(t=>e.every(e=>{let[n,o]=e;if("selectedGroups"===n)return o.some(e=>{const n=jn.E9.find(t=>t.id===e);if(n)return n.showFn(t);const o=s?.find(t=>t.id===e);return!!o&&(0,fn.BW)(t,o.filters,o.selectedNodeIds)});if("nodeStatuses"===n)return o.includes(t.nodeStatus);if("nodeVersions"===n)return o.includes(t.version);if("nodeCapabilities"===n)return o.some(e=>t.capabilities&&e in t.capabilities);if("os.nm"===n)return o.includes(t.os?.nm);if(n.startsWith("label.")){const e=n.replace("label.","");return t.labels&&o.some(n=>{const[,o]=n.includes("|")?n.split("|",2):[e,n];return t.labels[e]===o})}return!0})).map(e=>e.id)},[r,t,n,s])},wn=e=>{let{label:t}=e;return(0,I.jsx)(r.Text,{color:"textLite",fontSize:"11px",lineHeight:"14px",children:t})};var kn=n(98054),Sn=n(33099),Cn=n(47427);const In=e=>{let{children:t,...n}=e;return(0,I.jsx)(r.Flex,{alignItems:"center",gap:2,padding:[1,2],cursor:"pointer",_hover:{background:"borderSecondary"},...n,children:t})},Tn=e=>{let{dashboardId:t,onPreviewChange:n}=e;const[a,s]=(0,o.useState)(new Set),[l,i]=(0,o.useState)(null),[c,u]=(0,o.useState)(null),[h,x]=(0,o.useState)([]),[p,g]=(0,o.useState)({}),m=(0,L.CK)(),y=vn(m,h,p),{menuIds:b,menuById:f,roomCharts:j}=(0,Sn.A)(y),v=(0,H.nM)(t),w=(0,d.WM)(),k=(0,Z.eg)();(0,o.useEffect)(()=>{if(!n)return;const e=setTimeout(()=>{const e=Array.from(a).filter(e=>j[e]).map(e=>({type:"chart",context:e,metadata:j[e],nodeIds:y}));n(e)},150);return()=>clearTimeout(e)},[a,y,j,n]);const S=(0,o.useMemo)(()=>c?b.filter(e=>{const t=f[e];return!!t&&t.contexts?.some(e=>c.has(e))}):b,[b,f,c]),C=(0,o.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,o.useCallback)(e=>{s(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),F=(0,o.useCallback)(()=>{const e=y.length>0?{nodesScope:y}:{},t=Array.from(a),n=t.length;let o=null;t.forEach((t,r)=>{const a=1===n||3===n&&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=>{o=e.id})}),s(new Set),w(null),o&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{const e=document.querySelector(`[data-id="${o}"]`);e&&e.scrollIntoView({behavior:"smooth",block:"nearest"})})})},[a,v,y,w,k]),N=(0,o.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)(hn,{title:"Metrics"}),(0,I.jsx)(wn,{label:"Select Nodes"}),(0,I.jsx)(B.A,{nodeIds:m,selectedNodeIds:h,setSelectedNodeIds:x,filters:p,setFilters:g}),(0,I.jsx)(wn,{label:"Select Metrics"}),(0,I.jsx)(Cn.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)(kn.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)(In,{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)(xn,{label:A?`Import (${a.size})`:"Import",onClick:F,disabled:!A})]})};var Fn=n(16373),Nn=n(7414);const An=e=>{let{value:t,onChange:n}=e;return(0,I.jsx)(r.TextInput,{value:t,onChange:e=>n(e.target.value),placeholder:"Search functions...",iconLeft:(0,I.jsx)(r.Icon,{name:"magnify",color:"textLite",size:"small"}),width:"100%",height:"32px"})};var Ln=n(15744),Bn=n(33479);const Dn=e=>e.name,_n=e=>e.slug,Mn=e=>e?e[0].toUpperCase()+e.slice(1):"",zn=(e,t)=>{const n=[];return e.forEach(e=>{const o=t[e];o?.isFunction?n.push(e):o?.descendantIds&&n.push(...o.descendantIds)}),n},On=(e,t)=>(t[e.value]={name:e.fullLabel||e.label,shortName:Mn(e.label),slug:e.value,isFunction:!0},e.value),En=(e,t)=>{const n=`group:${e.parent}`,o=[];return e.subgroups?.forEach(e=>o.push(En(e,t))),e.children?.forEach(e=>o.push(On(e,t))),t[n]={name:Mn(e.parent),childrenIds:o,descendantIds:zn(o,t)},n},Pn=(e,t)=>{const n=e.title.toLowerCase().replace(/\s+/g,"-"),o=[];return e.items.forEach(e=>{"group"===e.type?o.push(En(e.data,t)):"standalone"===e.type||"leaf"===e.type?o.push(On(e.data,t)):"category"===e.type&&o.push(Pn(e.data,t))}),t[n]={name:e.title,icon:e.icon,childrenIds:o,descendantIds:zn(o,t)},n},Un=(e,t)=>(0,o.useMemo)(()=>{const n=t?e.filter(e=>e.name.toLowerCase().includes(t.toLowerCase())):e,{categories:o,groups:r,standalone:a}=(0,Bn.GS)(n,_n,Dn,":",Ln.A),s={},l=[];return o.forEach(e=>l.push(Pn(e,s))),r.forEach(e=>l.push(En(e,s))),a.forEach(e=>l.push(On(e,s))),{menuIds:l,menuById:s}},[e,t]);var qn=n(84103);const Rn={type:"table"},$n=(e,t,n)=>{const[r,a]=(0,o.useState)({loading:!1,data:null,error:null}),s=(0,h.ID)(),l=(0,p.yN)(t),i=(0,o.useRef)(!1);return(0,o.useEffect)(()=>{if(!e)return void a({loading:!1,data:null,error:null});if("feed"===n)return void a({loading:!1,data:Rn,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 o=Date.now();return(0,qn.JJ)({roomId:s,cloudNodeIds:l,nodeIds:t,fn:e,after:o-9e5,before:o,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 Gn=n(380);const Vn=e=>{let{flowView:t,onFlowViewChange:n,visibleItems:a,onVisibleItemsChange:s}=e;const l=(0,o.useCallback)(e=>{const t=e.target.value,o=(0,Nn.l3)(t);n(t),s(o.visibleItems)},[n,s]);Nn.KC.find(e=>e.id===t)||Nn.KC[0];return(0,I.jsx)(r.Flex,{column:!0,gap:2,children:Nn.KC.map(e=>{const n=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:n,onChange:l}),n&&e.items.length>1&&(0,I.jsx)(r.Flex,{padding:[0,0,0,6],children:(0,I.jsx)(Gn.A,{items:e.items,selected:a||[],onChange:s})})]},e.id)})})},Kn=e=>{let{flavour:t,functionInfo:n,flowView:o,visibleItems:r,onFlowViewChange:a,onVisibleItemsChange:s}=e;if("flows"===n?.type)return(0,I.jsx)(Vn,{flowView:o,onFlowViewChange:a,visibleItems:r,onVisibleItemsChange:s});const l=(0,Nn.nV)(n,t);return l.length<=1?null:(0,I.jsx)(Gn.A,{items:l,selected:r||[],onChange:s})},Hn={fn:"Live",logs:"Logs",feed:"Events"},Wn={fn:"Select Function",logs:"Logs Viewer",feed:"Select Event"},Qn=e=>{let{flavour:t,dashboardId:n,onPreviewChange:a}=e;const[s,l]=(0,o.useState)([]),[i,c]=(0,o.useState)({}),[u,h]=(0,o.useState)(""),[x,p]=(0,o.useState)(null),[g,m]=(0,o.useState)(null),[y,b]=(0,o.useState)(null),[f,j]=(0,o.useState)({}),v="feed"===t,w=(0,L.CK)();(0,o.useEffect)(()=>{!v&&0===s.length&&w.length>0&&l([w[0]])},[v,w]);const k=vn(w,s,i),{loaded:S,value:C}=(0,Fn.vx)({},t),T=(0,o.useMemo)(()=>k.length?C.filter(e=>k.some(t=>e.nodes?.[t])):C,[C,k]),{menuIds:F,menuById:N}=Un(T,u),A=F.length>1||!!N[F[0]]?.childrenIds?.length;(0,o.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)(n),_=(0,d.WM)(),M="feed"!==t,z=k.length>0,O=z||M?k:w,{loading:E,data:P}=$n(x,O,t);(0,o.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,o.useCallback)(e=>{p(t=>t===e?null:e),m(null),b(null),j({})},[]);(0,o.useEffect)(()=>{if(!P?.type)return;const e=(0,Nn.Om)(P.type);m(e.flowView||null),b(e.visibleItems)},[x,P?.type]);const q=!!x&&!!P&&!E&&(!M||z),R=(0,o.useCallback)(()=>{if(!q)return;const e=D({dashboardId:n,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,n,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)(hn,{title:Hn[t]||"Live"}),(0,I.jsx)(wn,{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)(hn,{title:Hn[t]||"Live"}),"feed"!==t&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(wn,{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)(wn,{label:"Search"}),(0,I.jsx)(An,{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)(wn,{label:Wn[t]||"Select Function"}),F.length>0?(0,I.jsx)(kn.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)(Kn,{flavour:t,functionInfo:P,flowView:g,visibleItems:y,onFlowViewChange:m,onVisibleItemsChange:b})]})]})]}),(0,I.jsx)(xn,{label:"Import",onClick:R,disabled:!q})]})};n(30670),n(71517),n(11379),n(93777),n(14190),n(12359),n(86097),n(17273),n(27415),n(19929),n(37583),n(55122),n(20230),n(57268),n(79733);const Yn=e=>{let{children:t,...n}=e;return(0,I.jsx)(r.Flex,{column:!0,round:1,overflow:"hidden",border:{side:"all",color:"borderSecondary"},background:"mainBackground",...n,children:t})},Jn="nodeGrid",Zn="nodeList",Xn="alertStatus",eo="alertsPerNode",to="hourlyAlerts",no={Live:"success",Stale:"warning",Offline:"textLite",Unseen:"textDescription"},oo=e=>{let{nodeStatusCounts:t}=e;if(0===Object.values(t).reduce((e,t)=>e+t,0))return(0,I.jsx)(Yn,{padding:[2],children:(0,I.jsx)(r.Text,{color:"textLite",fontSize:"10px",children:"No nodes"})});const n=Object.entries(t).flatMap(e=>{let[t,n]=e;return Array.from({length:n},(e,n)=>({key:`${t}-${n}`,color:no[t]}))});return(0,I.jsx)(Yn,{padding:[2],children:(0,I.jsx)(r.Flex,{gap:1,flexWrap:!0,children:n.slice(0,96).map(e=>{let{key:t,color:n}=e;return(0,I.jsx)(r.Flex,{width:"8px",height:"8px",round:"50%",background:n},t)})})})},ro=e=>{let{nodes:t}=e;const n=t.slice(0,4);return 0===n.length?(0,I.jsx)(Yn,{children:(0,I.jsx)(r.Text,{color:"textLite",fontSize:"10px",padding:[1],children:"No nodes"})}):(0,I.jsxs)(Yn,{children:[n.map((e,t)=>(0,I.jsxs)(r.Flex,{alignItems:"center",padding:[1],gap:2,border:t<n.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:no[(0,It.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"]})})]})},ao=e=>{let{alertCounts:t}=e;return(0,I.jsx)(Yn,{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})]})]})})},so=e=>{let{alertsByNode:t}=e;const n=t.slice(0,3);return 0===n.length?(0,I.jsx)(Yn,{padding:[2],children:(0,I.jsx)(r.Text,{color:"textLite",fontSize:"10px",children:"No alerts"})}):(0,I.jsxs)(Yn,{padding:[2],children:[n.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"]})]})},lo=e=>{let{buckets:t}=e;const n=Math.max(1,...t.map(e=>e.critical+e.warning));return(0,I.jsx)(Yn,{padding:[2],children:(0,I.jsx)(r.Flex,{alignItems:"end",justifyContent:"center",gap:1,height:"50px",children:t.map((e,t)=>{const o=e.critical+e.warning,a=Math.max(2,Math.round(o/n*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)})})})},io=e=>{let{nodeStatusCounts:t}=e;const n=Object.values(t).reduce((e,t)=>e+t,0);return(0,I.jsxs)(Yn,{padding:[2],children:[(0,I.jsx)(r.Flex,{justifyContent:"space-around",children:Object.entries(no).map(e=>{let[n,o]=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:o}),(0,I.jsx)(r.Text,{fontSize:"10px",children:t[n]||0})]},n)})}),n>0&&(0,I.jsx)(r.Flex,{justifyContent:"center",margin:[1,0,0,0],children:(0,I.jsxs)(r.Text,{fontSize:"9px",color:"textLite",children:[n," nodes"]})})]})},co=e=>{let{children:t,...n}=e;return(0,I.jsx)(r.Flex,{column:!0,gap:2,flex:!0,width:{min:0},...n,children:t})},uo=e=>{let{label:t,checked:n,onToggle:o}=e;return(0,I.jsx)(r.Checkbox,{checked:n,onChange:o,label:t})},ho=e=>{let{dashboardId:t,onPreviewChange:n}=e;const[a,s]=(0,o.useState)([]),[l,i]=(0,o.useState)({}),[c,u]=(0,o.useState)(new Set),[h,x]=(0,o.useState)({nodeStats:[]}),g=(0,L.CK)(),m=vn(g,a,l),y=(0,p.Gt)(g),b=(0,At.s)("ids")||[],f=(0,Lt.Gq)(b),j=(0,o.useMemo)(()=>{if(0===m.length)return y;const e=new Set(m);return y.filter(t=>e.has(t.id))},[y,m]),v=(0,o.useMemo)(()=>{const e={Live:0,Stale:0,Offline:0,Unseen:0};return j.forEach(t=>{const n=(0,It.GM)(t.state);e[n]=(e[n]||0)+1}),e},[j]),w=(0,o.useMemo)(()=>{if(0===m.length)return f;const e=new Set(m);return f.filter(t=>e.has(t.nodeId))},[f,m]),k=(0,o.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,o.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[n,o]=e;return{nodeId:n,name:t.get(n)||n,...o}}).sort((e,t)=>1e3*t.critical+t.warning-(1e3*e.critical+e.warning))},[w,j]),C=(0,o.useMemo)(()=>{const e=Array.from({length:24},()=>({critical:0,warning:0}));return w.forEach(t=>{if(!t.lastUpdated)return;const n=new Date(1e3*t.lastUpdated).getHours();"critical"===t.status&&e[n].critical++,"warning"===t.status&&e[n].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,o.useCallback)(e=>{u(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),O=(0,o.useCallback)((e,t)=>{x(n=>({...n,[e]:t}))},[]),E=(0,o.useCallback)(()=>{const e=m.length>0?{selectedNodeIds:m}:{};let t=null;c.forEach(n=>{switch(n){case Jn:t=F(e);break;case Zn:t=N(e);break;case Xn:t=A(e);break;case eo:t=D(e);break;case to: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,o.useEffect)(()=>{if(!n)return;if(!P)return void n([]);const e=[...c].map(e=>({type:e,config:{selectedNodeIds:m}}));h.nodeStats.length>0&&e.push({type:"nodeStats",config:{selectedNodeIds:m,visibleItems:h.nodeStats}}),n(e)},[P,c,h,m,n]),(0,I.jsxs)(r.Flex,{column:!0,height:"100%",overflow:"hidden",children:[(0,I.jsx)(hn,{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)(co,{children:[(0,I.jsx)(uo,{label:"Node grid",checked:c.has(Jn),onToggle:()=>z(Jn)}),(0,I.jsx)(oo,{nodeStatusCounts:v})]}),(0,I.jsxs)(co,{children:[(0,I.jsx)(uo,{label:"Node List",checked:c.has(Zn),onToggle:()=>z(Zn)}),(0,I.jsx)(ro,{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)(co,{children:[(0,I.jsx)(uo,{label:"Alert Status",checked:c.has(Xn),onToggle:()=>z(Xn)}),(0,I.jsx)(ao,{alertCounts:k})]}),(0,I.jsxs)(co,{children:[(0,I.jsx)(uo,{label:"Alerts per Node",checked:c.has(eo),onToggle:()=>z(eo)}),(0,I.jsx)(so,{alertsByNode:S})]})]}),(0,I.jsxs)(co,{children:[(0,I.jsx)(uo,{label:"Hourly Alerts",checked:c.has(to),onToggle:()=>z(to)}),(0,I.jsx)(lo,{buckets:C})]})]}),(0,I.jsx)(Gn.f,{label:"Node Stats",items:Nn.Qu.nodeStats,selected:h.nodeStats,onChange:e=>O("nodeStats",e),children:(0,I.jsx)(io,{nodeStatusCounts:v})})]}),(0,I.jsx)(xn,{label:"Import",onClick:E,disabled:!P})]})},xo="dataRetention",po=()=>(0,I.jsx)(Yn,{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"})]})]})}),go=e=>{let{alertsByNode:t}=e;const n=t.slice(0,3);return(0,I.jsxs)(Yn,{padding:[2],children:[(0,I.jsx)(r.Flex,{alignItems:"end",justifyContent:"center",gap:1,height:"30px",children:n.map(e=>{const t=e.critical+e.warning,o=Math.max(1,...n.map(e=>e.critical+e.warning)),a=Math.max(4,Math.round(t/o*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===n.length&&(0,I.jsx)(r.Text,{fontSize:"10px",color:"textLite",children:"No alerts"})]})},mo=()=>(0,I.jsx)(Yn,{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))})}),yo=()=>(0,I.jsx)(Yn,{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"})]})]})}),bo=e=>{let{children:t,...n}=e;return(0,I.jsx)(r.Flex,{column:!0,gap:2,flex:!0,width:{min:0},...n,children:t})},fo=e=>{let{label:t,checked:n,onToggle:o}=e;return(0,I.jsx)(r.Checkbox,{checked:n,onChange:o,label:t})},jo=e=>{let{dashboardId:t,onPreviewChange:n}=e;const[a,s]=(0,o.useState)(new Set),[l,i]=(0,o.useState)({statsOverview:[],alertNodes:[],replicationStats:[]}),c=(0,L.CK)(),u=(0,p.Gt)(c),h=(0,At.s)("ids")||[],x=(0,Lt.Gq)(h),g=(0,o.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[n,o]=e;return{nodeId:n,name:t.get(n)||n,...o}}).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,o.useCallback)(e=>{s(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),w=(0,o.useCallback)((e,t)=>{i(n=>({...n,[e]:t}))},[]),k=Object.values(l).some(e=>e.length>0),S=a.size>0||k;(0,o.useEffect)(()=>{if(!n)return;if(!S)return void n([]);const e=Array.from(a).map(e=>({type:e,config:{}}));Object.entries(l).forEach(t=>{let[n,o]=t;o.length>0&&e.push({type:n,config:{visibleItems:o}})}),n(e)},[S,a,l,n]);const C=(0,o.useCallback)(()=>{let e=null;a.forEach(t=>{if(t===xo)e=b({})}),Object.entries(l).forEach(t=>{let[n,o]=t;if(0===o.length)return;const r={statsOverview:y,alertNodes:f,replicationStats:j}[n];r&&(e=r({visibleItems:o}))}),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)(hn,{title:"Room Overview"}),(0,I.jsxs)(r.Flex,{column:!0,flex:!0,overflow:"auto",padding:[3],gap:4,children:[(0,I.jsx)(Gn.f,{label:"Stats Overview",items:Nn.Qu.statsOverview,selected:l.statsOverview,onChange:e=>w("statsOverview",e),children:(0,I.jsx)(po,{})}),(0,I.jsx)(Gn.f,{label:"Alert Nodes",items:Nn.Qu.alertNodes,selected:l.alertNodes,onChange:e=>w("alertNodes",e),children:(0,I.jsx)(go,{alertsByNode:g})}),(0,I.jsxs)(bo,{children:[(0,I.jsx)(fo,{label:"Data Retention",checked:a.has(xo),onToggle:()=>v(xo)}),(0,I.jsx)(mo,{})]}),(0,I.jsx)(Gn.f,{label:"Replication",items:Nn.Qu.replicationStats,selected:l.replicationStats,onChange:e=>w("replicationStats",e),children:(0,I.jsx)(yo,{})})]}),(0,I.jsx)(xn,{label:"Import",onClick:C,disabled:!S})]})},vo={[it]:yn,[dt]:Tn,[ct]:e=>(0,I.jsx)(Qn,{...e,flavour:"fn"}),[ut]:e=>(0,I.jsx)(Qn,{...e,flavour:"logs"}),[ht]:e=>(0,I.jsx)(Qn,{...e,flavour:"feed"}),[xt]:ho,[pt]:jo},wo={[it]:718,[dt]:680,[ct]:680,[ut]:680,[ht]:680,[xt]:680,[pt]:680},ko={top:"top",left:"right"},So=(0,U.default)(r.Flex).withConfig({displayName:"palette__AnimatedContainer",componentId:"sc-112dxl5-0"})(["transition:width 0.2s ease-out;max-width:calc(100vw - 200px);"]),Co=e=>{let{panelId:t,dashboardId:n,targetRef:a,onClose:s}=e;const[l,i]=(0,o.useState)([]),d=(0,o.useMemo)(()=>vo[t],[t]),c=wo[t]||680,u=l.length>0,h=l.some(e=>{const{fnType:t,flowView:n}=e.config||{};return"topology"===t||!("flows"!==t||!n||"table-sankey"===n)})?640:420;const x=u?c+h:c;return d&&a.current?(0,I.jsx)(r.Drop,{align:ko,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)(So,{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:n,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)(un,{items:l})})]})}):null},Io=e=>{let{dashboardId:t}=e;const n=(0,d.wz)(),a=(0,d.WM)(),s=(0,o.useRef)(null),l=(0,o.useCallback)(()=>a(null),[]);return(0,I.jsxs)(r.Flex,{ref:s,height:"100%",children:[(0,I.jsx)(ft,{}),n===gt&&(0,I.jsx)(E,{dashboardId:t,onClose:l}),n&&n!==gt&&(0,I.jsx)(Co,{panelId:n,dashboardId:t,targetRef:s,onClose:l},n)]})},To=()=>((0,Ne.A)(),null),Fo=(0,o.memo)(e=>{let{id:t,roomId:n,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,o.useRef)(!1);(0,o.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,o.useState)(!1);(0,o.useEffect)(()=>{g&&v.state?.showDuplicateWizard&&(S(!0),w(v.pathname,{replace:!0,state:{}}))},[g]);const C=(0,o.useCallback)(()=>S(!0),[]),T=(0,o.useCallback)(()=>S(!1),[]);(e=>{const t=(0,i.zN)(e),n=(0,d.tD)();$e(Ge,n&&!t)})(t);const[F,{width:N}]=(0,l.A)(),[A,L]=(0,Ae.N9)("chartName",{key:n,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)(Rt.Ay,{children:(0,I.jsxs)(Le.A,{getObject:D,ids:B,getMenu:Me,extraKey:t,children:[(0,I.jsx)(To,{}),!h&&b&&(0,I.jsx)(Io,{dashboardId:t}),(0,I.jsxs)(Fe.A,{ref:F,overflow:"hidden",background:"mainBackground",padding:[0,4],children:[!h&&(0,I.jsx)(st,{id:t,isEditMode:b,onOpenDuplicateWizard:C}),g&&m.length>0&&(0,I.jsx)($,{active:b&&!h,children:(0,I.jsx)(lt.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})]})]})})})}),No=(0,o.memo)(e=>{let{id:t,isOnTV:n}=e;const o=(0,h.ID)(),r=(0,x.w7)({extraKey:"dashboard",merge:!1,scoped:!0}),a=(0,p.TG)(r);return(0,I.jsx)(Fo,{id:t,roomId:o,nodeIds:a,isOnTV:n})})},1623(e,t,n){n.d(t,{A:()=>a});var o=n(63474),r=n(74848);const a=()=>(0,r.jsx)(o.O2,{"data-testid":"dashboardLoading"})}}]);