[ARVADOS-WORKBENCH2] created: 1.4.1-79-g2ef3823e

Git user git at public.curoverse.com
Tue Oct 29 21:34:23 UTC 2019


        at  2ef3823ee2205b76af73f3fa4440395bdb3aac5d (commit)


commit 2ef3823ee2205b76af73f3fa4440395bdb3aac5d
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Tue Oct 29 17:33:58 2019 -0400

    15766: Clicking on a property chip copies its text to clipboard
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx
index 58dd9404..77d91558 100644
--- a/src/views/collection-panel/collection-panel.tsx
+++ b/src/views/collection-panel/collection-panel.tsx
@@ -24,6 +24,8 @@ 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 * as CopyToClipboard from 'react-copy-to-clipboard';
+import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
 
 type CssRules = 'card' | 'iconHeader' | 'tag' | 'label' | 'value' | 'link';
 
@@ -130,9 +132,12 @@ export const CollectionPanel = withStyles(styles)(
                                     <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]}`} />;
+                                                const label = `${k}: ${item.properties[k]}`;
+                                                return <CopyToClipboard key={k} text={label} onCopy={() => this.onCopy("Copied")}>
+                                                    <Chip className={classes.tag}
+                                                        onDelete={this.handleDelete(k)}
+                                                        label={label} />
+                                                </CopyToClipboard>;
                                             })
                                         }
                                     </Grid>
@@ -161,6 +166,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));
             }

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list