File: //opt/netdata/usr/local/local/share/netdata/web/v3/2711.2901ed84c3d74d5669b1.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:"add58d114229f0c7996ebd9e09ce63888b5394f2"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d923d259-438e-4f4e-bf11-590864082443",e._sentryDebugIdIdentifier="sentry-dbid-d923d259-438e-4f4e-bf11-590864082443")}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[2711],{57738(e,t,a){a.d(t,{L:()=>D});var o=a(64467),n=a(80045),s=(a(98992),a(54520),a(3949),a(8872),a(62953),a(96540)),d=a(41344),l=a(30569),r=a(63872),i=a(19186),c=a(10602),h=a(24609),u=a(30731),b=a(92726),m=a(67294),g=a(45706),p=a(3319);const f=["pristine","data","columns","aggregations","aggregatedView","acceptedParams","requiredParams"];function y(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,o)}return a}function x(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?y(Object(a),!0).forEach((function(t){(0,o.A)(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):y(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const w=e=>"function"===e.type&&"feed"===e.flavour,j=(e,t)=>{const a=t[0]||null;return Object.entries(e).reduce(((e,t)=>{let[o,s]=t;const{pristine:d,data:l,columns:r,aggregations:i,aggregatedView:c,acceptedParams:h,requiredParams:u}=s,b=(0,n.A)(s,f);return"chart"===b.type?e[o]=x(x({},b),{},{nodesScope:[]}):(e=>"function"===e.type&&!w(e))(b)?e[o]=x(x({},b),{},{selectedNodeIds:a?[a]:[]}):w(b)?e[o]=x(x({},b),{},{selectedNodeIds:[]}):e[o]="selectedNodeIds"in b?x(x({},b),{},{selectedNodeIds:[]}):b,e}),{})},D=()=>{const e=(0,d.Zp)(),[t,a]=(0,r.A)(),o=(0,h.vt)(),n=(0,i.ID)(),f=(0,h.bq)(),y=(0,i.QW)(),w=(0,c.CK)(),D=(0,c.nj)(),{sendLog:A}=(0,p.A)();return(0,l.yF)((0,s.useCallback)((async(s,d,l)=>{if(D)try{const{data:a}=await(0,u.f7)(o,n,l),{layout:s,containerIds:r,containers:i,cards:c,dashboard:h}=(0,g.S)(a),p=j(c,w),D="Copy of ".concat(h.name),{data:v}=await(0,u.k9)(o,n,{name:D}),C={version:v.version+1||2,snapshot:{uiState:{layout:s,containerIds:r,containers:i,cards:p,respectNodesScope:h.respectNodesScope,duplicate:{id:l}}}};await(0,u.mQ)(o,n,v.id,C),d((0,b._d)(v.id),x(x(x({name:D},C),{},{spaceId:o,roomId:n},v),{},{loaded:!0})),d((0,m.hZ)(n),x(x({},v),{},{spaceId:o,roomId:n})),A({feature:"DuplicatedCustomDashboard",isSuccess:!0,dashboardId:v.id}),t({header:"Dashboards",text:"Dashboard duplicated!"}),e("/spaces/".concat(f,"/rooms/").concat(y,"/dashboards/").concat(v.slug),{state:{showDuplicateWizard:!0}})}catch(r){a(r)}else a({header:"Dashboards",text:"Please wait for nodes to finish loading."})}),[o,n,f,y,w,D,e,t,a,A]))}},82711(e,t,a){a.r(t),a.d(t,{default:()=>J});a(62953);var o=a(42358),n=a(6304),s=a(41579),d=a(67294),l=a(96540),r=a(41344),i=a(32788),c=a(29263),h=a(47410),u=a(16866),b=a(19186),m=a(24609),g=a(5907),p=a(82418),f=a(38757),y=a(51510);const x=y.default.img.withConfig({displayName:"styled__Illustration",componentId:"sc-1yhntgl-0"})(["margin:0 auto;"]),w=(0,y.default)(o.Text).withConfig({displayName:"styled__StyledText",componentId:"sc-1yhntgl-1"})(["display:block;"]),j=y.default.div.withConfig({displayName:"styled__TextHeader",componentId:"sc-1yhntgl-2"})(["margin-bottom:",";font-weight:700;"],(0,o.getSizeBy)(2)),D=y.default.div.withConfig({displayName:"styled__StaticCheckmarks",componentId:"sc-1yhntgl-3"})(["margin-top:",";margin-bottom:",";"],(0,o.getSizeBy)(2),(0,o.getSizeBy)(5)),A=y.default.div.withConfig({displayName:"styled__CheckmarkLine",componentId:"sc-1yhntgl-4"})(["display:flex;align-items:center;"]),v=(0,y.default)(o.Icon).withConfig({displayName:"styled__StyledIcon",componentId:"sc-1yhntgl-5"})(["margin-right:4px;height:18px;> use{fill:",";}"],(0,o.getColor)("primary")),C=(0,y.default)(v).withConfig({displayName:"styled__HelpIcon",componentId:"sc-1yhntgl-6"})(["vertical-align:middle;"]),T=y.default.div.withConfig({displayName:"styled__LearnMoreSection",componentId:"sc-1yhntgl-7"})(["margin-top:",";"],(0,o.getSizeBy)(4)),I=y.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=a(74848);const k=e=>{let{onClose:t}=e;const a=(0,r.Zp)(),[n,s]=(0,l.useState)(!1),[d,y]=(0,l.useState)(""),{id:k,slug:O}=(0,m.ap)(),_=(0,b.ID)(),L=(0,b.QW)(),N=(0,l.useCallback)((e=>{let{slug:o}=e;t(),a("/spaces/".concat(O,"/rooms/").concat(L,"/dashboards/").concat(o))}),[O,L]),P=(0,g.Dn)(k,_,{onSuccess:N}),F=(0,l.useCallback)((()=>P({name:d})),[d]),M=d.length>0;return(0,S.jsxs)(i.GO,{onClose:t,children:[(0,S.jsx)(c.z,{onClose:t,title:"New Dashboard",children:(0,S.jsx)(o.Button,{label:"Add",icon:"plus",onClick:F,"data-testid":"addNewDashboardModal-add-button"})}),(0,S.jsx)(h.U,{children:"Create new Dashboard"}),(0,S.jsxs)(i.Yv,{children:[(0,S.jsx)(f.A,{value:d,label:"Name",onChange:e=>{y(e.target.value)},isValid:n,setIsValid:s,isDirty:M,instantFeedback:"all",onKeyDown:e=>e.keyCode===u.I7&&n&&F,"data-testid":"addNewDashboardModal-dashboardName-input",containerStyles:{flex:{grow:0,shrink:0},margin:[0,0,4,0]}}),(0,S.jsxs)(w,{children:[(0,S.jsx)(j,{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)(D,{children:[(0,S.jsxs)(A,{children:[(0,S.jsx)(v,{name:"check"}),(0,S.jsx)(o.Text,{children:"Add charts from your infrastructure"})]}),(0,S.jsxs)(A,{children:[(0,S.jsx)(v,{name:"check"}),(0,S.jsx)(o.Text,{children:"Group information in a meaningful way"})]}),(0,S.jsxs)(T,{children:[(0,S.jsx)(C,{name:"help"}),(0,S.jsx)(o.Text,{children:"Learn more about Dashboards"})," ",(0,S.jsx)(I,{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 O=a(63474),_=a(63950),L=a.n(_),N=(a(98992),a(81454),a(37550),a(51262)),P=a(39175);const F=e=>{let{handleOpenAddDashboardModal:t,hasPermissionToAddDashboard:a,hasPermissionToDeleteDashboard:o,refetch:n,duplicateDashboard:s}=e;const r=(0,b.GJ)(),i=(0,b.XA)("name"),c=(0,g.Ts)(),h=(0,d.q)(),u=(0,l.useMemo)((()=>h.some((e=>e===P.LA))),[h]),{hasLimitations:m,maxDashboards:p}=(0,N.A)(),f=a&&!(m&&h.length-(u?1:0)>=p),y=async(e,t)=>{const a=(Array.isArray(e)?e:[e]).map((e=>{let{id:t}=e;return t}));await c({ids:a},{onSuccess:()=>t.toggleAllRowsSelected(!1)}),n()},x=(0,l.useMemo)((()=>({duplicate:{icon:"copy",handleAction:e=>s(e.id),tooltipText:"Duplicate dashboard",confirmLabel:"Duplicate",confirmationMessage:e=>'A new dashboard named "Copy of '.concat(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 ".concat(e.name),declineLabel:"Cancel",isDisabled:()=>!f,disabledTooltipText:a?"Your plan does not allow you to create more than ".concat(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:i}),".",(0,S.jsx)("br",{}),"Are you sure you want to continue?"]}),confirmationTitle:e=>"Delete ".concat(e.name),declineLabel:"Cancel",handleAction:y,tooltipText:"Delete dashboard",isDisabled:e=>!o||r&&e.id===P.LA,disabledTooltipText:o?"Local dashboard cannot be deleted":"Only admins can delete"}})),[o,f,s,p,a]),w=(0,l.useMemo)((()=>({addEntry:{handleAction:t,isVisible:a,tooltipText:"Create dashboard",disabledTooltipText:"Your plan does not allow you to create more than ".concat(p," dashboards."),disabled:m&&h.length-(u?1:0)>=p},delete:{confirmLabel:"Yes, delete",confirmationMessage:(e,t)=>(0,S.jsxs)(S.Fragment,{children:["You are about to delete"," ",(0,S.jsx)("strong",{children:t.length>1?"".concat(t.length," dashboards"):t[0].name})," ","from ",(0,S.jsx)("strong",{children:i}),".",(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:y,tooltipText:"Delete dashboards",isVisible:o}})));return{rowActions:o||f?x:[],bulkActions:[a,o].some(Boolean)?w:[]}};var M=a(92726),V=a(45087);const Y=e=>{let t=new Date(e);t=t.getTime()===t.getTime()?t:new Date;const[,a,o,n]=t.toDateString().split(" ");return"".concat(a," ").concat(o,", ").concat(n)};var B=a(79748);const E=e=>{let{name:t}=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:t})," 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=>{var t;let{getValue:a,row:n}=e;const s="notAvailable"==(null===n||void 0===n||null===(t=n.original)||void 0===t?void 0:t.state),d=a();return s?(0,S.jsx)(V.A,{content:(0,S.jsx)(E,{name:d}),align:"bottom",isBasic:!0,children:(0,S.jsxs)(o.Flex,{alignItems:"center",children:[(0,S.jsx)(o.Text,{children:d}),(0,S.jsx)(o.Icon,{name:"padlock",height:"12px",color:"text"})]})}):(0,S.jsx)(B.A,{as:"Link",to:n.original.slug,children:d})};var K=a(99728),q=a(57738);const G=e=>{let{refetch:t,handleOpenAddDashboardModal:a}=e;const[,n]=(0,l.useState)(),s=(0,d.q)(),r=(0,M.Sf)(s),i=(0,K.JT)("dashboard:Create"),c=(0,K.JT)("dashboard:Delete"),h=(0,q.L)(),u=(0,l.useMemo)((()=>[{id:"name",accessorKey:"name",header:"Name",cell:z},{id:"updatedAt",accessorKey:"updatedAt",header:"Last modified",cell:e=>{let{getValue:t}=e;return(0,S.jsx)(o.TextSmall,{children:Y(t())})},sortingFn:"datetime"},{id:"createdAt",accessorKey:"createdAt",header:"Created",cell:e=>{let{getValue:t}=e;return(0,S.jsx)(o.TextSmall,{children:Y(t())})},sortingFn:"datetime"}]),[]),{rowActions:b,bulkActions:m}=F({dashboards:r,handleOpenAddDashboardModal:a,hasPermissionToAddDashboard:i,hasPermissionToDeleteDashboard:c,refetch:t,duplicateDashboard:h});return{rowActions:b,bulkActions:m,data:r,enableSelection:c,columns:u,enableSorting:!0,globalFilterFn:(0,l.useCallback)(((e,t,a)=>{var o,n,s,d,l,r,i;const c=null===a||void 0===a||null===(o=a.toLowerCase)||void 0===o?void 0:o.call(a),h=null===(n=e.getValue("name"))||void 0===n||null===(s=n.toLowerCase)||void 0===s?void 0:s.call(n),u="".concat(null===(d=Y(e.getValue("updatedAt")))||void 0===d||null===(l=d.toLowerCase)||void 0===l?void 0:l.call(d)),b="".concat(null===(r=Y(e.getValue("createdAt")))||void 0===r||null===(i=r.toLowerCase)||void 0===i?void 0:i.call(r));return h.includes(c)||u.includes(c)||b.includes(c)}),[]),setGlobalFilter:n}},Q=[{id:"updatedAt",desc:!0}],R=e=>{let{refetch:t=L(),handleOpenAddDashboardModal:a}=e;const{enableSelection:n,columns:s,data:d,rowActions:l,bulkActions:r,enableSorting:i,globalFilterFn:c,setGlobalFilter:h}=G({refetch:t,handleOpenAddDashboardModal:a});return(0,S.jsx)(o.Table,{rowActions:l,enableSelection:n,data:d,dataColumns:s,bulkActions:r,enableSorting:i,globalFilterFn:c,onSearch:h,testPrefixCallback:e=>e.name,sortBy:Q,title:"Dashboards"})};var W=a(60908);const J=()=>{const e=(0,s.A)(),[t,,a,l]=(0,n.A)(!1);return(0,d.RQ)()?(0,S.jsx)(W.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)(R,{refetch:e,handleOpenAddDashboardModal:a}),t&&(0,S.jsx)(k,{onClose:l})]})}):(0,S.jsx)(O.Ki,{})}}}]);