"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[1456],{"./public/app/features/org/SelectOrgPage.tsx":(e,a,n)=>{n.r(a),n.d(a,{SelectOrgPage:()=>v,default:()=>h});n("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js");var t,r=n("./public/app/core/components/Page/Page.tsx"),c=n("./packages/grafana-runtime/src/index.ts"),i=n("./.yarn/__virtual__/react-use-virtual-00326e70ba/3/opt/drone/yarncache/react-use-npm-17.3.2-a032cbeb01-7379460f51.zip/node_modules/react-use/esm/useEffectOnce.js"),s=n("./packages/grafana-ui/src/index.ts"),o=n("./public/app/features/org/state/actions.ts"),g=n("./.yarn/__virtual__/react-redux-virtual-7ad20a440e/3/opt/drone/yarncache/react-redux-npm-7.2.6-134f5ed64d-0bf142ce0d.zip/node_modules/react-redux/es/index.js"),d=n("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/jsx-runtime.js");const u={main:{icon:"grafana",subTitle:"Preferences",text:"Select active organization"},node:{text:"Select active organization"}},p={setUserOrganization:o.Q$,getUserOrganizations:o.JE},l=(0,g.connect)((e=>({userOrgs:e.organization.userOrgs})),p),v=e=>{let{setUserOrganization:a,getUserOrganizations:n,userOrgs:o}=e;return(0,i.Z)((()=>{n()})),(0,d.jsx)(r.Z,{navModel:u,children:(0,d.jsx)(r.Z.Contents,{children:(0,d.jsxs)("div",{children:[t||(t=(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)(s.HorizontalGroup,{wrap:!0,children:o&&o.map((e=>(0,d.jsx)(s.Button,{icon:"signin",onClick:()=>(async e=>{await a(e.orgId),window.location.href=c.config.appSubUrl+"/"})(e),children:e.name},e.orgId)))})]})})})},h=l(v)},"./public/app/features/org/state/actions.ts":(e,a,n)=>{n.d(a,{RF:()=>i,FV:()=>s,Q$:()=>o,Yi:()=>g,JE:()=>d});var t=n("./packages/grafana-runtime/src/index.ts"),r=n("./public/app/features/org/state/reducers.ts"),c=n("./public/app/core/actions/index.ts");function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{getBackendSrv:t.getBackendSrv};return async a=>{const n=await e.getBackendSrv().get("/api/org");return a((0,r.jR)(n)),n}}function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{getBackendSrv:t.getBackendSrv};return async(a,n)=>{const t=n().organization.organization;await e.getBackendSrv().put("/api/org",{name:t.name}),a((0,c.H7)(t.name)),a(i(e))}}function o(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{getBackendSrv:t.getBackendSrv};return async n=>{const t=await a.getBackendSrv().post("/api/user/using/"+e);n((0,c.H7)(t.name))}}function g(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{getBackendSrv:t.getBackendSrv};return async n=>{n(o((await a.getBackendSrv().post("/api/orgs/",e)).orgId))}}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{getBackendSrv:t.getBackendSrv};return async a=>{const n=await e.getBackendSrv().get("/api/user/orgs");return a((0,r.IM)(n)),n}}}}]);
//# sourceMappingURL=SelectOrgPage.cd4ada1146b53ad3284f.js.map