"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7707],{51767:(e,n,r)=>{r.r(n),r.d(n,{UserInvitePage:()=>E,default:()=>w});r(68404);var i,a=r(18745),l=r(33801),s=r(98163),t=r(8674),o=r(43215),d=r(90923),c=r(69783),u=r(78837),h=r(58170),m=r(69778),j=r(45916);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=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.ea401ee0d9c9313802ae.js.map