"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[1456],{11975:(n,e,t)=>{t.r(e),t.d(e,{SelectOrgPage:()=>p,default:()=>k});t(76687);var a,r=t(30415),i=t(28465),o=t(67273),s=t(7053),c=t(55312),g=t(28781),d=t(22399),l=t(52010);const u={main:{icon:"grafana",subTitle:"Preferences",text:"Select active organization"},node:{text:"Select active organization"}},h={setUserOrganization:d.Q$,getUserOrganizations:d.JE},v=(0,r.connect)((n=>({userOrgs:n.organization.userOrgs})),h),p=n=>{let{setUserOrganization:e,getUserOrganizations:t,userOrgs:r}=n;return(0,i.Z)((()=>{t()})),(0,l.jsx)(g.T,{navModel:u,children:(0,l.jsx)(g.T.Contents,{children:(0,l.jsxs)("div",{children:[a||(a=(0,l.jsx)("p",{children:"You have been invited to another organization! Please select which organization that you want to use right now. You can change this later at any time."})),(0,l.jsx)(s.Lh,{wrap:!0,children:r&&r.map((n=>(0,l.jsx)(c.zx,{icon:"signin",onClick:()=>(async n=>{await e(n.orgId),window.location.href=o.v.appSubUrl+"/"})(n),children:n.name},n.orgId)))})]})})})},k=v(p)},22399:(n,e,t)=>{t.d(e,{FV:()=>s,JE:()=>d,Q$:()=>c,RF:()=>o,Yi:()=>g});var a=t(5205),r=t(29877),i=t(30587);function o(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{getBackendSrv:a.i};return async e=>{const t=await n.getBackendSrv().get("/api/org");return e((0,i.jR)(t)),t}}function s(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{getBackendSrv:a.i};return async(e,t)=>{const a=t().organization.organization;await n.getBackendSrv().put("/api/org",{name:a.name}),e((0,r.H7)(a.name)),e(o(n))}}function c(n){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{getBackendSrv:a.i};return async t=>{const a=await e.getBackendSrv().post("/api/user/using/"+n);t((0,r.H7)(a.name))}}function g(n){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{getBackendSrv:a.i};return async t=>{t(c((await e.getBackendSrv().post("/api/orgs/",n)).orgId))}}function d(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{getBackendSrv:a.i};return async e=>{const t=await n.getBackendSrv().get("/api/user/orgs");return e((0,i.IM)(t)),t}}}}]);
//# sourceMappingURL=SelectOrgPage.2933e2c545c7d0810536.js.map