Init people select backend connection
[arvados-workbench2.git] / src / views-components / sharing-dialog / sharing-invitation-form-component.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import * as React from 'react';
6 import { Field, WrappedFieldProps } from 'redux-form';
7 import { Grid, FormControl, InputLabel } from '@material-ui/core';
8 import { PermissionSelect } from './permission-select';
9 import { PeopleSelect } from './people-select';
10
11 export default () =>
12     <Grid container spacing={8}>
13         <Grid item xs={8}>
14             <InvitedPeopleField />
15         </Grid>
16         <Grid item xs={4}>
17             <PermissionSelectField />
18         </Grid>
19     </Grid>;
20
21 const InvitedPeopleField = () =>
22     <Field
23         name='invitedPeople'
24         component={InvitedPeopleFieldComponent} />;
25
26
27 const InvitedPeopleFieldComponent = (props: WrappedFieldProps) =>
28     <PeopleSelect />;
29
30 const PermissionSelectField = () =>
31     <Field
32         name='permission'
33         component={PermissionSelectComponent} />;
34
35 const PermissionSelectComponent = ({ input }: WrappedFieldProps) =>
36     <FormControl fullWidth>
37         <InputLabel>Authorization</InputLabel>
38         <PermissionSelect {...input} />
39     </FormControl>;