File: //opt/netdata/usr/local/share/netdata/web/v3/2003.eb47c74aafcef661fca8.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:"54f5cb40e9d0ad4ae1f7dfb8309dd2c9f0bcc7c1"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="62c8752f-943e-41f8-a657-681a17c6eb04",e._sentryDebugIdIdentifier="sentry-dbid-62c8752f-943e-41f8-a657-681a17c6eb04")}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[2003],{92003(e,t,r){r.r(t),r.d(t,{Dropdown:()=>Y,default:()=>H});var o=r(64467),d=(r(26910),r(98992),r(54520),r(3949),r(62953),r(96540)),n=r(51510),a=r(42358),s=r(43375),i=r(60602),c=r(29263),l=r(32788),u=r(41579),p=r(67294),b=r(92726),h=r(55093),g=r(15524),f=r(74848);const m=e=>(0,n.keyframes)(["from{border-color:",";border-width:2px;}to{border-color:",";border-width:1px;}"],(0,a.getColor)("primary")(e),(0,a.getColor)("textLite")(e)),x=(0,n.default)(a.Flex).withConfig({displayName:"dropArea__AnimatedFlex",componentId:"sc-vs4sjk-0"})(["animation:",";"],(e=>{let{animate:t}=e;return t?(0,n.css)([""," 0.15s linear infinite"],m):""})),v={},w=(0,d.memo)((e=>{let{item:t=v,itemProps:r=v}=e;const{id:o,name:d,isNew:n}=t,{overDashboardId:i}=r,{setNodeRef:c,isOver:l,over:u}=(0,s.zM)({id:o,data:{droppable:!0,dropArea:!0,dashboardId:o,onlyPointerWithin:!0}}),{processing:p,loading:h}=(0,b.fz)(o),g=p||h;return(0,f.jsx)(a.Flex,{padding:[2],flex:!0,background:i===o&&"successSemi",children:(0,f.jsx)(x,{alignItems:"center",justifyContent:"center",padding:[2],border:{side:"all",type:"dashed",color:l?"primary":"textLite"},round:!0,ref:c,width:"100%",height:15,animate:(null===u||void 0===u?void 0:u.id)===o&&i!==o,children:g?(0,f.jsx)(a.Text,{color:"textLite",children:"Loading..."}):(0,f.jsxs)(a.TextBig,{color:i===o?"successText":"text",children:[n?"":(0,f.jsx)(f.Fragment,{children:"Add in "}),(0,f.jsx)(a.TextBig,{strong:!0,color:n?"primary":i===o?"successText":"text",children:d})]})})})})),y=((0,n.default)(a.Drop).attrs({align:{top:"bottom",left:"left"},animation:!0,backdrop:!0,column:!0,padding:[2,0],background:"dropdown",round:1,overflow:{vertical:"auto"},margin:[.5,0,0],width:30}).withConfig({displayName:"list__Dropdown",componentId:"sc-s8yppy-0"})([""]),(0,d.memo)((e=>{let{dashboards:t,selected:r,setSelected:o,itemProps:d}=e;const n=(0,g.A)();return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(w,{item:{id:"new",name:"Create a new dashboard",isNew:!0},itemProps:d}),(0,f.jsx)(a.MenuDropdown,{items:t,Item:w,value:r,hasSearch:!1,onItemClick:o,hideShadow:!0,itemProps:d,overflow:"hidden",ref:n})]})})));var j=r(97799),D=r(24609),O=r(19186),I=r(45706),P=r(41344),A=r(87398),S=r(63872),C=r(47090),k=r(3319),_=r(28864),E=r(5907),F=r(79748),L=r(52795),T=r(44245);function N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?N(Object(r),!0).forEach((function(t){(0,o.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const M=e=>{let{onDone:t}=e;const r=(0,P.Zp)(),o=(0,D.vt)(),n=(0,O.ID)(),a=(0,D.ns)(o,"slug"),s=(0,O.wz)(n,"slug"),i=(0,A.eg)(),[c,l]=(0,S.A)(),{sendLog:u}=(0,k.A)(),p=(0,T.tV)(),b=(0,_.DH)(null,{onSuccess:e=>{p({title:e.slug,id:e.id,destination:e.slug,type:"dashboards",droppable:!0,droppableProps:{dashboardId:e.id,dropArea:!0},tooltip:{title:e.slug,description:"Custom dashboard with personalized visualizations and metrics tailored to your monitoring requirements."}}),c({header:"Added",text:(0,f.jsxs)(f.Fragment,{children:["Chart added in"," ",(0,f.jsx)(F.A,{as:"a",strong:!0,onClick:()=>r("/spaces/".concat(a,"/rooms/").concat(s,"/dashboards/").concat(e.slug)),children:e.name})," ","dashboard."]})}),setTimeout((()=>t()),2e3),u({feature:"drag-in-dashboard",isSuccess:!0})},onFail:e=>{var r;const o=null===e||void 0===e||null===(r=e.response)||void 0===r?void 0:r.data,d=(0,C.o)(null===o||void 0===o?void 0:o.errorMsgKey)||(null===o||void 0===o?void 0:o.errorMessage)||"Something went wrong";l({message:d}),t(),u({feature:"drag-in-dashboard",isFailure:!0,message:d})}}),h=(0,E.nM)(),g=(0,E.Dn)(o,n);return(0,d.useCallback)(((e,t)=>{const r=i.getNode({id:null===t||void 0===t?void 0:t.itemId}),o=(0,L.h)(r.getAttributes());"new"!==e?h(o.contextScope,z(z({},o),{},{dashboardId:e,itemLayout:t}),(()=>b(e))):g({name:"[Untitled]"},(e=>{h(o.contextScope,z(z({},o),{},{dashboardId:e.id,itemLayout:t}),(()=>b(e.id)))}))}),[g,h])},R=(0,n.default)(a.Flex).attrs({background:"mainBackground",padding:[2],overflow:"auto",height:"80%",width:"600px"}).withConfig({displayName:"dropDashboard__ScaledDownContainer",componentId:"sc-zd7fpn-0"})(["box-shadow:0 0 0 1px rgba(63,63,68,0.05),-1px 0 15px 0 rgba(34,33,81,0.01),0px 15px 15px 0 rgba(34,33,81,0.25);"]),B=e=>{let{id:t,setOverDashboard:r}=e;const o=(0,D.vt)(),d=(0,O.ID)(),n=(0,D.ns)(o,"slug"),s=(0,O.wz)(d,"slug"),i=(0,I.A)(t,{spaceId:o,spaceSlug:n,roomId:d,roomSlug:s}),c=M({onDone:r});return t?(0,f.jsx)(a.Flex,{flex:!0,width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,f.jsx)(R,{children:i?(0,f.jsx)(h.A,{title:"Loading dashboard..."}):(0,f.jsx)(j.A,{id:t,containerWidth:600,trashable:!1,containerDndProps:{droppable:!0},onDragEnd:(e,o)=>{if(!o)return r();c(t,o)}})})}):null};function q(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function W(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?q(Object(r),!0).forEach((function(t){(0,o.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):q(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const Y=(0,n.default)(a.Flex).attrs({column:!0,background:"dropdown",width:{max:"auto",min:100,base:100}}).withConfig({displayName:"dropInDashboard__Dropdown",componentId:"sc-12fd9r3-0"})(["box-shadow:0 0 0 1px rgba(63,63,68,0.05),-1px 0 15px 0 rgba(34,33,81,0.01),0px 15px 15px 0 rgba(34,33,81,0.25);"]),H=()=>{const[e,t]=(0,d.useState)(),[r,o]=(0,d.useState)();(0,u.A)();const n=(0,p.q)();let g=(0,b.Sf)(n);g=(0,d.useMemo)((()=>[...g].sort(((e,t)=>new Date(e.updatedAt)<new Date(t.updatedAt)?1:-1))),[n]);const m=(0,p.RQ)(),x=(0,i.A)(null===r||void 0===r?void 0:r.id,500),v=M({onDone:o});(0,s.E5)({onDragMove:e=>{let{active:t,over:r}=e;null!==r&&void 0!==r&&r.id&&t&&t.data.current&&(t.data.current.dashboardable?r.data.current.dropinDashboards?o((e=>e||{active:t,dropinDashboards:!0})):r.data.current.dashboardId?o((e=>e&&(null===e||void 0===e?void 0:e.id)===r.data.current.dashboardId?e:W(W({},e),{},{id:r.data.current.dashboardId,active:t}))):r.data.current.droppable||o():o())},onDragEnd:e=>{let{active:t,over:r}=e;null!==r&&void 0!==r&&r.id&&t&&t.data.current&&(r.data.current.dashboardId&&t.data.current.dashboardable?v(r.data.current.dashboardId,t.data.current):setTimeout((()=>o()),1e3))},onDragCancel:()=>{o()}});const w=(0,d.useMemo)((()=>({overDashboardId:x})),[x]);if(null===r||void 0===r||!r.active)return null;const{isItem:j,isContainer:D,dashboardable:O}=r.active.data.current;return O&&(j||D)?(0,f.jsxs)(a.Layer,{position:"right",full:!0,backdrop:!0,shadow:!0,justifyContent:"end",children:[(0,f.jsx)(B,{id:x,setOverDashboard:o}),(null===r||void 0===r?void 0:r.dropinDashboards)&&(0,f.jsxs)(Y,{children:[(0,f.jsx)(c.z,{title:"Drop in a dashboard",onClose:()=>o()}),(0,f.jsx)(l.Yv,{gap:2,height:"100%",overflow:"hidden",background:"dropdown",children:m?(0,f.jsx)(y,{dashboards:g,selected:e,setSelected:t,itemProps:w}):(0,f.jsx)(h.A,{title:"Loading dashboards..."})})]})]}):null}}}]);