[ARVADOS-WORKBENCH2] created: 2.1.0-366-g3efbabfc

Git user git at public.arvados.org
Fri May 7 21:25:51 UTC 2021


        at  3efbabfcd06a10b83f1f130141d6c1f6017037cf (commit)


commit 3efbabfcd06a10b83f1f130141d6c1f6017037cf
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date:   Fri May 7 23:24:38 2021 +0200

    16647: Added the responsible person renderer
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>

diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx
index 93abb15e..71d6f824 100644
--- a/src/views-components/data-explorer/renderers.tsx
+++ b/src/views-components/data-explorer/renderers.tsx
@@ -5,7 +5,7 @@
 import * as React from 'react';
 import { Grid, Typography, withStyles, Tooltip, IconButton, Checkbox } from '@material-ui/core';
 import { FavoriteStar, PublicFavoriteStar } from '../favorite-star/favorite-star';
-import { ResourceKind, TrashableResource } from '~/models/resource';
+import { Resource, ResourceKind, TrashableResource } from '~/models/resource';
 import { ProjectIcon, FilterGroupIcon, CollectionIcon, ProcessIcon, DefaultIcon, ShareIcon, CollectionOldVersionIcon, WorkflowIcon } from '~/components/icon/icon';
 import { formatDate, formatFileSize, formatTime } from '~/common/formatters';
 import { resourceLabel } from '~/common/labels';
@@ -468,6 +468,38 @@ export const ResourceOwnerWithName =
             </Typography>;
         });
 
+export const ResponsiblePerson =
+    compose(
+        connect(
+            (state: RootState, props: { uuid: string }) => {
+                let responsiblePersonName = '';
+                let resource: Resource | undefined = getResource<GroupContentsResource & UserResource>(props.uuid)(state.resources);
+
+                while (resource && resource.kind !== ResourceKind.USER) {
+                    resource = getResource<GroupContentsResource & UserResource>(resource.ownerUuid)(state.resources);
+                }
+
+                if (resource && resource.kind === ResourceKind.USER) {
+                    responsiblePersonName = getUserFullname(resource as UserResource) || (resource as GroupContentsResource).name;
+                }
+
+                return { uuid: props.uuid, responsiblePersonName };
+            }),
+        withStyles({}, { withTheme: true }))
+        ((props: { uuid: string, responsiblePersonName: string, theme: ArvadosTheme }) => {
+            const { uuid, responsiblePersonName, theme } = props;
+
+            if (responsiblePersonName === '') {
+                return <Typography style={{ color: theme.palette.primary.main }} inline noWrap>
+                    {uuid}
+                </Typography>;
+            }
+
+            return <Typography style={{ color: theme.palette.primary.main }} inline noWrap>
+                {responsiblePersonName} ({uuid})
+                </Typography>;
+        });
+
 const renderType = (type: string, subtype: string) =>
     <Typography noWrap>
         {resourceLabel(type, subtype)}
diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx
index 7d54992e..45053932 100644
--- a/src/views/collection-panel/collection-panel.tsx
+++ b/src/views/collection-panel/collection-panel.tsx
@@ -32,7 +32,7 @@ import { getProgressIndicator } from '~/store/progress-indicator/progress-indica
 import { COLLECTION_PANEL_LOAD_FILES, loadCollectionFiles, COLLECTION_PANEL_LOAD_FILES_THRESHOLD } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions';
 import { Link } from 'react-router-dom';
 import { Link as ButtonLink } from '@material-ui/core';
-import { ResourceOwnerWithName } from '~/views-components/data-explorer/renderers';
+import { ResourceOwnerWithName, ResponsiblePerson } from '~/views-components/data-explorer/renderers';
 
 type CssRules = 'root'
     | 'button'
@@ -301,6 +301,11 @@ export const CollectionDetailsAttributes = (props: { item: CollectionResource, t
                 label='Owner' linkToUuid={item.ownerUuid}
                 uuidEnhancer={(uuid: string) => <ResourceOwnerWithName uuid={uuid} />} />
         </Grid>
+        <Grid item xs={12} md={mdSize}>
+            <DetailsAttribute classLabel={classes.label} classValue={classes.value}
+                label='Responsible person' linkToUuid={item.ownerUuid}
+                uuidEnhancer={(uuid: string) => <ResponsiblePerson uuid={item.ownerUuid} />} />
+        </Grid>
         <Grid item xs={12} md={mdSize}>
             <DetailsAttribute classLabel={classes.label} classValue={classes.value}
                 label='Head version'

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list