X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/e83d929135335433aca0e47b5892c7c60ffa394f..c6ccae902b16d7ff421e87f1b9c3578ef8a4334e:/src/views-components/data-explorer/renderers.tsx diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx index 6d95196d..6cf29fae 100644 --- a/src/views-components/data-explorer/renderers.tsx +++ b/src/views-components/data-explorer/renderers.tsx @@ -20,13 +20,14 @@ import { WorkflowResource } from '~/models/workflow'; import { ResourceStatus as WorkflowStatus } from '~/views/workflow-panel/workflow-panel-view'; import { getUuidPrefix, openRunProcess } from '~/store/workflow-panel/workflow-panel-actions'; import { openSharingDialog } from '~/store/sharing-dialog/sharing-dialog-actions'; -import { UserResource } from '~/models/user'; +import { getUserFullname, User, UserResource } from '~/models/user'; import { toggleIsActive, toggleIsAdmin } from '~/store/users/users-actions'; import { LinkResource } from '~/models/link'; import { navigateTo } from '~/store/navigation/navigation-action'; import { withResourceData } from '~/views-components/data-explorer/with-resources'; import { CollectionResource } from '~/models/collection'; import { IllegalNamingWarning } from '~/components/warning/warning'; +import { loadResource } from '~/store/resources/resources-actions'; const renderName = (dispatch: Dispatch, item: GroupContentsResource) => @@ -434,6 +435,35 @@ 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); + + if (resource) { + ownerName = getUserFullname(resource as User) || (resource as GroupContentsResource).name; + } + + return { uuid: props.uuid, ownerName }; + }), + withStyles({}, { withTheme: true })) + ((props: { uuid: string, ownerName: string, dispatch: Dispatch, theme: ArvadosTheme }) => { + const { uuid, ownerName, dispatch, theme } = props; + + if (ownerName === '') { + dispatch(loadResource(uuid, false)); + return + {uuid} + ; + } + + return + {ownerName} ({uuid}) + ; + }); + const renderType = (type: string) => {resourceLabel(type)} @@ -446,20 +476,20 @@ export const ResourceType = connect( })((props: { type: string }) => renderType(props.type)); export const ResourceStatus = connect((state: RootState, props: { uuid: string }) => { - return { resource: getResource(props.uuid)(state.resources) }; - })((props: { resource: GroupContentsResource }) => - (props.resource && props.resource.kind === ResourceKind.COLLECTION) + return { resource: getResource(props.uuid)(state.resources) }; +})((props: { resource: GroupContentsResource }) => + (props.resource && props.resource.kind === ResourceKind.COLLECTION) ? : - ); +); export const CollectionStatus = connect((state: RootState, props: { uuid: string }) => { - return { collection: getResource(props.uuid)(state.resources) }; - })((props: { collection: CollectionResource }) => - (props.collection.uuid !== props.collection.currentVersionUuid) + return { collection: getResource(props.uuid)(state.resources) }; +})((props: { collection: CollectionResource }) => + (props.collection.uuid !== props.collection.currentVersionUuid) ? version {props.collection.version} : head version - ); +); export const ProcessStatus = compose( connect((state: RootState, props: { uuid: string }) => { @@ -478,7 +508,7 @@ export const ProcessStatus = compose( export const ProcessStartDate = connect( (state: RootState, props: { uuid: string }) => { const process = getProcess(props.uuid)(state.resources); - return { date: ( process && process.container ) ? process.container.startedAt : '' }; + return { date: (process && process.container) ? process.container.startedAt : '' }; })((props: { date: string }) => renderDate(props.date)); export const renderRunTime = (time: number) =>