X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2f83fcd45b4b23db2bb5bb4afbe1e863ebd77ec6..0f5b0542513b572959e39400bae42e69aeb1a7b6:/services/workbench2/src/views-components/data-explorer/renderers.tsx diff --git a/services/workbench2/src/views-components/data-explorer/renderers.tsx b/services/workbench2/src/views-components/data-explorer/renderers.tsx index d274157c48..251304075b 100644 --- a/services/workbench2/src/views-components/data-explorer/renderers.tsx +++ b/services/workbench2/src/views-components/data-explorer/renderers.tsx @@ -91,7 +91,7 @@ const renderName = (dispatch: Dispatch, item: GroupContentsResource) => { }; -const FrozenProject = (props: {item: ProjectResource}) => { +const FrozenProject = (props: { item: ProjectResource }) => { const [fullUsername, setFullusername] = React.useState(null); const getFullName = React.useCallback(() => { if (props.item.frozenByUuid) { @@ -102,7 +102,7 @@ const FrozenProject = (props: {item: ProjectResource}) => { if (props.item.frozenByUuid) { return Project was frozen by {fullUsername}}> - + ; } else { return null; @@ -115,7 +115,7 @@ export const ResourceName = connect( return resource; })((resource: GroupContentsResource & DispatchProp) => renderName(resource.dispatch, resource)); - + const renderIcon = (item: GroupContentsResource) => { switch (item.kind) { case ResourceKind.PROJECT: @@ -230,12 +230,12 @@ export const UserResourceFullName = connect( const renderUuid = (item: { uuid: string }) => {item.uuid} - {(item.uuid && ) || '-' } + {(item.uuid && ) || '-'} ; const renderUuidCopyIcon = (item: { uuid: string }) => - {(item.uuid && ) || '-' } + {(item.uuid && ) || '-'} ; export const ResourceUuid = connect((state: RootState, props: { uuid: string }) => ( @@ -617,11 +617,8 @@ export const ResourceLinkTailPermissionLevel = connect( const getResourceLinkCanManage = (state: RootState, link: LinkResource) => { const headResource = getResource(link.headUuid)(state.resources); - // const tailResource = getResource(link.tailUuid)(state.resources); - const userUuid = getUserUuid(state); - if (headResource && headResource.kind === ResourceKind.GROUP) { - return userUuid ? (headResource as GroupResource).writableBy?.includes(userUuid) : false; + return (headResource as GroupResource).canManage; } else { // true for now return true; @@ -687,12 +684,12 @@ const renderUuidLinkWithCopyIcon = (dispatch: Dispatch, item: ProcessResource, c const selectedColumnUuid = item[column] return - {selectedColumnUuid ? - dispatch(navigateTo(selectedColumnUuid))}> - {selectedColumnUuid} - - : '-' } + {selectedColumnUuid} + + : '-'} {selectedColumnUuid && renderUuidCopyIcon({ uuid: selectedColumnUuid })} @@ -716,20 +713,20 @@ export const ResourceParentProcess = connect( (state: RootState, props: { uuid: string }) => { const process = getProcess(props.uuid)(state.resources) return { parentProcess: process?.containerRequest?.requestingContainerUuid || '' }; - })((props: { parentProcess: string }) => renderUuid({uuid: props.parentProcess})); + })((props: { parentProcess: string }) => renderUuid({ uuid: props.parentProcess })); export const ResourceModifiedByUserUuid = connect( (state: RootState, props: { uuid: string }) => { const process = getProcess(props.uuid)(state.resources) return { userUuid: process?.containerRequest?.modifiedByUserUuid || '' }; - })((props: { userUuid: string }) => renderUuid({uuid: props.userUuid})); + })((props: { userUuid: string }) => renderUuid({ uuid: props.userUuid })); - export const ResourceCreatedAtDate = connect( +export const ResourceCreatedAtDate = connect( (state: RootState, props: { uuid: string }) => { const resource = getResource(props.uuid)(state.resources); return { date: resource ? resource.createdAt : '' }; })((props: { date: string }) => renderDate(props.date)); - + export const ResourceLastModifiedDate = connect( (state: RootState, props: { uuid: string }) => { const resource = getResource(props.uuid)(state.resources); @@ -787,39 +784,39 @@ export const ResourceUUID = connect( (state: RootState, props: { uuid: string }) => { const resource = getResource(props.uuid)(state.resources); return { uuid: resource ? resource.uuid : '' }; - })((props: { uuid: string }) => renderUuid({uuid: props.uuid})); + })((props: { uuid: string }) => renderUuid({ uuid: props.uuid })); -const renderVersion = (version: number) =>{ +const renderVersion = (version: number) => { return {version ?? '-'} } export const ResourceVersion = connect( (state: RootState, props: { uuid: string }) => { const resource = getResource(props.uuid)(state.resources); - return { version: resource ? resource.version: '' }; + return { version: resource ? resource.version : '' }; })((props: { version: number }) => renderVersion(props.version)); - -const renderPortableDataHash = (portableDataHash:string | null) => + +const renderPortableDataHash = (portableDataHash: string | null) => {portableDataHash ? <>{portableDataHash} - : '-' } + : '-'} - + export const ResourcePortableDataHash = connect( (state: RootState, props: { uuid: string }) => { const resource = getResource(props.uuid)(state.resources); - return { portableDataHash: resource ? resource.portableDataHash : '' }; + return { portableDataHash: resource ? resource.portableDataHash : '' }; })((props: { portableDataHash: string }) => renderPortableDataHash(props.portableDataHash)); -const renderFileCount = (fileCount: number) =>{ +const renderFileCount = (fileCount: number) => { return {fileCount ?? '-'} } export const ResourceFileCount = connect( (state: RootState, props: { uuid: string }) => { const resource = getResource(props.uuid)(state.resources); - return { fileCount: resource ? resource.fileCount: '' }; + return { fileCount: resource ? resource.fileCount : '' }; })((props: { fileCount: number }) => renderFileCount(props.fileCount)); const userFromID = @@ -968,12 +965,12 @@ export const CollectionStatus = connect((state: RootState, props: { uuid: string export const CollectionName = connect((state: RootState, props: { uuid: string, className?: string }) => { return { - collection: getResource(props.uuid)(state.resources), - uuid: props.uuid, - className: props.className, - }; + collection: getResource(props.uuid)(state.resources), + uuid: props.uuid, + className: props.className, + }; })((props: { collection: CollectionResource, uuid: string, className?: string }) => - {props.collection?.name || props.uuid} + {props.collection?.name || props.uuid} ); export const ProcessStatus = compose( @@ -994,7 +991,7 @@ export const ProcessStatus = compose( }} /> : - - ); + ); export const ProcessStartDate = connect( (state: RootState, props: { uuid: string }) => {