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

//# sourceMappingURL=UserCreatePage.0efc18ab50565a9bb2a9.js.map