X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/8df7e312b38b8e01bfac8c719b0f883cf866c2c8..ea1216cb8346848cb2f8dd09fda14803c83d3557:/src/components/details-attribute/details-attribute.tsx diff --git a/src/components/details-attribute/details-attribute.tsx b/src/components/details-attribute/details-attribute.tsx index 18d0d8b797..7633b71a45 100644 --- a/src/components/details-attribute/details-attribute.tsx +++ b/src/components/details-attribute/details-attribute.tsx @@ -20,24 +20,21 @@ type CssRules = 'attribute' | 'label' | 'value' | 'lowercaseValue' | 'link' | 'c const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ attribute: { - display: 'flex', - alignItems: 'flex-start' + marginBottom: ".6 rem" }, label: { boxSizing: 'border-box', color: theme.palette.grey["500"], - width: '40%' + width: '100%' }, value: { boxSizing: 'border-box', - width: '60%', alignItems: 'flex-start' }, lowercaseValue: { textTransform: 'lowercase' }, link: { - width: '60%', color: theme.palette.primary.main, textDecoration: 'none', overflowWrap: 'break-word', @@ -45,9 +42,12 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ }, copyIcon: { marginLeft: theme.spacing.unit, - fontSize: '1.125rem', color: theme.palette.grey["500"], - cursor: 'pointer' + cursor: 'pointer', + display: 'inline', + '& svg': { + fontSize: '1rem' + } } }); @@ -61,6 +61,8 @@ interface DetailsAttributeDataProps { children?: React.ReactNode; onValueClick?: () => void; linkToUuid?: string; + copyValue?: string; + uuidEnhancer?: Function; } type DetailsAttributeProps = DetailsAttributeDataProps & WithStyles & FederationConfig & DispatchProp; @@ -83,35 +85,39 @@ export const DetailsAttribute = connect(mapStateToProps)(withStyles(styles)( } render() { - const { label, link, value, children, classes, classLabel, + const { uuidEnhancer, label, link, value, children, classes, classLabel, classValue, lowercaseValue, onValueClick, linkToUuid, - localCluster, remoteHostsConfig, sessions } = this.props; + localCluster, remoteHostsConfig, sessions, copyValue } = this.props; let valueNode: React.ReactNode; if (linkToUuid) { + const uuid = uuidEnhancer ? uuidEnhancer(linkToUuid) : linkToUuid; const linkUrl = getNavUrl(linkToUuid || "", { localCluster, remoteHostsConfig, sessions }); if (linkUrl[0] === '/') { - valueNode = {linkToUuid}; + valueNode = {uuid}; } else { - valueNode = {linkToUuid}; + valueNode = {uuid}; } } else if (link) { valueNode = {value}; } else { valueNode = value; } + return - {label} + {label} {valueNode} {children} - {linkToUuid && - this.onCopy("Copied")}> - - + {(linkToUuid || copyValue) && + + this.onCopy("Copied")}> + + + } ;