X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/6aaf65540506d590fa826b08166c050b924a99ff..680b1ffd3369fb60134ce84c4de5aaa35fb77411:/src/views-components/sharing-dialog/sharing-invitation-form-component.tsx?ds=sidebyside

diff --git a/src/views-components/sharing-dialog/sharing-invitation-form-component.tsx b/src/views-components/sharing-dialog/sharing-invitation-form-component.tsx
index f1eb177b..5aec8feb 100644
--- a/src/views-components/sharing-dialog/sharing-invitation-form-component.tsx
+++ b/src/views-components/sharing-dialog/sharing-invitation-form-component.tsx
@@ -3,13 +3,10 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from 'react';
-import { Field, WrappedFieldProps } from 'redux-form';
-import { Grid, Input, FormControl, FormHelperText, FormLabel, InputLabel, Chip } from '@material-ui/core';
-import { ChipsInput } from '~/components/chips-input/chips-input';
-import { identity } from 'lodash';
-import { PermissionSelect } from './permission-select';
-import { PeopleSelect } from './people-select';
-import ChipInput from 'material-ui-chip-input';
+import { Field, WrappedFieldProps, FieldArray, WrappedFieldArrayProps } from 'redux-form';
+import { Grid, FormControl, InputLabel } from '@material-ui/core';
+import { PermissionSelect, parsePermissionLevel, formatPermissionLevel } from './permission-select';
+import { PeopleSelect, Person } from './people-select';
 
 export default () =>
     <Grid container spacing={8}>
@@ -22,18 +19,23 @@ export default () =>
     </Grid>;
 
 const InvitedPeopleField = () =>
-    <Field
+    <FieldArray
         name='invitedPeople'
         component={InvitedPeopleFieldComponent} />;
 
 
-const InvitedPeopleFieldComponent = (props: WrappedFieldProps) =>
-    <PeopleSelect suggestedPeople={[]} />;
+const InvitedPeopleFieldComponent = ({ fields }: WrappedFieldArrayProps<Person>) =>
+    <PeopleSelect
+        items={fields.getAll() || []}
+        onSelect={fields.push}
+        onDelete={fields.remove} />;
 
 const PermissionSelectField = () =>
     <Field
-        name='permission'
-        component={PermissionSelectComponent} />;
+        name='permissions'
+        component={PermissionSelectComponent}
+        format={formatPermissionLevel}
+        parse={parsePermissionLevel} />;
 
 const PermissionSelectComponent = ({ input }: WrappedFieldProps) =>
     <FormControl fullWidth>
