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

//# sourceMappingURL=UserInvitePage-react19.c110d0c72072827c523d.js.map