"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[950],{"./public/app/features/org/NewOrgPage.tsx":(e,a,n)=>{n.r(a),n.d(a,{NewOrgPage:()=>m,default:()=>v});n("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js");var t,r,i,s=n("./public/app/core/components/Page/Page.tsx"),c=n("./packages/grafana-ui/src/index.ts"),o=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("./public/app/core/selectors/navModel.ts"),g=n("./public/app/features/org/state/actions.ts"),l=n("./public/app/core/config.ts"),u=n("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/jsx-runtime.js");const p={createOrganization:g.Yi},h=(0,o.connect)((e=>({navModel:(0,d.h)(e.navIndex,"global-orgs")})),p),m=e=>{let{navModel:a,createOrganization:n}=e;return(0,u.jsx)(s.Z,{navModel:a,children:(0,u.jsxs)(s.Z.Contents,{children:[t||(t=(0,u.jsx)("h3",{className:"page-sub-heading",children:"New organization"})),r||(r=(0,u.jsxs)("p",{className:"playlist-description",children:["Each organization contains their own dashboards, data sources, and configuration, which cannot be shared shared between organizations. While users might belong to more than one organization, multiple organizations are most frequently used in multi-tenant deployments."," "]})),(0,u.jsx)(c.Form,{onSubmit:async e=>{await n(e),window.location.href=(0,l.iE)().appSubUrl+"/org"},children:e=>{let{register:a,errors:n}=e;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(c.Field,{label:"Organization name",invalid:!!n.name,error:n.name&&n.name.message,children:(0,u.jsx)(c.Input,Object.assign({placeholder:"Org name"},a("name",{required:"Organization name is required"})))}),i||(i=(0,u.jsx)(c.Button,{type:"submit",children:"Create"}))]})}})]})})},v=h(m)},"./public/app/features/org/state/actions.ts":(e,a,n)=>{n.d(a,{RF:()=>s,FV:()=>c,Q$:()=>o,Yi:()=>d,JE:()=>g});var t=n("./packages/grafana-runtime/src/index.ts"),r=n("./public/app/features/org/state/reducers.ts"),i=n("./public/app/core/actions/index.ts");function s(){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 c(){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,i.H7)(t.name)),a(s(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,i.H7)(t.name))}}function d(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 g(){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=NewOrgPage.cd4ada1146b53ad3284f.js.map