"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7707],{51767:(e,r,n)=>{n.r(r),n.d(r,{UserInvitePage:()=>B,default:()=>S});n(68404);var s,a=n(90894),i=n(98163),l=n(15830),t=n(98712),d=n(61692),o=n(64624),c=n(84719),u=n(1652),h=n(65586),m=n(96380),g=n(72786),j=n(74025),x=n(40920),b=n(78837),v=n(47570),p=n(69778),f=n(45916);const E=["ref"];const O=[{label:"Viewer",value:v.B5.Viewer},{label:"Editor",value:v.B5.Editor},{label:"Admin",value:v.B5.Admin}],w={name:"",email:"",role:v.B5.Editor,sendEmail:!0},I=()=>{const e=(0,v.I0)();return(0,f.jsx)(d.l,{defaultValues:w,onSubmit:async r=>{await e((0,p.MA)(r)).unwrap(),t.E1.push("/org/users/")},children:e=>{let{register:r,control:n,errors:a}=e;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.C,{children:[(0,f.jsx)(c.g,{invalid:!!a.loginOrEmail,error:a.loginOrEmail?"Email or username is required":void 0,label:"Email or username",children:(0,f.jsx)(u.I,Object.assign({},r("loginOrEmail",{required:!0}),{placeholder:"email@example.com"}))}),(0,f.jsx)(c.g,{invalid:!!a.name,label:"Name",children:(0,f.jsx)(u.I,Object.assign({},r("name"),{placeholder:"(optional)"}))}),(0,f.jsx)(c.g,{invalid:!!a.role,label:"Role",children:(0,f.jsx)(h.g,{render:e=>{let{}=e,r=function(e,r){if(null==e)return{};var n,s,a={},i=Object.keys(e);for(s=0;s<i.length;s++)n=i[s],r.indexOf(n)>=0||(a[n]=e[n]);return a}(e.field,E);return(0,f.jsx)(m.S,Object.assign({},r,{options:O}))},control:n,name:"role"})}),(0,f.jsx)(c.g,{label:"Send invite email",children:(0,f.jsx)(g.r,Object.assign({id:"send-email-switch"},r("sendEmail")))})]}),(0,f.jsxs)(j.K,{children:[s||(s=(0,f.jsx)(x.zx,{type:"submit",children:"Submit"})),(0,f.jsx)(x.Qj,{href:l.u.assureBaseUrl((0,b.iE)().appSubUrl+"/org/users"),variant:"secondary",children:"Back"})]})]})}})};var N,k;function B(){const e=(0,f.jsxs)(f.Fragment,{children:["Send invitation or add existing Grafana user to the organization.",(0,f.jsxs)("span",{className:"highlight-word",children:[" ",i.Vt.user.orgName]})]});return(0,f.jsx)(a.T,{navId:"users",pageNav:{text:"Invite user"},subTitle:e,children:(0,f.jsxs)(a.T.Contents,{children:[(0,f.jsxs)(a.T.OldNavOnly,{children:[N||(N=(0,f.jsx)("h3",{className:"page-sub-heading",children:"Invite user"})),(0,f.jsx)("div",{className:"p-b-2",children:e})]}),k||(k=(0,f.jsx)(I,{}))]})})}const S=B}}]);
//# sourceMappingURL=UserInvitePage.9c0dc6e2d25ef65b7652.js.map