File: //opt/netdata/usr/local/share/netdata/web/v3/7530.accd601c8acbf67b472b.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 s=(new e.Error).stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="f853653f-7f3b-4208-bff8-8036e815d074",e._sentryDebugIdIdentifier="sentry-dbid-f853653f-7f3b-4208-bff8-8036e815d074")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[7530],{17530(e,s,a){a.r(s),a.d(s,{default:()=>g});a(74423);var n=a(78904),o=a(24609),i=a(6304),t=a(99728),r=a(29022),l=a(36348),c=a(79748),d=a(76667),m=a(74848);const u={noRoomPermission:{header:e=>`Your role doesn't give you permission to access any of the troubleshooting information on ${e}.`},noSpacePermission:{header:e=>`Your role doesn't give you permission to access any information on ${e}.`},noRooms:{header:e=>`You currently don't have permission to see any room on ${e}.`}},h=e=>{let{onClick:s,spaceName:a}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Text,{margin:[2,0,0],children:"You can also leave this Space if you wish. "}),(0,m.jsx)(n.Button,{flavour:"borderless",icon:"switch_off",label:`Leave ${a}`,margin:[0,0,0,7],onClick:s,strong:!0})]})},f=["noSpacePermission","noRoomPermission"],g=e=>{let{reason:s}=e;const a=(0,o.ap)(),[g,,p,b]=(0,i.A)(),{header:x}=u[s],y=(0,o.bq)(),v=(0,t.JT)("billing:ReadBasic");return(0,m.jsx)(r.A,{title:x(a.name),children:(0,m.jsxs)(m.Fragment,{children:["noSpacePermission"===s&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Text,{children:"Please contact the Space administrators if this is unexpected."}),(0,m.jsx)(h,{onClick:p,spaceName:a.name})]}),v&&f.includes(s)&&(0,m.jsxs)(n.Text,{children:["To manage Plan & Billing information please"," ",(0,m.jsx)(c.A,{as:d.N_,to:`/spaces/${y}/settings/billing`,children:"click here."})]}),"noRooms"===s&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Text,{children:"Please contact a Space administrator or manager if this is unexpected."}),(0,m.jsx)(h,{onClick:p,spaceName:a.name})]}),g&&(0,m.jsx)(l.A,{id:a.id,name:a.name,onClose:b})]})})}},36348(e,s,a){a.d(s,{A:()=>j});var n=a(96540),o=a(78904),i=a(76667),t=a(46587),r=a(86706),l=(a(98992),a(54520),a(30569)),c=a(84929),d=a(63872),m=a(77389),u=a(99236),h=a(24609),f=a(32874),g=a(15624),p=a(49916);var b=a(64999),x=a(74848);const y="leave-space-dialog",v="leaveSpaceDialog",j=e=>{let{id:s,name:a,onClose:j}=e;const C=(0,i.Zp)(),w=(0,t.uW)("id"),A=(0,r.Gi)(),S=(0,r.i3)(),$=(0,r.pB)(),k=(e=>{const[,s]=(0,d.A)();return(0,l.yF)((0,n.useCallback)(async(a,n,o)=>{let{currentUserId:i,onSuccess:t,onError:l}=o;const d=await a((0,h.nC)("ids")),b=d.filter(s=>e!==s),x=e=>{n(e,c.Ut)},[y]=b;if(!y)return void s({header:"Spaces",text:u.sh.leave});const{slug:v}=y&&await a((0,g.Ay)(y));n((0,h.nC)("ids"),b),n(f.A,s=>s.filter(s=>s!==e));try{await(0,m.XY)(e,[i]),t&&t(v),(0,r.Z8)(x,e),(0,p.Is)(x,e),x((0,g.Ay)(e))}catch(j){n((0,h.nC)("ids"),d),l&&l()}},[e,s]))})(s),T=(0,b.A)(s),L=(0,n.useCallback)(e=>C(`/spaces/${e}`),[]),P=1===A.length,Y=1===S.length&&$,I=P?{confirmLabel:"Yes, leave","data-ga":`${y}-last-member`,"data-testid":`${v}LastMember`,handleConfirm:()=>T({onSuccess:L}),message:(0,x.jsxs)(x.Fragment,{children:["If you leave, space ",(0,x.jsx)("strong",{children:a})," will be deleted immediately.",(0,x.jsx)("br",{}),"Are you sure you want to continue?"]}),title:`Leave and delete ${a} space`}:Y?{confirmLabel:"Give rights","data-ga":`${y}-last-admin`,"data-testid":`${v}LastAdmin`,handleConfirm:()=>C("users"),isConfirmPositive:!0,message:(0,x.jsxs)(x.Fragment,{children:["You are the last admin of ",(0,x.jsx)("strong",{children:a})," space. Please give admin rights to another member so you can leave this space."]}),title:`Leave ${a} space`}:{confirmLabel:"Yes, leave","data-ga":y,"data-testid":v,handleConfirm:()=>k({currentUserId:w,onSuccess:L}),message:(0,x.jsxs)(x.Fragment,{children:["You are about to leave ",(0,x.jsx)("strong",{children:a})," space.",(0,x.jsx)("br",{}),"Are you sure you want to continue?"]}),title:`Leave ${a} space`};return(0,x.jsx)(o.ConfirmationDialog,{handleDecline:j,...I})}}}]);