"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7720],{74410(N,m,s){s.d(m,{l:()=>j});var n=s(74848),e=s(22803),d=s(96540),g=s(49785);function j({defaultValues:t,onSubmit:f,validateOnMount:v=!1,validateFieldsOnMount:c,children:E,validateOn:i="onSubmit",maxWidth:a=600,...I}){const{handleSubmit:x,trigger:r,formState:h,...S}=(0,g.mN)({mode:i,defaultValues:t});return(0,d.useEffect)(()=>{v&&r(c)},[r,c,v]),(0,n.jsx)("form",{className:(0,e.css)({maxWidth:a!=="none"?a+"px":a,width:"100%"}),onSubmit:x(f),...I,children:E({errors:h.errors,formState:h,trigger:r,...S})})}},65914(N,m,s){s.r(m),s.d(m,{UserInvitePage:()=>D,default:()=>L});var n=s(74848),e=s(92745),d=s(13791),g=s(15130),j=s(49785),t=s(90382),f=s(92138),v=s(36490),c=s(89640),E=s(16780),i=s(37386),a=s(63527),I=s(72636),x=s(41654),r=s(45967),h=s(30703),S=s(77824),y=s(21285),P=s(45861),B=s(65642),K=s(52763),O=s(74410),p=s(61666);const U=(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(e.x6,{i18nKey:"org.user-invite-form.tooltip",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)(c.Y,{href:"https://grafana.com/docs/grafana/latest/administration/roles-and-permissions/#organization-roles",variant:"bodySmall",external:!0,children:"our documentation"}),"."]})}),F=Object.values(t.X).map(o=>({label:o===t.X.None?"No basic role":o,value:o})),T={name:"",email:"",role:t.X.Editor,sendEmail:!0},C=()=>{const o=(0,K.wA)(),M=async l=>{await o((0,p.KU)(l)).unwrap(),v.Ny.push("/admin/users/")};return(0,n.jsx)(O.l,{defaultValues:T,onSubmit:M,children:({register:l,control:z,errors:u})=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(E.n,{children:[(0,n.jsx)(i.D,{invalid:!!u.loginOrEmail,error:u.loginOrEmail?"Email or username is required":void 0,label:(0,e.t)("org.user-invite-form.label-email-or-username","Email or username"),children:(0,n.jsx)(a.p,{...l("loginOrEmail",{required:!0}),placeholder:"email@example.com"})}),(0,n.jsx)(i.D,{invalid:!!u.name,label:(0,e.t)("org.user-invite-form.label-name","Name"),children:(0,n.jsx)(a.p,{...l("name"),placeholder:(0,e.t)("org.user-invite-form.placeholder-optional","(optional)")})}),(0,n.jsx)(i.D,{invalid:!!u.role,label:(0,n.jsx)(I.J,{children:(0,n.jsxs)(x.B,{gap:.5,children:[(0,n.jsx)("span",{children:(0,n.jsx)(e.x6,{i18nKey:"org.user-invite-form.role",children:"Role"})}),U&&(0,n.jsx)(r.m,{placement:"right-end",interactive:!0,content:U,children:(0,n.jsx)(h.I,{name:"info-circle",size:"xs"})})]})}),children:(0,n.jsx)(j.xI,{render:({field:{ref:Y,...A}})=>(0,n.jsx)(S.z,{...A,options:F}),control:z,name:"role"})}),(0,n.jsx)(i.D,{label:(0,e.t)("org.user-invite-form.label-send-invite-email","Send invite email"),children:(0,n.jsx)(y.d,{id:"send-email-switch",...l("sendEmail")})})]}),(0,n.jsxs)(x.B,{children:[(0,n.jsx)(P.$n,{type:"submit",children:(0,n.jsx)(e.x6,{i18nKey:"org.user-invite-form.submit",children:"Submit"})}),(0,n.jsx)(P.z9,{href:f.I.assureBaseUrl((0,B.zj)().appSubUrl+"/admin/users"),variant:"secondary",children:(0,n.jsx)(e.x6,{i18nKey:"org.user-invite-form.back",children:"Back"})})]})]})})};function D(){const o=(0,n.jsxs)(e.x6,{i18nKey:"org.user-invite-page.sub-title",values:{orgName:g.TP.user.orgName},children:["Send invitation or add existing Grafana user to the organization.",(0,n.jsxs)("span",{className:"highlight-word",children:[" ","{{orgName}}"]})]});return(0,n.jsx)(d.Y,{navId:"global-users",pageNav:{text:(0,e.t)("org.user-invite-page.text.invite-user","Invite user")},subTitle:o,children:(0,n.jsx)(d.Y.Contents,{children:(0,n.jsx)(C,{})})})}const L=D}}]);

//# sourceMappingURL=UserInvitePage.c294195d685b8252f0d6.js.map