From 4541e7e78a5fbbad1e34cf215fa7f2fa4d40e88d Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Mon, 9 Aug 2021 21:26:41 -0400 Subject: [PATCH] 17532: Add modifiedByUser to collection details version history table Arvados-DCO-1.1-Signed-off-by: Stephen Smith --- .../data-explorer/renderers.tsx | 48 +++++++++++++------ .../details-panel/collection-details.tsx | 21 ++++++-- 2 files changed, 49 insertions(+), 20 deletions(-) diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx index 314390e2..4a56b142 100644 --- a/src/views-components/data-explorer/renderers.tsx +++ b/src/views-components/data-explorer/renderers.tsx @@ -425,24 +425,27 @@ export const ResourceOwnerName = connect( return { owner: ownerName ? ownerName!.name : resource!.ownerUuid }; })((props: { owner: string }) => renderOwner(props.owner)); -export const ResourceOwnerWithName = - compose( - connect( - (state: RootState, props: { uuid: string }) => { - let ownerName = ''; - const resource = getResource(props.uuid)(state.resources); +const userFromID = + connect( + (state: RootState, props: { uuid: string }) => { + let userFullname = ''; + const resource = getResource(props.uuid)(state.resources); + + if (resource) { + userFullname = getUserFullname(resource as User) || (resource as GroupContentsResource).name; + } - if (resource) { - ownerName = getUserFullname(resource as User) || (resource as GroupContentsResource).name; - } + return { uuid: props.uuid, userFullname }; + }); - return { uuid: props.uuid, ownerName }; - }), +export const ResourceOwnerWithName = + compose( + userFromID, withStyles({}, { withTheme: true })) - ((props: { uuid: string, ownerName: string, dispatch: Dispatch, theme: ArvadosTheme }) => { - const { uuid, ownerName, dispatch, theme } = props; + ((props: { uuid: string, userFullname: string, dispatch: Dispatch, theme: ArvadosTheme }) => { + const { uuid, userFullname, dispatch, theme } = props; - if (ownerName === '') { + if (userFullname === '') { dispatch(loadResource(uuid, false)); return {uuid} @@ -450,7 +453,22 @@ export const ResourceOwnerWithName = } return - {ownerName} ({uuid}) + {userFullname} ({uuid}) + ; + }); + +export const UserNameFromID = + compose( + userFromID, + withStyles({}, { withTheme: true })) + ((props: { uuid: string, userFullname: string, dispatch: Dispatch }) => { + const { uuid, userFullname, dispatch } = props; + + if (userFullname === '') { + dispatch(loadResource(uuid, false)); + } + return + {userFullname ? userFullname : uuid} ; }); diff --git a/src/views-components/details-panel/collection-details.tsx b/src/views-components/details-panel/collection-details.tsx index c61b3340..0d4fce51 100644 --- a/src/views-components/details-panel/collection-details.tsx +++ b/src/views-components/details-panel/collection-details.tsx @@ -12,6 +12,7 @@ import { filterResources, getResource } from 'store/resources/resources'; import { connect } from 'react-redux'; import { Grid, ListItem, StyleRulesCallback, Typography, withStyles, WithStyles } from '@material-ui/core'; import { formatDate, formatFileSize } from 'common/formatters'; +import { UserNameFromID } from '../data-explorer/renderers'; import { Dispatch } from 'redux'; import { navigateTo } from 'store/navigation/navigation-action'; import { openContextMenu, resourceUuidToContextMenuKind } from 'store/context-menu/context-menu-actions'; @@ -108,12 +109,17 @@ const CollectionVersionBrowser = withStyles(styles)( Nr - + Size - + + + User + + + Date @@ -132,12 +138,17 @@ const CollectionVersionBrowser = withStyles(styles)( {item.version} - + {formatFileSize(item.fileSizeTotal)} - + + + + + + {formatDate(item.modifiedAt)} @@ -147,4 +158,4 @@ const CollectionVersionBrowser = withStyles(styles)( })} ; - })); \ No newline at end of file + })); -- 2.30.2