Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz@veritasgenetics.com>
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 { 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';
type CssRules = 'card' | 'iconHeader' | 'tag' | 'label' | 'value' | 'link';
<Grid item xs={12}>
{
Object.keys(item.properties).map(k => {
<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>;
this.props.dispatch<any>(openContextMenu(event, resource));
}
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));
}
handleDelete = (key: string) => () => {
this.props.dispatch<any>(deleteCollectionTag(key));
}