"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[2508],{"./public/app/features/admin/UserCreatePage.tsx":(e,s,a)=>{a.r(s),a.d(s,{default:()=>m});var r,n,d=a("./node_modules/react/index.js"),i=a("./node_modules/react-redux/es/index.js"),t=a("./packages/grafana-ui/src/index.ts"),l=a("./packages/grafana-runtime/src/index.ts"),c=a("./public/app/core/selectors/navModel.ts"),o=a("./public/app/core/components/Page/Page.tsx"),u=a("./node_modules/react-router/esm/react-router.js"),p=a("./node_modules/react/jsx-runtime.js");const m=(0,i.connect)((e=>({navModel:(0,c.h)(e.navIndex,"global-users")})))((({navModel:e})=>{const s=(0,u.k6)(),a=(0,d.useCallback)((async e=>{await(async e=>(0,l.getBackendSrv)().post("/api/admin/users",e))(e),s.push("/admin/users")}),[s]);return(0,p.jsx)(o.Z,{navModel:e,children:(0,p.jsxs)(o.Z.Contents,{children:[r||(r=(0,p.jsx)("h1",{children:"Add new user"})),(0,p.jsx)(t.Form,{onSubmit:a,validateOn:"onBlur",children:({register:e,errors:s})=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(t.Field,{label:"Name",required:!0,invalid:!!s.name,error:s.name?"Name is required":void 0,children:(0,p.jsx)(t.Input,Object.assign({},e("name",{required:!0})))}),(0,p.jsx)(t.Field,{label:"Email",children:(0,p.jsx)(t.Input,Object.assign({},e("email")))}),(0,p.jsx)(t.Field,{label:"Username",children:(0,p.jsx)(t.Input,Object.assign({},e("login")))}),(0,p.jsx)(t.Field,{label:"Password",required:!0,invalid:!!s.password,error:s.password?"Password is required and must contain at least 4 characters":void 0,children:(0,p.jsx)(t.Input,Object.assign({},e("password",{validate:e=>""!==e.trim()&&e.length>=4}),{type:"password"}))}),n||(n=(0,p.jsx)(t.Button,{type:"submit",children:"Create user"}))]})})]})})}))}}]);
//# sourceMappingURL=UserCreatePage.8128b05ac04b15cbf98d.js.map