X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/02fe86a56f080ed1d5770ad6c6856a15f50ab508..dee0cb67a02c25f0f3174681579d0898d880caa3:/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 58dd940494..5c4b28df00 100644
--- a/src/views/collection-panel/collection-panel.tsx
+++ b/src/views/collection-panel/collection-panel.tsx
@@ -5,7 +5,7 @@
 import * as React from 'react';
 import {
     StyleRulesCallback, WithStyles, withStyles, Card,
-    CardHeader, IconButton, CardContent, Grid, Chip, Tooltip
+    CardHeader, IconButton, CardContent, Grid, Tooltip
 } from '@material-ui/core';
 import { connect, DispatchProp } from "react-redux";
 import { RouteComponentProps } from 'react-router';
@@ -21,9 +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';
 
 type CssRules = 'card' | 'iconHeader' | 'tag' | 'label' | 'value' | 'link';
 
@@ -57,7 +57,6 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
 
 interface CollectionPanelDataProps {
     item: CollectionResource;
-    data: ResourceData;
 }
 
 type CollectionPanelProps = CollectionPanelDataProps & DispatchProp
@@ -72,7 +71,7 @@ export const CollectionPanel = withStyles(styles)(
         class extends React.Component<CollectionPanelProps> {
 
             render() {
-                const { classes, item, data, dispatch } = this.props;
+                const { classes, item, dispatch } = this.props;
                 return item
                     ? <>
                         <Card className={classes.card}>
@@ -105,9 +104,9 @@ export const CollectionPanel = withStyles(styles)(
                                             label='Portable data hash'
                                             linkToUuid={item && item.portableDataHash} />
                                         <DetailsAttribute classLabel={classes.label} classValue={classes.value}
-                                            label='Number of files' value={data && data.fileCount} />
+                                            label='Number of files' value={item && item.fileCount} />
                                         <DetailsAttribute classLabel={classes.label} classValue={classes.value}
-                                            label='Content size' value={data && formatFileSize(data.fileSize)} />
+                                            label='Content size' value={item && formatFileSize(item.fileSizeTotal)} />
                                         <DetailsAttribute classLabel={classes.label} classValue={classes.value}
                                             label='Owner' linkToUuid={item && item.ownerUuid} />
                                         {(item.properties.container_request || item.properties.containerRequest) &&
@@ -128,13 +127,12 @@ export const CollectionPanel = withStyles(styles)(
                                         <CollectionTagForm />
                                     </Grid>
                                     <Grid item xs={12}>
-                                        {
-                                            Object.keys(item.properties).map(k => {
-                                                return <Chip key={k} className={classes.tag}
-                                                    onDelete={this.handleDelete(k)}
-                                                    label={`${k}: ${item.properties[k]}`} />;
-                                            })
-                                        }
+                                        {Object.keys(item.properties).map(k =>
+                                            <PropertyChipComponent
+                                                key={k} className={classes.tag}
+                                                onDelete={this.handleDelete(k)}
+                                                propKey={k} propValue={item.properties[k]} />
+                                        )}
                                     </Grid>
                                 </Grid>
                             </CardContent>
@@ -161,6 +159,13 @@ export const CollectionPanel = withStyles(styles)(
                 this.props.dispatch<any>(openContextMenu(event, resource));
             }
 
+            onCopy = (message: string) =>
+                this.props.dispatch(snackbarActions.OPEN_SNACKBAR({
+                    message,
+                    hideDuration: 2000,
+                    kind: SnackbarKind.SUCCESS
+                }))
+
             handleDelete = (key: string) => () => {
                 this.props.dispatch<any>(deleteCollectionTag(key));
             }
