"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7720],{47761:(U,i,s)=>{s.d(i,{l:()=>g});var n=s(74848),r=s(22803),u=s(96540),j=s(49785);function g({defaultValues:f,onSubmit:E,validateOnMount:d=!1,validateFieldsOnMount:a,children:m,validateOn:I="onSubmit",maxWidth:t=600,...S}){const{handleSubmit:D,trigger:e,formState:c,...v}=(0,j.mN)({mode:I,defaultValues:f});return(0,u.useEffect)(()=>{d&&e(a)},[e,a,d]),(0,n.jsx)("form",{className:(0,r.css)({maxWidth:t!=="none"?t+"px":t,width:"100%"}),onSubmit:D(E),...S,children:m({errors:c.errors,formState:c,trigger:e,...v})})}},44992:(U,i,s)=>{s.r(i),s.d(i,{UserInvitePage:()=>P,default:()=>y});var n=s(74848),r=s(54122),u=s(87638),j=s(49785),g=s(2567),f=s(53027),E=s(54731),d=s(44617),a=s(86489),m=s(34128),I=s(40271),t=s(48583),S=s(6736),D=s(79784),e=s(60641),c=s(29010),v=s(54594),B=s(88023),h=s(61491),N=s(47761),F=s(17097);const O=(0,n.jsxs)(n.Fragment,{children:['You can now select the "No basic role" option and add permissions to your custom needs. You can find more information in\xA0',(0,n.jsx)(E.Y,{href:"https://grafana.com/docs/grafana/latest/administration/roles-and-permissions/#organization-roles",variant:"bodySmall",external:!0,children:"our documentation"}),"."]}),R=Object.values(h.OrgRole).map(o=>({label:o===h.OrgRole.None?"No basic role":o,value:o})),T={name:"",email:"",role:h.OrgRole.Editor,sendEmail:!0},p=()=>{const o=(0,h.useDispatch)(),C=async l=>{await o((0,F.KU)(l)).unwrap(),f.Ny.push("/admin/users/")};return(0,n.jsx)(N.l,{defaultValues:T,onSubmit:C,children:({register:l,control:L,errors:x})=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(d.n,{children:[(0,n.jsx)(a.D,{invalid:!!x.loginOrEmail,error:x.loginOrEmail?"Email or username is required":void 0,label:"Email or username",children:(0,n.jsx)(m.p,{...l("loginOrEmail",{required:!0}),placeholder:"email@example.com"})}),(0,n.jsx)(a.D,{invalid:!!x.name,label:"Name",children:(0,n.jsx)(m.p,{...l("name"),placeholder:"(optional)"})}),(0,n.jsx)(a.D,{invalid:!!x.role,label:(0,n.jsx)(I.J,{children:(0,n.jsxs)(t.B,{gap:.5,children:[(0,n.jsx)("span",{children:"Role"}),O&&(0,n.jsx)(S.m,{placement:"right-end",interactive:!0,content:O,children:(0,n.jsx)(D.I,{name:"info-circle",size:"xs"})})]})}),children:(0,n.jsx)(j.xI,{render:({field:{ref:A,...M}})=>(0,n.jsx)(e.z,{...M,options:R}),control:L,name:"role"})}),(0,n.jsx)(a.D,{label:"Send invite email",children:(0,n.jsx)(c.d,{id:"send-email-switch",...l("sendEmail")})})]}),(0,n.jsxs)(t.B,{children:[(0,n.jsx)(v.$n,{type:"submit",children:"Submit"}),(0,n.jsx)(v.z9,{href:g.I.assureBaseUrl((0,B.zj)().appSubUrl+"/admin/users"),variant:"secondary",children:"Back"})]})]})})};function P(){const o=(0,n.jsxs)(n.Fragment,{children:["Send invitation or add existing Grafana user to the organization.",(0,n.jsxs)("span",{className:"highlight-word",children:[" ",u.TP.user.orgName]})]});return(0,n.jsx)(r.Y,{navId:"global-users",pageNav:{text:"Invite user"},subTitle:o,children:(0,n.jsx)(r.Y.Contents,{children:(0,n.jsx)(p,{})})})}const y=P}}]);

//# sourceMappingURL=UserInvitePage.71807ad5c9bc6d53d9a2.js.map