X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/25216cc7acedc987c26a159f0b640210c0ef101e..ef8180fa2f0b90b1656b1d8c7ef12bc6ea028a0a:/src/views-components/dialog-update/dialog-project-update.tsx

diff --git a/src/views-components/dialog-update/dialog-project-update.tsx b/src/views-components/dialog-update/dialog-project-update.tsx
index f67279b5..a6ac65b1 100644
--- a/src/views-components/dialog-update/dialog-project-update.tsx
+++ b/src/views-components/dialog-update/dialog-project-update.tsx
@@ -2,24 +2,62 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
+import React from 'react';
 import { InjectedFormProps } from 'redux-form';
 import { WithDialogProps } from 'store/dialog/with-dialog';
-import { ProjectUpdateFormDialogData } from 'store/projects/project-update-actions';
+import { ProjectUpdateFormDialogData, PROJECT_UPDATE_FORM_NAME } from 'store/projects/project-update-actions';
 import { FormDialog } from 'components/form-dialog/form-dialog';
 import { ProjectNameField, ProjectDescriptionField } from 'views-components/form-fields/project-form-fields';
+import { GroupClass } from 'models/group';
+import { FormGroup, FormLabel, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
+import { UpdateProjectPropertiesForm } from 'views-components/project-properties/update-project-properties-form';
+import { resourcePropertiesList } from 'views-components/resource-properties/resource-properties-list';
 
-type DialogProjectProps = WithDialogProps<{}> & InjectedFormProps<ProjectUpdateFormDialogData>;
+type CssRules = 'propertiesForm' | 'description';
 
-export const DialogProjectUpdate = (props: DialogProjectProps) =>
-    <FormDialog
-        dialogTitle='Edit Project'
-        formFields={ProjectEditFields}
+const styles: StyleRulesCallback<CssRules> = theme => ({
+    propertiesForm: {
+        marginTop: theme.spacing.unit * 2,
+        marginBottom: theme.spacing.unit * 2,
+    },
+    description: {
+        marginTop: theme.spacing.unit * 2,
+        marginBottom: theme.spacing.unit * 2,
+    },
+});
+
+type DialogProjectProps = WithDialogProps<{sourcePanel: GroupClass}> & InjectedFormProps<ProjectUpdateFormDialogData>;
+
+export const DialogProjectUpdate = (props: DialogProjectProps) => {
+    let title = 'Edit Project';
+    const sourcePanel = props.data.sourcePanel || '';
+
+    if (sourcePanel === GroupClass.ROLE) {
+        title = 'Edit Group';
+    }
+
+    return <FormDialog
+        dialogTitle={title}
+        formFields={ProjectEditFields as any}
         submitLabel='Save'
         {...props}
     />;
+};
+
+const UpdateProjectPropertiesList = resourcePropertiesList(PROJECT_UPDATE_FORM_NAME);
 
-const ProjectEditFields = () => <span>
-    <ProjectNameField />
-    <ProjectDescriptionField />
-</span>;
+// Also used as "Group Edit Fields"
+const ProjectEditFields = withStyles(styles)(
+    ({ classes }: WithStyles<CssRules>) => <span>
+        <ProjectNameField />
+        <div className={classes.description}>
+            <ProjectDescriptionField />
+        </div>
+        <div className={classes.propertiesForm}>
+            <FormLabel>Properties</FormLabel>
+            <FormGroup>
+                <UpdateProjectPropertiesForm />
+                <UpdateProjectPropertiesList />
+            </FormGroup>
+        </div>
+    </span>);
