X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/35d6c5a870aeff7bb2cbf6ec80d306debad872c1..f6093a73debdd7135870582088202da459386f17:/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 4e3d5acd9a..c4221937e7 100644 --- a/src/views/collection-panel/collection-panel.tsx +++ b/src/views/collection-panel/collection-panel.tsx @@ -21,11 +21,9 @@ import { getResource } from '~/store/resources/resources'; import { openContextMenu } from '~/store/context-menu/context-menu-actions'; import { ContextMenuKind } from '~/views-components/context-menu/context-menu'; import { formatFileSize } from "~/common/formatters"; -import { getResourceData } from "~/store/resources-data/resources-data"; -import { ResourceData } from "~/store/resources-data/resources-data-reducer"; import { openDetailsPanel } from '~/store/details-panel/details-panel-action'; import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions'; -import { PropertyChipComponent } from '~/views-components/resource-properties-form/property-chip'; +import { getPropertyChip } from '~/views-components/resource-properties-form/property-chip'; import { IllegalNamingWarning } from '~/components/warning/warning'; type CssRules = 'card' | 'iconHeader' | 'tag' | 'label' | 'value' | 'link'; @@ -60,22 +58,20 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ interface CollectionPanelDataProps { item: CollectionResource; - data: ResourceData; } type CollectionPanelProps = CollectionPanelDataProps & DispatchProp & WithStyles & RouteComponentProps<{ id: string }>; export const CollectionPanel = withStyles(styles)( - connect((state: RootState, props: RouteComponentProps<{ id: string }>) => { - const item = getResource(props.match.params.id)(state.resources); - const data = getResourceData(props.match.params.id)(state.resourcesData); - return { item, data }; - })( + connect((state: RootState, props: RouteComponentProps<{ id: string }>) => { + const item = getResource(props.match.params.id)(state.resources); + return { item }; + })( class extends React.Component { render() { - const { classes, item, data, dispatch } = this.props; + const { classes, item, dispatch } = this.props; return item ? <> @@ -108,9 +104,9 @@ export const CollectionPanel = withStyles(styles)( label='Portable data hash' linkToUuid={item && item.portableDataHash} /> + label='Number of files' value={item && item.fileCount} /> + label='Content size' value={item && formatFileSize(item.fileSizeTotal)} /> {(item.properties.container_request || item.properties.containerRequest) && @@ -132,10 +128,16 @@ export const CollectionPanel = withStyles(styles)( {Object.keys(item.properties).map(k => - + Array.isArray(item.properties[k]) + ? item.properties[k].map((v: string) => + getPropertyChip( + k, v, + this.handleDelete(k, v), + classes.tag)) + : getPropertyChip( + k, item.properties[k], + this.handleDelete(k, item.properties[k]), + classes.tag) )} @@ -170,8 +172,8 @@ export const CollectionPanel = withStyles(styles)( kind: SnackbarKind.SUCCESS })) - handleDelete = (key: string) => () => { - this.props.dispatch(deleteCollectionTag(key)); + handleDelete = (key: string, value: string) => () => { + this.props.dispatch(deleteCollectionTag(key, value)); } openCollectionDetails = () => {