X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/3c7e3cdc547ad5468421e1c049daa94b0d4b8bc0..81e046c27b73760acc5bffd51019516a2bbad94c:/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 a8f375ae..f28f8aa0 100644 --- a/src/views-components/data-explorer/renderers.tsx +++ b/src/views-components/data-explorer/renderers.tsx @@ -232,11 +232,6 @@ export const TokenScopes = withResourceData('scopes', renderCommonData); export const TokenUserId = withResourceData('userId', renderCommonData); -// Compute Node Resources -const renderNodeInfo = (data: string) => { - return {JSON.stringify(data, null, 4)}; -}; - const clusterColors = [ ['#f44336', '#fff'], ['#2196f3', '#fff'], @@ -262,20 +257,6 @@ export const ResourceCluster = (props: { uuid: string }) => { }}>{clusterId}; }; -export const ComputeNodeInfo = withResourceData('info', renderNodeInfo); - -export const ComputeNodeDomain = withResourceData('domain', renderCommonData); - -export const ComputeNodeFirstPingAt = withResourceData('firstPingAt', renderCommonDate); - -export const ComputeNodeHostname = withResourceData('hostname', renderCommonData); - -export const ComputeNodeIpAddress = withResourceData('ipAddress', renderCommonData); - -export const ComputeNodeJobUuid = withResourceData('jobUuid', renderCommonData); - -export const ComputeNodeLastPingAt = withResourceData('lastPingAt', renderCommonDate); - // Links Resources const renderLinkName = (item: { name: string }) => {item.name || '(none)'}; @@ -444,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) { - ownerName = getUserFullname(resource as User) || (resource as GroupContentsResource).name; - } + if (resource) { + userFullname = getUserFullname(resource as User) || (resource as GroupContentsResource).name; + } - return { uuid: props.uuid, ownerName }; - }), + return { uuid: props.uuid, userFullname }; + }); + +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} @@ -469,7 +453,20 @@ export const ResourceOwnerWithName = } return - {ownerName} ({uuid}) + {userFullname} ({uuid}) + ; + }); + +export const UserNameFromID = + compose(userFromID)( + (props: { uuid: string, userFullname: string, dispatch: Dispatch }) => { + const { uuid, userFullname, dispatch } = props; + + if (userFullname === '') { + dispatch(loadResource(uuid, false)); + } + return + {userFullname ? userFullname : uuid} ; }); @@ -477,9 +474,9 @@ export const ResponsiblePerson = compose( connect( (state: RootState, props: { uuid: string, parentRef: HTMLElement | null }) => { - let responsiblePersonName = null; - let responsiblePersonUUID = null; - let responsiblePersonProperty = null; + let responsiblePersonName: string = ''; + let responsiblePersonUUID: string = ''; + let responsiblePersonProperty: string = ''; if (state.auth.config.clusterConfig.Collections.ManagedProperties) { let index = 0;