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