File: //opt/netdata/usr/local/share/netdata/web/v3/2711.478ade91e25f8200342c.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:"0725d67f2585acd82a0d73d488b6cd9060c3224d"};var a=(new e.Error).stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="b1088c82-acbb-44ac-8903-6255533d0c94",e._sentryDebugIdIdentifier="sentry-dbid-b1088c82-acbb-44ac-8903-6255533d0c94")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[2711],{57738(e,a,t){t.d(a,{L:()=>y});t(98992),t(8872);var o=t(96540),s=t(76667),n=t(30569),d=t(63872),l=t(19186),i=t(10602),r=t(24609),c=t(30731),h=t(92726),u=t(67294),b=t(45706),m=t(3319);const g=e=>"function"===e.type&&"feed"===e.flavour,p=(e,a)=>{const t=a[0]||null;return Object.entries(e).reduce((e,a)=>{let[o,s]=a;const{pristine:n,data:d,columns:l,aggregations:i,aggregatedView:r,acceptedParams:c,requiredParams:h,...u}=s;return"chart"===u.type?e[o]={...u,nodesScope:[]}:(e=>"function"===e.type&&!g(e))(u)?e[o]={...u,selectedNodeIds:t?[t]:[]}:g(u)?e[o]={...u,selectedNodeIds:[]}:e[o]="selectedNodeIds"in u?{...u,selectedNodeIds:[]}:u,e},{})},y=()=>{const e=(0,s.Zp)(),[a,t]=(0,d.A)(),g=(0,r.vt)(),y=(0,l.ID)(),f=(0,r.bq)(),x=(0,l.QW)(),w=(0,i.CK)(),D=(0,i.nj)(),{sendLog:A}=(0,m.A)();return(0,n.yF)((0,o.useCallback)(async(o,s,n)=>{if(D)try{const{data:t}=await(0,c.f7)(g,y,n),{layout:o,containerIds:d,containers:l,cards:i,dashboard:r}=(0,b.S)(t),m=p(i,w),D=`Copy of ${r.name}`,{data:j}=await(0,c.k9)(g,y,{name:D}),C={version:j.version+1||2,snapshot:{uiState:{layout:o,containerIds:d,containers:l,cards:m,respectNodesScope:r.respectNodesScope,duplicate:{id:n}}}};await(0,c.mQ)(g,y,j.id,C),s((0,h._d)(j.id),{name:D,...C,spaceId:g,roomId:y,...j,loaded:!0}),s((0,u.hZ)(y),{...j,spaceId:g,roomId:y}),A({feature:"DuplicatedCustomDashboard",isSuccess:!0,dashboardId:j.id}),a({header:"Dashboards",text:"Dashboard duplicated!"}),e(`/spaces/${f}/rooms/${x}/dashboards/${j.slug}`,{state:{showDuplicateWizard:!0}})}catch(d){t(d)}else t({header:"Dashboards",text:"Please wait for nodes to finish loading."})},[g,y,f,x,w,D,e,a,t,A]))}},82711(e,a,t){t.r(a),t.d(a,{default:()=>W});var o=t(78904),s=t(6304),n=t(41579),d=t(67294),l=t(96540),i=t(76667),r=t(32788),c=t(29263),h=t(47410),u=t(16866),b=t(19186),m=t(24609),g=t(5907),p=t(82418),y=t(38757),f=t(882);const x=f.default.img.withConfig({displayName:"styled__Illustration",componentId:"sc-1yhntgl-0"})(["margin:0 auto;"]),w=(0,f.default)(o.Text).withConfig({displayName:"styled__StyledText",componentId:"sc-1yhntgl-1"})(["display:block;"]),D=f.default.div.withConfig({displayName:"styled__TextHeader",componentId:"sc-1yhntgl-2"})(["margin-bottom:",";font-weight:700;"],(0,o.getSizeBy)(2)),A=f.default.div.withConfig({displayName:"styled__StaticCheckmarks",componentId:"sc-1yhntgl-3"})(["margin-top:",";margin-bottom:",";"],(0,o.getSizeBy)(2),(0,o.getSizeBy)(5)),j=f.default.div.withConfig({displayName:"styled__CheckmarkLine",componentId:"sc-1yhntgl-4"})(["display:flex;align-items:center;"]),C=(0,f.default)(o.Icon).withConfig({displayName:"styled__StyledIcon",componentId:"sc-1yhntgl-5"})(["margin-right:4px;height:18px;> use{fill:",";}"],(0,o.getColor)("primary")),T=(0,f.default)(C).withConfig({displayName:"styled__HelpIcon",componentId:"sc-1yhntgl-6"})(["vertical-align:middle;"]),I=f.default.div.withConfig({displayName:"styled__LearnMoreSection",componentId:"sc-1yhntgl-7"})(["margin-top:",";"],(0,o.getSizeBy)(4)),k=f.default.a.withConfig({displayName:"styled__Link",componentId:"sc-1yhntgl-8"})(["text-decoration:underline;color:",";&:visited{color:",";}"],(0,o.getColor)("success"),(0,o.getColor)("success"));var S=t(74848);const v=e=>{let{onClose:a}=e;const t=(0,i.Zp)(),[s,n]=(0,l.useState)(!1),[d,f]=(0,l.useState)(""),{id:v,slug:_}=(0,m.ap)(),L=(0,b.ID)(),N=(0,b.QW)(),$=(0,l.useCallback)(e=>{let{slug:o}=e;a(),t(`/spaces/${_}/rooms/${N}/dashboards/${o}`)},[_,N]),F=(0,g.Dn)(v,L,{onSuccess:$}),M=(0,l.useCallback)(()=>F({name:d}),[d]),V=d.length>0;return(0,S.jsxs)(r.GO,{onClose:a,children:[(0,S.jsx)(c.z,{onClose:a,title:"New Dashboard",children:(0,S.jsx)(o.Button,{label:"Add",icon:"plus",onClick:M,"data-testid":"addNewDashboardModal-add-button"})}),(0,S.jsx)(h.U,{children:"Create new Dashboard"}),(0,S.jsxs)(r.Yv,{children:[(0,S.jsx)(y.A,{value:d,label:"Name",onChange:e=>{f(e.target.value)},isValid:s,setIsValid:n,isDirty:V,instantFeedback:"all",onKeyDown:e=>e.keyCode===u.I7&&s&&M,"data-testid":"addNewDashboardModal-dashboardName-input",containerStyles:{flex:{grow:0,shrink:0},margin:[0,0,4,0]}}),(0,S.jsxs)(w,{children:[(0,S.jsx)(D,{children:"What can you do with Dashboards?"}),"Combine all the metrics that matter to you, from all the nodes that matter to you, into one clean interface that helps you visually detect anomalies as they\u2019re happening. Building a new dashboard will only take a few minutes, and the metrics are always real-time."]}),(0,S.jsxs)(A,{children:[(0,S.jsxs)(j,{children:[(0,S.jsx)(C,{name:"check"}),(0,S.jsx)(o.Text,{children:"Add charts from your infrastructure"})]}),(0,S.jsxs)(j,{children:[(0,S.jsx)(C,{name:"check"}),(0,S.jsx)(o.Text,{children:"Group information in a meaningful way"})]}),(0,S.jsxs)(I,{children:[(0,S.jsx)(T,{name:"help"}),(0,S.jsx)(o.Text,{children:"Learn more about Dashboards"})," ",(0,S.jsx)(k,{href:"https://learn.netdata.cloud/docs/dashboards-and-charts/",target:"_blank",rel:"noopener noreferrer",children:"In our documentation"})]})]}),(0,S.jsx)(x,{src:p.$})]})]})};var _=t(63474),L=t(63950),N=t.n(L),$=(t(74423),t(98992),t(81454),t(37550),t(51262)),F=t(39175);const M=e=>{let{handleOpenAddDashboardModal:a,hasPermissionToAddDashboard:t,hasPermissionToDeleteDashboard:o,refetch:s,duplicateDashboard:n}=e;const i=(0,b.GJ)(),r=(0,b.XA)("name"),c=(0,g.Ts)(),h=(0,d.q)(),u=(0,l.useMemo)(()=>h.some(e=>e===F.LA),[h]),{hasLimitations:m,maxDashboards:p}=(0,$.A)(),y=t&&!(m&&h.length-(u?1:0)>=p),f=async(e,a)=>{const t=(Array.isArray(e)?e:[e]).map(e=>{let{id:a}=e;return a});await c({ids:t},{onSuccess:()=>a.toggleAllRowsSelected(!1)}),s()},x=(0,l.useMemo)(()=>({duplicate:{icon:"copy",handleAction:e=>n(e.id),tooltipText:"Duplicate dashboard",confirmLabel:"Duplicate",confirmationMessage:e=>`A new dashboard named "Copy of ${e.name}" 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.`,confirmationTitle:e=>`Duplicate ${e.name}`,declineLabel:"Cancel",isDisabled:()=>!y,disabledTooltipText:t?`Your plan does not allow you to create more than ${p} dashboards.`:"You don't have permission to create dashboards"},delete:{confirmLabel:"Yes, delete",confirmationMessage:e=>(0,S.jsxs)(S.Fragment,{children:["You are about to delete ",(0,S.jsx)("strong",{children:e.name})," from ",(0,S.jsx)("strong",{children:r}),".",(0,S.jsx)("br",{}),"Are you sure you want to continue?"]}),confirmationTitle:e=>`Delete ${e.name}`,declineLabel:"Cancel",handleAction:f,tooltipText:"Delete dashboard",isDisabled:e=>!o||i&&e.id===F.LA,disabledTooltipText:o?"Local dashboard cannot be deleted":"Only admins can delete"}}),[o,y,n,p,t]),w=(0,l.useMemo)(()=>({addEntry:{handleAction:a,isVisible:t,tooltipText:"Create dashboard",disabledTooltipText:`Your plan does not allow you to create more than ${p} dashboards.`,disabled:m&&h.length-(u?1:0)>=p},delete:{confirmLabel:"Yes, delete",confirmationMessage:(e,a)=>(0,S.jsxs)(S.Fragment,{children:["You are about to delete"," ",(0,S.jsx)("strong",{children:a.length>1?`${a.length} dashboards`:a[0].name})," ","from ",(0,S.jsx)("strong",{children:r}),".",(0,S.jsx)("br",{}),"Are you sure you want to continue?"]}),confirmationTitle:()=>"Delete",disabledTooltipText:"Delete is disabled because you haven't selected dashboards",declineLabel:"Cancel",handleAction:f,tooltipText:"Delete dashboards",isVisible:o}}));return{rowActions:o||y?x:[],bulkActions:[t,o].some(Boolean)?w:[]}};var V=t(92726),Y=t(45087);const O=e=>{let a=new Date(e);a=a.getTime()===a.getTime()?a:new Date;const[,t,o,s]=a.toDateString().split(" ");return`${t} ${o}, ${s}`};var B=t(79748);const P=e=>{let{name:a}=e;return(0,S.jsxs)(o.Flex,{width:"300px",column:!0,gap:1,children:[(0,S.jsx)(o.Text,{strong:!0,children:"Locked!"}),(0,S.jsxs)(o.Text,{children:["The dashboard ",(0,S.jsx)(o.Text,{strong:!0,children:a})," is locked."]}),(0,S.jsx)(o.Text,{children:"Your plan is limited to 1 dashboard. You can delete some dashboards or upgrade your plan for no limitations."})]})},z=e=>{let{getValue:a,row:t}=e;const s="notAvailable"==t?.original?.state,n=a();return s?(0,S.jsx)(Y.A,{content:(0,S.jsx)(P,{name:n}),align:"bottom",isBasic:!0,children:(0,S.jsxs)(o.Flex,{alignItems:"center",children:[(0,S.jsx)(o.Text,{children:n}),(0,S.jsx)(o.Icon,{name:"padlock",height:"12px",color:"text"})]})}):(0,S.jsx)(B.A,{as:"Link",to:t.original.slug,children:n})};var E=t(99728),K=t(57738);const G=e=>{let{refetch:a,handleOpenAddDashboardModal:t}=e;const[,s]=(0,l.useState)(),n=(0,d.q)(),i=(0,V.Sf)(n),r=(0,E.JT)("dashboard:Create"),c=(0,E.JT)("dashboard:Delete"),h=(0,K.L)(),u=(0,l.useMemo)(()=>[{id:"name",accessorKey:"name",header:"Name",cell:z},{id:"updatedAt",accessorKey:"updatedAt",header:"Last modified",cell:e=>{let{getValue:a}=e;return(0,S.jsx)(o.TextSmall,{children:O(a())})},sortingFn:"datetime"},{id:"createdAt",accessorKey:"createdAt",header:"Created",cell:e=>{let{getValue:a}=e;return(0,S.jsx)(o.TextSmall,{children:O(a())})},sortingFn:"datetime"}],[]),{rowActions:b,bulkActions:m}=M({dashboards:i,handleOpenAddDashboardModal:t,hasPermissionToAddDashboard:r,hasPermissionToDeleteDashboard:c,refetch:a,duplicateDashboard:h});return{rowActions:b,bulkActions:m,data:i,enableSelection:c,columns:u,enableSorting:!0,globalFilterFn:(0,l.useCallback)((e,a,t)=>{const o=t?.toLowerCase?.(),s=e.getValue("name")?.toLowerCase?.(),n=`${O(e.getValue("updatedAt"))?.toLowerCase?.()}`,d=`${O(e.getValue("createdAt"))?.toLowerCase?.()}`;return s.includes(o)||n.includes(o)||d.includes(o)},[]),setGlobalFilter:s}},q=[{id:"updatedAt",desc:!0}],Q=e=>{let{refetch:a=N(),handleOpenAddDashboardModal:t}=e;const{enableSelection:s,columns:n,data:d,rowActions:l,bulkActions:i,enableSorting:r,globalFilterFn:c,setGlobalFilter:h}=G({refetch:a,handleOpenAddDashboardModal:t});return(0,S.jsx)(o.Table,{rowActions:l,enableSelection:s,data:d,dataColumns:n,bulkActions:i,enableSorting:r,globalFilterFn:c,onSearch:h,testPrefixCallback:e=>e.name,sortBy:q,title:"Dashboards"})};var R=t(60908);const W=()=>{const e=(0,n.A)(),[a,,t,l]=(0,s.A)(!1);return(0,d.RQ)()?(0,S.jsx)(R.Ay,{feature:"DashboardOverview",children:(0,S.jsxs)(o.Flex,{position:"relative",width:"100%",height:"100%",flex:"1",column:!0,padding:[3,3,0],overflow:"hidden",children:[(0,S.jsx)(Q,{refetch:e,handleOpenAddDashboardModal:t}),a&&(0,S.jsx)(v,{onClose:l})]})}):(0,S.jsx)(_.Ki,{})}}}]);