"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[1456],{44706:(e,n,t)=>{t.r(n),t.d(n,{SelectOrgPage:()=>h,default:()=>k});t(68404);var a,r=t(18745),i=t(37784),o=t(90923),c=t(69783),g=t(33801),s=t(57192),d=t(45916);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)},57192:(e,n,t)=>{t.d(n,{FV:()=>c,JE:()=>d,Q$:()=>g,RF:()=>o,Yi:()=>s});var a=t(90923),r=t(36537),i=t(41078);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.bc2e58124113a8698457.js.map