"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[2508],{89260:(e,s,a)=>{a.r(s),a.d(s,{default:()=>m});var n,r,i=a(68404),d=a(18745),l=a(42326),t=a(90923),u=a(69783),c=a(33801),o=a(8674),p=a(45916);const m=(0,d.connect)((e=>({navModel:(0,o.h)(e.navIndex,"global-users")})))((e=>{let{navModel:s}=e;const a=(0,l.k6)(),d=(0,i.useCallback)((async e=>{await(async e=>(0,t.getBackendSrv)().post("/api/admin/users",e))(e),a.push("/admin/users")}),[a]);return(0,p.jsx)(c.Z,{navModel:s,children:(0,p.jsxs)(c.Z.Contents,{children:[n||(n=(0,p.jsx)("h1",{children:"Add new user"})),(0,p.jsx)(u.Form,{onSubmit:d,validateOn:"onBlur",children:e=>{let{register:s,errors:a}=e;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(u.Field,{label:"Name",required:!0,invalid:!!a.name,error:a.name?"Name is required":void 0,children:(0,p.jsx)(u.Input,Object.assign({id:"name-input"},s("name",{required:!0})))}),(0,p.jsx)(u.Field,{label:"Email",children:(0,p.jsx)(u.Input,Object.assign({id:"email-input"},s("email")))}),(0,p.jsx)(u.Field,{label:"Username",children:(0,p.jsx)(u.Input,Object.assign({id:"username-input"},s("login")))}),(0,p.jsx)(u.Field,{label:"Password",required:!0,invalid:!!a.password,error:a.password?"Password is required and must contain at least 4 characters":void 0,children:(0,p.jsx)(u.Input,Object.assign({id:"password-input"},s("password",{validate:e=>""!==e.trim()&&e.length>=4}),{type:"password"}))}),r||(r=(0,p.jsx)(u.Button,{type:"submit",children:"Create user"}))]})}})]})})}))}}]);
//# sourceMappingURL=UserCreatePage.e05d78b8027db8c21856.js.map