"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[2508],{61651:(e,s,a)=>{a.r(s),a.d(s,{default:()=>m});var n,r,i=a(76687),d=a(46958),l=a(59163),t=a(10967),u=a(70534),c=a(36131),o=a(3276),p=a(52010);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.c127578a646cf4a0c60a.js.map