"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7707],{39916:(e,n,r)=>{r.r(n),r.d(n,{UserInvitePage:()=>E,default:()=>w});r(76687);var i,a=r(46958),l=r(36131),s=r(31271),t=r(3276),o=r(19177),d=r(10967),c=r(70534),u=r(72e3),h=r(99462),m=r(6802),j=r(52010);const x=["ref"];const g=[{label:"Viewer",value:h.B5.Viewer},{label:"Editor",value:h.B5.Editor},{label:"Admin",value:h.B5.Admin}],p={name:"",email:"",role:h.B5.Editor,sendEmail:!0},v=()=>{const e=(0,h.I0)();return(0,j.jsx)(c.Form,{defaultValues:p,onSubmit:async n=>{await e((0,m.MA)(n)).unwrap(),d.locationService.push("/org/users/")},children:e=>{let{register:n,control:r,errors:a}=e;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Field,{invalid:!!a.loginOrEmail,error:a.loginOrEmail?"Email or username is required":void 0,label:"Email or username",children:(0,j.jsx)(c.Input,Object.assign({},n("loginOrEmail",{required:!0}),{placeholder:"email@example.com"}))}),(0,j.jsx)(c.Field,{invalid:!!a.name,label:"Name",children:(0,j.jsx)(c.Input,Object.assign({},n("name"),{placeholder:"(optional)"}))}),(0,j.jsx)(c.Field,{invalid:!!a.role,label:"Role",children:(0,j.jsx)(c.InputControl,{render:e=>{let{}=e,n=function(e,n){if(null==e)return{};var r,i,a={},l=Object.keys(e);for(i=0;i<l.length;i++)r=l[i],n.indexOf(r)>=0||(a[r]=e[r]);return a}(e.field,x);return(0,j.jsx)(c.RadioButtonGroup,Object.assign({},n,{options:g}))},control:r,name:"role"})}),(0,j.jsx)(c.Field,{label:"Send invite email",children:(0,j.jsx)(c.Switch,Object.assign({id:"send-email-switch"},n("sendEmail")))}),(0,j.jsxs)(c.HorizontalGroup,{children:[i||(i=(0,j.jsx)(c.Button,{type:"submit",children:"Submit"})),(0,j.jsx)(c.LinkButton,{href:o.locationUtil.assureBaseUrl((0,u.iE)().appSubUrl+"/org/users"),variant:"secondary",children:"Back"})]})]})}})};var b,f;const E=e=>{let{navModel:n}=e;return(0,j.jsx)(l.Z,{navModel:n,children:(0,j.jsxs)(l.Z.Contents,{children:[b||(b=(0,j.jsx)("h3",{className:"page-sub-heading",children:"Invite user"})),(0,j.jsxs)("div",{className:"p-b-2",children:["Send invitation or add existing Grafana user to the organization.",(0,j.jsxs)("span",{className:"highlight-word",children:[" ",s.Vt.user.orgName]})]}),f||(f=(0,j.jsx)(v,{}))]})})},w=(0,a.connect)((e=>({navModel:(0,t.h)(e.navIndex,"users")})))(E)}}]);
//# sourceMappingURL=UserInvitePage.d4d581d3610ea060e3ab.js.map