"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[2508],{61651:(e,s,a)=>{a.r(s),a.d(s,{default:()=>b});var r,i=a(76687),n=a(63322),t=a(5205),d=a(56481),l=a(45550),u=a(9120),c=a(55312),o=a(28781),m=a(52010);const p={icon:"user",id:"user-new",text:"New user",subTitle:"Create a new Grafana user.",breadcrumbs:[{title:"Server admin",url:"admin/users"}]},b=()=>{const e=(0,n.k6)(),s=(0,i.useCallback)((async s=>{const{id:a}=await(async e=>(0,t.i)().post("/api/admin/users",e))(s);e.push(`/admin/users/edit/${a}`)}),[e]);return(0,m.jsx)(o.T,{navId:"global-users",pageNav:p,children:(0,m.jsx)(o.T.Contents,{children:(0,m.jsx)(d.l,{onSubmit:s,validateOn:"onBlur",children:e=>{let{register:s,errors:a}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(l.g,{label:"Name",required:!0,invalid:!!a.name,error:a.name?"Name is required":void 0,children:(0,m.jsx)(u.I,Object.assign({id:"name-input"},s("name",{required:!0})))}),(0,m.jsx)(l.g,{label:"Email",children:(0,m.jsx)(u.I,Object.assign({id:"email-input"},s("email")))}),(0,m.jsx)(l.g,{label:"Username",children:(0,m.jsx)(u.I,Object.assign({id:"username-input"},s("login")))}),(0,m.jsx)(l.g,{label:"Password",required:!0,invalid:!!a.password,error:a.password?"Password is required and must contain at least 4 characters":void 0,children:(0,m.jsx)(u.I,Object.assign({id:"password-input"},s("password",{validate:e=>""!==e.trim()&&e.length>=4}),{type:"password"}))}),r||(r=(0,m.jsx)(c.zx,{type:"submit",children:"Create user"}))]})}})})})}}}]);
//# sourceMappingURL=UserCreatePage.240afa833805ee214323.js.map