"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[1456],{11975:(e,n,t)=>{t.r(n),t.d(n,{SelectOrgPage:()=>h,default:()=>k});t(76687);var a,r=t(46958),i=t(77449),o=t(10967),c=t(70534),g=t(36131),s=t(22399),d=t(52010);const u={main:{icon:"grafana",subTitle:"Preferences",text:"Select active organization"},node:{text:"Select active organization"}},l={setUserOrganization:s.Q$,getUserOrganizations:s.JE},v=(0,r.connect)((e=>({userOrgs:e.organization.userOrgs})),l),h=e=>{let{setUserOrganization:n,getUserOrganizations:t,userOrgs:r}=e;return(0,i.Z)((()=>{t()})),(0,d.jsx)(g.Z,{navModel:u,children:(0,d.jsx)(g.Z.Contents,{children:(0,d.jsxs)("div",{children:[a||(a=(0,d.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,d.jsx)(c.HorizontalGroup,{wrap:!0,children:r&&r.map((e=>(0,d.jsx)(c.Button,{icon:"signin",onClick:()=>(async e=>{await n(e.orgId),window.location.href=o.config.appSubUrl+"/"})(e),children:e.name},e.orgId)))})]})})})},k=v(h)},22399:(e,n,t)=>{t.d(n,{FV:()=>c,JE:()=>d,Q$:()=>g,RF:()=>o,Yi:()=>s});var a=t(10967),r=t(29877),i=t(30587);function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{getBackendSrv:a.getBackendSrv};return async n=>{const t=await e.getBackendSrv().get("/api/org");return n((0,i.jR)(t)),t}}function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{getBackendSrv:a.getBackendSrv};return async(n,t)=>{const a=t().organization.organization;await e.getBackendSrv().put("/api/org",{name:a.name}),n((0,r.H7)(a.name)),n(o(e))}}function g(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{getBackendSrv:a.getBackendSrv};return async t=>{const a=await n.getBackendSrv().post("/api/user/using/"+e);t((0,r.H7)(a.name))}}function s(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{getBackendSrv:a.getBackendSrv};return async t=>{t(g((await n.getBackendSrv().post("/api/orgs/",e)).orgId))}}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{getBackendSrv:a.getBackendSrv};return async n=>{const t=await e.getBackendSrv().get("/api/user/orgs");return n((0,i.IM)(t)),t}}}}]);
//# sourceMappingURL=SelectOrgPage.40060546d92a629d9d9e.js.map