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

//# sourceMappingURL=UserCreatePage.4163e9a0a1bd235993f4.js.map