"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[9239],{62648(v,o,e){e.r(o),e.d(o,{default:()=>O});var a=e(74848),u=e(96540),m=e(49785),E=e(54148),r=e(92745),c=e(68143),P=e(45861),s=e(37386),n=e(63527),_=e(13791);const D=async t=>(0,c.AI)().post("/api/admin/users",t),g={icon:"user",id:"user-new",text:"New user",subTitle:"Create a new Grafana user."},O=()=>{const t=(0,E.Zp)(),{handleSubmit:p,register:i,formState:{errors:d}}=(0,m.mN)({mode:"onBlur"}),M=(0,u.useCallback)(async l=>{const{uid:C}=await D(l);t(`/admin/users/edit/${C}`)},[t]);return(0,a.jsx)(_.Y,{navId:"global-users",pageNav:g,children:(0,a.jsx)(_.Y.Contents,{children:(0,a.jsxs)("form",{onSubmit:p(M),style:{maxWidth:"600px"},children:[(0,a.jsx)(s.D,{label:(0,r.t)("admin.user-create-page.label-name","Name"),required:!0,invalid:!!d.name,error:d.name?"Name is required":void 0,children:(0,a.jsx)(n.p,{id:"name-input",...i("name",{required:!0})})}),(0,a.jsx)(s.D,{label:(0,r.t)("admin.user-create-page.label-email","Email"),children:(0,a.jsx)(n.p,{id:"email-input",...i("email")})}),(0,a.jsx)(s.D,{label:(0,r.t)("admin.user-create-page.label-username","Username"),children:(0,a.jsx)(n.p,{id:"username-input",...i("login")})}),(0,a.jsx)(s.D,{label:(0,r.t)("admin.user-create-page.label-password","Password"),required:!0,invalid:!!d.password,error:d.password?"Password is required and must contain at least 4 characters":void 0,children:(0,a.jsx)(n.p,{id:"password-input",...i("password",{validate:l=>l.trim()!==""&&l.length>=4}),type:"password"})}),(0,a.jsx)(P.$n,{type:"submit",children:(0,a.jsx)(r.x6,{i18nKey:"admin.users-create.create-button",children:"Create user"})})]})})})}}}]);

//# sourceMappingURL=UserCreatePage.d828877fbafc9ad6457a.js.map