File: //opt/netdata/usr/share/netdata/web/v3/1592.8d008a597090dad09f32.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:"4feb900574abdd30667a599041aadc4fc9f8ac80"};var d=(new e.Error).stack;d&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[d]="1d1faaf9-6020-4287-9bb5-04382828d410",e._sentryDebugIdIdentifier="sentry-dbid-1d1faaf9-6020-4287-9bb5-04382828d410")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[1592],{92003(e,d,a){a.r(d),a.d(d,{Dropdown:()=>R,default:()=>$});var t=a(96540),r=a(882),o=a(38429),n=a(43375),s=a(60602),i=a(29263),l=a(32788),c=a(41579),u=a(67294),p=a(96957),h=a(55093),b=a(15524),g=a(74848);const m=e=>(0,r.keyframes)(["from{border-color:",";border-width:2px;}to{border-color:",";border-width:1px;}"],(0,o.getColor)("primary")(e),(0,o.getColor)("textLite")(e)),x=(0,r.default)(o.Flex).withConfig({displayName:"dropArea__AnimatedFlex",componentId:"sc-vs4sjk-0"})(["animation:",";"],e=>{let{animate:d}=e;return d?(0,r.css)([""," 0.15s linear infinite"],m):""}),f={},w=(0,t.memo)(e=>{let{item:d=f,itemProps:a=f}=e;const{id:t,name:r,isNew:s}=d,{overDashboardId:i}=a,{setNodeRef:l,isOver:c,over:u}=(0,n.zM)({id:t,data:{droppable:!0,dropArea:!0,dashboardId:t,onlyPointerWithin:!0}}),{processing:h,loading:b}=(0,p.fz)(t),m=h||b;return(0,g.jsx)(o.Flex,{padding:[2],flex:!0,background:i===t&&"successSemi",children:(0,g.jsx)(x,{alignItems:"center",justifyContent:"center",padding:[2],border:{side:"all",type:"dashed",color:c?"primary":"textLite"},round:!0,ref:l,width:"100%",height:15,animate:u?.id===t&&i!==t,children:m?(0,g.jsx)(o.Text,{color:"textLite",children:"Loading..."}):(0,g.jsxs)(o.TextBig,{color:i===t?"successText":"text",children:[s?"":(0,g.jsx)(g.Fragment,{children:"Add in "}),(0,g.jsx)(o.TextBig,{strong:!0,color:s?"primary":i===t?"successText":"text",children:r})]})})})}),D=((0,r.default)(o.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,t.memo)(e=>{let{dashboards:d,selected:a,setSelected:t,itemProps:r}=e;const n=(0,b.A)();return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(w,{item:{id:"new",name:"Create a new dashboard",isNew:!0},itemProps:r}),(0,g.jsx)(o.MenuDropdown,{items:d,Item:w,value:a,hasSearch:!1,onItemClick:t,hideShadow:!0,itemProps:r,overflow:"hidden",ref:n})]})}));var v=a(85877),y=a(24609),I=a(19186),j=a(45706),C=a(76667),A=a(87398),k=a(63872),S=a(47090),_=a(3319),L=a(28864),T=a(5907),F=a(79748),N=a(52795),z=a(44245);const E=e=>{let{onDone:d}=e;const a=(0,C.Zp)(),r=(0,y.vt)(),o=(0,I.ID)(),n=(0,y.ns)(r,"slug"),s=(0,I.wz)(o,"slug"),i=(0,A.eg)(),[l,c]=(0,k.A)(),{sendLog:u}=(0,_.A)(),p=(0,z.tV)(),h=(0,L.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."}}),l({header:"Added",text:(0,g.jsxs)(g.Fragment,{children:["Chart added in"," ",(0,g.jsx)(F.A,{as:"a",strong:!0,onClick:()=>a(`/spaces/${n}/rooms/${s}/dashboards/${e.slug}`),children:e.name})," ","dashboard."]})}),setTimeout(()=>d(),2e3),u({feature:"drag-in-dashboard",isSuccess:!0})},onFail:e=>{const a=e?.response?.data,t=(0,S.o)(a?.errorMsgKey)||a?.errorMessage||"Something went wrong";c({message:t}),d(),u({feature:"drag-in-dashboard",isFailure:!0,message:t})}}),b=(0,T.nM)(),m=(0,T.Dn)(r,o);return(0,t.useCallback)((e,d)=>{const a=i.getNode({id:d?.itemId}),t=(0,N.h)(a.getAttributes());"new"!==e?b(t.contextScope,{...t,dashboardId:e,itemLayout:d},()=>h(e)):m({name:"[Untitled]"},e=>{b(t.contextScope,{...t,dashboardId:e.id,itemLayout:d},()=>h(e.id))})},[m,b])},M=(0,r.default)(o.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);"]),P=e=>{let{id:d,setOverDashboard:a}=e;const t=(0,y.vt)(),r=(0,I.ID)(),n=(0,y.ns)(t,"slug"),s=(0,I.wz)(r,"slug"),i=(0,j.A)(d,{spaceId:t,spaceSlug:n,roomId:r,roomSlug:s}),l=E({onDone:a});return d?(0,g.jsx)(o.Flex,{flex:!0,width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,g.jsx)(M,{children:i?(0,g.jsx)(h.A,{title:"Loading dashboard..."}):(0,g.jsx)(v.A,{id:d,containerWidth:600,trashable:!1,containerDndProps:{droppable:!0},onDragEnd:(e,t)=>{if(!t)return a();l(d,t)}})})}):null},R=(0,r.default)(o.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);"]),$=()=>{const[e,d]=(0,t.useState)(),[a,r]=(0,t.useState)();(0,c.A)();const b=(0,u.q)();let m=(0,p.Sf)(b);m=(0,t.useMemo)(()=>[...m].sort((e,d)=>new Date(e.updatedAt)<new Date(d.updatedAt)?1:-1),[b]);const x=(0,u.RQ)(),f=(0,s.A)(a?.id,500),w=E({onDone:r});(0,n.E5)({onDragMove:e=>{let{active:d,over:a}=e;a?.id&&d&&d.data.current&&(d.data.current.dashboardable?a.data.current.dropinDashboards?r(e=>e||{active:d,dropinDashboards:!0}):a.data.current.dashboardId?r(e=>e&&e?.id===a.data.current.dashboardId?e:{...e,id:a.data.current.dashboardId,active:d}):a.data.current.droppable||r():r())},onDragEnd:e=>{let{active:d,over:a}=e;a?.id&&d&&d.data.current&&(a.data.current.dashboardId&&d.data.current.dashboardable?w(a.data.current.dashboardId,d.data.current):setTimeout(()=>r(),1e3))},onDragCancel:()=>{r()}});const v=(0,t.useMemo)(()=>({overDashboardId:f}),[f]);if(!a?.active)return null;const{isItem:y,isContainer:I,dashboardable:j}=a.active.data.current;return j&&(y||I)?(0,g.jsxs)(o.Layer,{position:"right",full:!0,backdrop:!0,shadow:!0,justifyContent:"end",children:[(0,g.jsx)(P,{id:f,setOverDashboard:r}),a?.dropinDashboards&&(0,g.jsxs)(R,{children:[(0,g.jsx)(i.z,{title:"Drop in a dashboard",onClose:()=>r()}),(0,g.jsx)(l.Yv,{gap:2,height:"100%",overflow:"hidden",background:"dropdown",children:x?(0,g.jsx)(D,{dashboards:m,selected:e,setSelected:d,itemProps:v}):(0,g.jsx)(h.A,{title:"Loading dashboards..."})})]})]}):null}},47154(e,d,a){var t=a(66118);t.t1.register(...t.$L)}}]);