From: Peter Amstutz Date: Thu, 5 Nov 2020 04:32:52 +0000 (-0500) Subject: 16719: Revise layout for collection panel. X-Git-Tag: 2.1.1~7^2~3^2 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/bcb55ad2005ab4dc8c97624c1f56d410c36d15c2 16719: Revise layout for collection panel. Use responsive two-column layout. Stack label and value instead of side-by-side. Fix styling of "Copy to clipboard" icon. Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- diff --git a/src/common/formatters.ts b/src/common/formatters.ts index 1386338c..55fb0507 100644 --- a/src/common/formatters.ts +++ b/src/common/formatters.ts @@ -28,7 +28,7 @@ export const formatFileSize = (size?: number) => { } } } - return ""; + return "0 B"; }; export const formatTime = (time: number, seconds?: boolean) => { diff --git a/src/components/details-attribute/details-attribute.tsx b/src/components/details-attribute/details-attribute.tsx index 18d0d8b7..4b8ee837 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' + } } }); @@ -101,17 +101,19 @@ export const DetailsAttribute = connect(mapStateToProps)(withStyles(styles)( valueNode = value; } return - {label} + {label} {valueNode} {children} {linkToUuid && - this.onCopy("Copied")}> - - + + this.onCopy("Copied")}> + + + } ; diff --git a/src/views-components/details-panel/collection-details.tsx b/src/views-components/details-panel/collection-details.tsx index 1089706d..625d8405 100644 --- a/src/views-components/details-panel/collection-details.tsx +++ b/src/views-components/details-panel/collection-details.tsx @@ -15,6 +15,6 @@ export class CollectionDetails extends DetailsData { } getDetails() { - return ; + return ; } } diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx index f41e8967..4cdd8c55 100644 --- a/src/views/collection-panel/collection-panel.tsx +++ b/src/views/collection-panel/collection-panel.tsx @@ -14,7 +14,7 @@ import { ArvadosTheme } from '~/common/custom-theme'; import { RootState } from '~/store/store'; import { MoreOptionsIcon, CollectionIcon, ReadOnlyIcon, ExpandIcon, CollectionOldVersionIcon } from '~/components/icon/icon'; import { DetailsAttribute } from '~/components/details-attribute/details-attribute'; -import { CollectionResource } from '~/models/collection'; +import { CollectionResource, getCollectionUrl } from '~/models/collection'; import { CollectionPanelFiles } from '~/views-components/collection-panel-files/collection-panel-files'; import { CollectionTagForm } from './collection-tag-form'; import { deleteCollectionTag, navigateToProcess, collectionPanelActions } from '~/store/collection-panel/collection-panel-action'; @@ -31,6 +31,7 @@ import { UserResource } from '~/models/user'; import { getUserUuid } from '~/common/getuser'; import { getProgressIndicator } from '~/store/progress-indicator/progress-indicator-reducer'; import { COLLECTION_PANEL_LOAD_FILES, loadCollectionFiles, COLLECTION_PANEL_LOAD_FILES_THRESHOLD } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions'; +import { Link } from 'react-router-dom'; type CssRules = 'root' | 'filesCard' @@ -113,7 +114,7 @@ export const CollectionPanel = withStyles(styles)( if (item.ownerUuid === currentUserUUID) { isWritable = true; } else { - const itemOwner = getResource(item.ownerUuid)(state.resources); + const itemOwner = getResource(item.ownerUuid)(state.resources); if (itemOwner) { isWritable = itemOwner.writableBy.indexOf(currentUserUUID || '') >= 0; } @@ -134,21 +135,21 @@ export const CollectionPanel = withStyles(styles)( - { isOldVersion - ? - : } + {isOldVersion + ? + : } - + {item.name} {isWritable || - - - + + + } - + {item.description} - + {(item.properties.container_request || item.properties.containerRequest) && dispatch(navigateToProcess(item.properties.container_request || item.properties.containerRequest))}> } {isOldVersion && - - This is an old version. Copy it as a new one if you need to make changes. Go to the current version if you need to share it. - + + This is an old version. Make a copy to make changes. Go to the head version for sharing options. + } @@ -192,25 +193,25 @@ export const CollectionPanel = withStyles(styles)( } - { Object.keys(item.properties).length > 0 - ? Object.keys(item.properties).map(k => - Array.isArray(item.properties[k]) - ? item.properties[k].map((v: string) => - getPropertyChip( - k, v, - isWritable - ? this.handleDelete(k, item.properties[k]) - : undefined, - classes.tag)) - : getPropertyChip( - k, item.properties[k], - isWritable - ? this.handleDelete(k, item.properties[k]) - : undefined, - classes.tag) - ) - :
No properties set on this collection.
- } + {Object.keys(item.properties).length > 0 + ? Object.keys(item.properties).map(k => + Array.isArray(item.properties[k]) + ? item.properties[k].map((v: string) => + getPropertyChip( + k, v, + isWritable + ? this.handleDelete(k, item.properties[k]) + : undefined, + classes.tag)) + : getPropertyChip( + k, item.properties[k], + isWritable + ? this.handleDelete(k, item.properties[k]) + : undefined, + classes.tag) + ) + :
No properties set on this collection.
+ }
@@ -224,7 +225,7 @@ export const CollectionPanel = withStyles(styles)( dispatch(collectionPanelActions.LOAD_BIG_COLLECTIONS(true)); dispatch(loadCollectionFiles(this.props.item.uuid)); } - } /> + } /> : null; @@ -276,31 +277,51 @@ export const CollectionPanel = withStyles(styles)( ) ); -export const CollectionDetailsAttributes = (props: {item: CollectionResource, classes?: Record}) => { +export const CollectionDetailsAttributes = (props: { item: CollectionResource, twoCol: boolean, classes?: Record }) => { const item = props.item; - const classes = props.classes || {label: '', value: ''}; + const classes = props.classes || { label: '', value: '' }; const isOldVersion = item && item.currentVersionUuid !== item.uuid; - return - - + const mdSize = props.twoCol ? 6 : 12; + return + + + + + + + + + + {isOldVersion && - + + + } - - - - - - - ; + + + + + + + + + + + + + + + + ; };