X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/dd315a23e98b926d4d15b9d05f1aaa1e211548a4..670d92f78e9af2390b93e5d984f5fabf59a16071:/src/views-components/details-panel/project-details.tsx

diff --git a/src/views-components/details-panel/project-details.tsx b/src/views-components/details-panel/project-details.tsx
index 1be04b00..c3c3d68e 100644
--- a/src/views-components/details-panel/project-details.tsx
+++ b/src/views-components/details-panel/project-details.tsx
@@ -2,24 +2,29 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
+import React from 'react';
 import { connect } from 'react-redux';
-import { openProjectPropertiesDialog } from '~/store/details-panel/details-panel-action';
-import { ProjectIcon, RenameIcon } from '~/components/icon/icon';
-import { ProjectResource } from '~/models/project';
-import { formatDate } from '~/common/formatters';
-import { ResourceKind } from '~/models/resource';
-import { resourceLabel } from '~/common/labels';
+import { ProjectIcon, RenameIcon, FilterGroupIcon } from 'components/icon/icon';
+import { ProjectResource } from 'models/project';
+import { formatDate } from 'common/formatters';
+import { ResourceKind } from 'models/resource';
+import { resourceLabel } from 'common/labels';
 import { DetailsData } from "./details-data";
-import { DetailsAttribute } from "~/components/details-attribute/details-attribute";
-import { RichTextEditorLink } from '~/components/rich-text-editor-link/rich-text-editor-link';
-import { withStyles, StyleRulesCallback, WithStyles } from '@material-ui/core';
-import { ArvadosTheme } from '~/common/custom-theme';
+import { DetailsAttribute } from "components/details-attribute/details-attribute";
+import { RichTextEditorLink } from 'components/rich-text-editor-link/rich-text-editor-link';
+import { withStyles, StyleRulesCallback, WithStyles, Button } from '@material-ui/core';
+import { ArvadosTheme } from 'common/custom-theme';
 import { Dispatch } from 'redux';
 import { getPropertyChip } from '../resource-properties-form/property-chip';
+import { ResourceOwnerWithName } from '../data-explorer/renderers';
+import { GroupClass } from "models/group";
+import { openProjectUpdateDialog, ProjectUpdateFormDialogData } from 'store/projects/project-update-actions';
 
 export class ProjectDetails extends DetailsData<ProjectResource> {
     getIcon(className?: string) {
+        if (this.item.groupClass === GroupClass.FILTER) {
+            return <FilterGroupIcon className={className} />;
+        }
         return <ProjectIcon className={className} />;
     }
 
@@ -36,8 +41,8 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
         marginBottom: theme.spacing.unit
     },
     editIcon: {
+        paddingRight: theme.spacing.unit/2,
         fontSize: '1.125rem',
-        cursor: 'pointer'
     }
 });
 
@@ -46,11 +51,12 @@ interface ProjectDetailsComponentDataProps {
 }
 
 interface ProjectDetailsComponentActionProps {
-    onClick: () => void;
+    onClick: (prj: ProjectUpdateFormDialogData) => () => void;
 }
 
 const mapDispatchToProps = (dispatch: Dispatch) => ({
-    onClick: () => dispatch<any>(openProjectPropertiesDialog()),
+    onClick: (prj: ProjectUpdateFormDialogData) =>
+        () => dispatch<any>(openProjectUpdateDialog(prj)),
 });
 
 type ProjectDetailsComponentProps = ProjectDetailsComponentDataProps & ProjectDetailsComponentActionProps & WithStyles<CssRules>;
@@ -58,15 +64,23 @@ type ProjectDetailsComponentProps = ProjectDetailsComponentDataProps & ProjectDe
 const ProjectDetailsComponent = connect(null, mapDispatchToProps)(
     withStyles(styles)(
         ({ classes, project, onClick }: ProjectDetailsComponentProps) => <div>
-            <DetailsAttribute label='Type' value={resourceLabel(ResourceKind.PROJECT)} />
-            {/* Missing attr */}
-            <DetailsAttribute label='Size' value='---' />
-            <DetailsAttribute label='Owner' linkToUuid={project.ownerUuid} lowercaseValue={true} />
+            {project.groupClass !== GroupClass.FILTER ?
+                    <Button onClick={onClick({
+                        uuid: project.uuid,
+                        name: project.name,
+                        description: project.description,
+                        properties: project.properties,
+                    })}>
+                        <RenameIcon className={classes.editIcon} /> Edit
+                    </Button>
+                    : ''
+                }
+            <DetailsAttribute label='Type' value={project.groupClass === GroupClass.FILTER ? 'Filter group' : resourceLabel(ResourceKind.PROJECT)} />
+            <DetailsAttribute label='Owner' linkToUuid={project.ownerUuid}
+                uuidEnhancer={(uuid: string) => <ResourceOwnerWithName uuid={uuid} />} />
             <DetailsAttribute label='Last modified' value={formatDate(project.modifiedAt)} />
             <DetailsAttribute label='Created at' value={formatDate(project.createdAt)} />
-            <DetailsAttribute label='Project UUID' linkToUuid={project.uuid} value={project.uuid} />
-            {/* Missing attr */}
-            {/*<DetailsAttribute label='File size' value='1.4 GB' />*/}
+            <DetailsAttribute label='UUID' linkToUuid={project.uuid} value={project.uuid} />
             <DetailsAttribute label='Description'>
                 {project.description ?
                     <RichTextEditorLink
@@ -76,11 +90,7 @@ const ProjectDetailsComponent = connect(null, mapDispatchToProps)(
                     : '---'
                 }
             </DetailsAttribute>
-            <DetailsAttribute label='Properties'>
-                <div onClick={onClick}>
-                    <RenameIcon className={classes.editIcon} />
-                </div>
-            </DetailsAttribute>
+            <DetailsAttribute label='Properties' />
             {
                 Object.keys(project.properties).map(k =>
                     Array.isArray(project.properties[k])
