"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[9239],{64665:(g,o,e)=>{e.r(o),e.d(o,{default:()=>O});var a=e(74848),l=e(96540),u=e(49785),m=e(54148),E=e(17172),s=e(88575),r=e(10354),P=e(55852),_=e(21780);const c=async n=>(0,E.AI)().post("/api/admin/users",n),D={icon:"user",id:"user-new",text:"New user",subTitle:"Create a new Grafana user."},O=()=>{const n=(0,m.Zp)(),{handleSubmit:C,register:t,formState:{errors:i}}=(0,u.mN)({mode:"onBlur"}),M=(0,l.useCallback)(async d=>{const{id:v}=await c(d);n(`/admin/users/edit/${v}`)},[n]);return(0,a.jsx)(_.YW,{navId:"global-users",pageNav:D,children:(0,a.jsx)(_.YW.Contents,{children:(0,a.jsxs)("form",{onSubmit:C(M),style:{maxWidth:"600px"},children:[(0,a.jsx)(s.D,{label:"Name",required:!0,invalid:!!i.name,error:i.name?"Name is required":void 0,children:(0,a.jsx)(r.p,{id:"name-input",...t("name",{required:!0})})}),(0,a.jsx)(s.D,{label:"Email",children:(0,a.jsx)(r.p,{id:"email-input",...t("email")})}),(0,a.jsx)(s.D,{label:"Username",children:(0,a.jsx)(r.p,{id:"username-input",...t("login")})}),(0,a.jsx)(s.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)(r.p,{id:"password-input",...t("password",{validate:d=>d.trim()!==""&&d.length>=4}),type:"password"})}),(0,a.jsx)(P.$n,{type:"submit",children:"Create user"})]})})})}}}]);

//# sourceMappingURL=UserCreatePage.909c60c7ce78ba74d99e.js.map