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,eAAQC,GAAG,qBAAwBjB,EAAS,kBAE9C,UAAC,EAAAkB,gBAAD,kBACE,SAAC,EAAAC,OAAD,CAAQC,KAAK,SAAb,sBACA,SAAC,EAAAC,WAAD,CAAYC,KAAMC,EAAAA,aAAAA,eAA2BC,EAAAA,EAAAA,MAAYC,UAAY,cAAeC,QAAQ,YAA5F,4B,QC7DP,MAAMC,EAA4B,IAAkB,IAAjB,SAAEC,GAAe,EACzD,OACE,SAACC,EAAA,EAAD,CAAMD,SAAUA,EAAhB,UACE,UAACC,EAAA,WAAD,kBACE,eAAIC,UAAU,mBAAd,2BACA,iBAAKA,UAAU,QAAf,+EAEE,kBAAMA,UAAU,iBAAhB,cAAmCC,EAAAA,GAAAA,KAAAA,cAJvC,OAME,SAAC,EAAD,WAUR,GAAeC,EAAAA,EAAAA,UAJUC,IAAD,CACtBL,UAAUM,EAAAA,EAAAA,GAAYD,EAAME,SAAU,YAGxC,CAAwCR","sources":["webpack://grafana/./public/app/features/org/UserInviteForm.tsx","webpack://grafana/./public/app/features/org/UserInvitePage.tsx"],"sourcesContent":["import React from 'react';\n\nimport { locationUtil } from '@grafana/data';\nimport { locationService } from '@grafana/runtime';\nimport {\n HorizontalGroup,\n Button,\n LinkButton,\n Input,\n Switch,\n RadioButtonGroup,\n Form,\n Field,\n InputControl,\n} from '@grafana/ui';\nimport { getConfig } from 'app/core/config';\nimport { OrgRole, useDispatch } from 'app/types';\n\nimport { addInvitee } from '../invites/state/actions';\n\nconst roles = [\n { label: 'Viewer', value: OrgRole.Viewer },\n { label: 'Editor', value: OrgRole.Editor },\n { label: 'Admin', value: OrgRole.Admin },\n];\n\nexport interface FormModel {\n role: OrgRole;\n name: string;\n loginOrEmail?: string;\n sendEmail: boolean;\n email: string;\n}\n\nconst defaultValues: FormModel = {\n name: '',\n email: '',\n role: OrgRole.Editor,\n sendEmail: true,\n};\n\nexport const UserInviteForm = () => {\n const dispatch = useDispatch();\n\n const onSubmit = async (formData: FormModel) => {\n await dispatch(addInvitee(formData)).unwrap();\n locationService.push('/org/users/');\n };\n\n return (\n <Form defaultValues={defaultValues} onSubmit={onSubmit}>\n {({ register, control, errors }) => {\n return (\n <>\n <Field\n invalid={!!errors.loginOrEmail}\n error={!!errors.loginOrEmail ? 'Email or username is required' : undefined}\n label=\"Email or username\"\n >\n <Input {...register('loginOrEmail', { required: true })} placeholder=\"email@example.com\" />\n </Field>\n <Field invalid={!!errors.name} label=\"Name\">\n <Input {...register('name')} placeholder=\"(optional)\" />\n </Field>\n <Field invalid={!!errors.role} label=\"Role\">\n <InputControl\n render={({ field: { ref, ...field } }) => <RadioButtonGroup {...field} options={roles} />}\n control={control}\n name=\"role\"\n />\n </Field>\n <Field label=\"Send invite email\">\n <Switch id=\"send-email-switch\" {...register('sendEmail')} />\n </Field>\n <HorizontalGroup>\n <Button type=\"submit\">Submit</Button>\n <LinkButton href={locationUtil.assureBaseUrl(getConfig().appSubUrl + '/org/users')} variant=\"secondary\">\n Back\n </LinkButton>\n </HorizontalGroup>\n </>\n );\n }}\n </Form>\n );\n};\n\nexport default UserInviteForm;\n","import React, { FC } from 'react';\nimport { connect } from 'react-redux';\n\nimport { NavModel } from '@grafana/data';\nimport Page from 'app/core/components/Page/Page';\nimport { contextSrv } from 'app/core/core';\nimport { getNavModel } from 'app/core/selectors/navModel';\nimport { StoreState } from 'app/types/store';\n\nimport UserInviteForm from './UserInviteForm';\n\ninterface Props {\n navModel: NavModel;\n}\n\nexport const UserInvitePage: FC<Props> = ({ navModel }) => {\n return (\n <Page navModel={navModel}>\n <Page.Contents>\n <h3 className=\"page-sub-heading\">Invite user</h3>\n <div className=\"p-b-2\">\n Send invitation or add existing Grafana user to the organization.\n <span className=\"highlight-word\"> {contextSrv.user.orgName}</span>\n </div>\n <UserInviteForm />\n </Page.Contents>\n </Page>\n );\n};\n\nconst mapStateToProps = (state: StoreState) => ({\n navModel: getNavModel(state.navIndex, 'users'),\n});\n\nexport default connect(mapStateToProps)(UserInvitePage);\n"],"names":["roles","label","value","OrgRole","defaultValues","name","email","role","sendEmail","dispatch","useDispatch","Form","onSubmit","async","addInvitee","formData","unwrap","locationService","register","control","errors","Field","invalid","loginOrEmail","error","undefined","Input","required","placeholder","InputControl","render","field","RadioButtonGroup","options","Switch","id","HorizontalGroup","Button","type","LinkButton","href","locationUtil","getConfig","appSubUrl","variant","UserInvitePage","navModel","Page","className","contextSrv","connect","state","getNavModel","navIndex"],"sourceRoot":""}