X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/160074ea7d482f01ac7f7ff31a5a9e076fe5420d..f6396d366359d62ec22ca7a0efd4bf22a395f933:/src/views-components/dialog-create/dialog-project-create.tsx

diff --git a/src/views-components/dialog-create/dialog-project-create.tsx b/src/views-components/dialog-create/dialog-project-create.tsx
index 34860599..65da87d3 100644
--- a/src/views-components/dialog-create/dialog-project-create.tsx
+++ b/src/views-components/dialog-create/dialog-project-create.tsx
@@ -7,21 +7,32 @@ import { InjectedFormProps } from 'redux-form';
 import { WithDialogProps } from 'store/dialog/with-dialog';
 import { ProjectCreateFormDialogData, PROJECT_CREATE_FORM_NAME } from 'store/projects/project-create-actions';
 import { FormDialog } from 'components/form-dialog/form-dialog';
-import { ProjectNameField, ProjectDescriptionField } from 'views-components/form-fields/project-form-fields';
+import { ProjectNameField, ProjectDescriptionField, UsersField } from 'views-components/form-fields/project-form-fields';
 import { CreateProjectPropertiesForm } from 'views-components/project-properties/create-project-properties-form';
 import { ResourceParentField } from '../form-fields/resource-form-fields';
 import { FormGroup, FormLabel } from '@material-ui/core';
 import { resourcePropertiesList } from 'views-components/resource-properties/resource-properties-list';
+import { GroupClass } from 'models/group';
 
-type DialogProjectProps = WithDialogProps<{}> & InjectedFormProps<ProjectCreateFormDialogData>;
+type DialogProjectProps = WithDialogProps<{sourcePanel: GroupClass}> & InjectedFormProps<ProjectCreateFormDialogData>;
 
-export const DialogProjectCreate = (props: DialogProjectProps) =>
-    <FormDialog
-        dialogTitle='New project'
-        formFields={ProjectAddFields}
-        submitLabel='Create a Project'
+export const DialogProjectCreate = (props: DialogProjectProps) => {
+    let title = 'New Project';
+    let fields = ProjectAddFields;
+    const sourcePanel = props.data.sourcePanel || '';
+
+    if (sourcePanel === GroupClass.ROLE) {
+        title = 'New Group';
+        fields = GroupAddFields;
+    }
+
+    return <FormDialog
+        dialogTitle={title}
+        formFields={fields}
+        submitLabel='Create'
         {...props}
     />;
+};
 
 const CreateProjectPropertiesList = resourcePropertiesList(PROJECT_CREATE_FORM_NAME);
 
@@ -35,3 +46,14 @@ const ProjectAddFields = () => <span>
         <CreateProjectPropertiesList />
     </FormGroup>
 </span>;
+
+const GroupAddFields = () => <span>
+    <ProjectNameField />
+    <UsersField />
+    <ProjectDescriptionField />
+    <FormLabel>Properties</FormLabel>
+    <FormGroup>
+        <CreateProjectPropertiesForm />
+        <CreateProjectPropertiesList />
+    </FormGroup>
+</span>;
