X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/394ebdfd13fe40a7096f484c46a353d2537f4c9a..efb6e397a2d9ec98c8a9fa1f47bea66d8651bb81:/src/views/collection-panel/collection-panel.tsx diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx index 794e093f..dce8ef8f 100644 --- a/src/views/collection-panel/collection-panel.tsx +++ b/src/views/collection-panel/collection-panel.tsx @@ -11,7 +11,7 @@ import { Grid, Tooltip, Typography, - Card, CardHeader, CardContent, + Card } from '@material-ui/core'; import { connect, DispatchProp } from "react-redux"; import { RouteComponentProps } from 'react-router'; @@ -21,8 +21,7 @@ import { MoreOptionsIcon, CollectionIcon, ReadOnlyIcon, CollectionOldVersionIcon import { DetailsAttribute } from 'components/details-attribute/details-attribute'; 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'; +import { navigateToProcess, collectionPanelActions } from 'store/collection-panel/collection-panel-action'; import { getResource } from 'store/resources/resources'; import { openContextMenu, resourceUuidToContextMenuKind } from 'store/context-menu/context-menu-actions'; import { formatDate, formatFileSize } from "common/formatters"; @@ -78,8 +77,8 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ color: theme.customs.colors.yellow700 }, tag: { - marginRight: theme.spacing.unit, - marginBottom: theme.spacing.unit + marginRight: theme.spacing.unit / 2, + marginBottom: theme.spacing.unit / 2 }, label: { fontSize: '0.875rem' @@ -148,7 +147,6 @@ export const CollectionPanel = withStyles(styles)( const { classes, item, dispatch, isWritable, isOldVersion, isLoadingFiles, tooManyFiles } = this.props; const panelsData: MPVPanelState[] = [ {name: "Details"}, - {name: "Properties"}, {name: "Files"}, ]; return item @@ -203,37 +201,6 @@ export const CollectionPanel = withStyles(styles)( - - - - - {isWritable && - - } - - {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, v) - : undefined, - classes.tag)) - : getPropertyChip( - k, item.properties[k], - isWritable - ? this.handleDelete(k, item.properties[k]) - : undefined, - classes.tag) - ) - :
No properties set on this collection.
- } -
-
-
-
) => { - const { uuid, ownerUuid, name, description, kind, storageClassesDesired } = this.props.item; + const { uuid, ownerUuid, name, description, + kind, storageClassesDesired, properties } = this.props.item; const menuKind = this.props.dispatch(resourceUuidToContextMenuKind(uuid)); const resource = { uuid, @@ -262,6 +230,7 @@ export const CollectionPanel = withStyles(styles)( storageClassesDesired, kind, menuKind, + properties, }; // Avoid expanding/collapsing the panel event.stopPropagation(); @@ -275,10 +244,6 @@ export const CollectionPanel = withStyles(styles)( kind: SnackbarKind.SUCCESS })) - handleDelete = (key: string, value: string) => () => { - this.props.dispatch(deleteCollectionTag(key, value)); - } - openCollectionDetails = (e: React.MouseEvent) => { const { item } = this.props; if (item) { @@ -295,9 +260,16 @@ export const CollectionPanel = withStyles(styles)( ) ); -export const CollectionDetailsAttributes = (props: { item: CollectionResource, twoCol: boolean, classes?: Record, showVersionBrowser?: () => void }) => { +interface CollectionDetailsProps { + item: CollectionResource; + classes?: any; + twoCol?: boolean; + showVersionBrowser?: () => void; +} + +export const CollectionDetailsAttributes = (props: CollectionDetailsProps) => { const item = props.item; - const classes = props.classes || { label: '', value: '', button: '' }; + const classes = props.classes || { label: '', value: '', button: '', tag: '' }; const isOldVersion = item && item.currentVersionUuid !== item.uuid; const mdSize = props.twoCol ? 6 : 12; const showVersionBrowser = props.showVersionBrowser; @@ -351,7 +323,7 @@ export const CollectionDetailsAttributes = (props: { item: CollectionResource, t + label='Number of files' value={{item.fileCount}} /> + + {/* + NOTE: The property list should be kept at the bottom, because it spans + the entire available width, without regards of the twoCol prop. + */} + + + { 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, undefined, classes.tag)) + : getPropertyChip(k, item.properties[k], undefined, classes.tag)) + :
No properties
} +
; };