Commit 7b1f7ce1 authored by Flavio TARSETTI's avatar Flavio TARSETTI

Merge branch 'add-copy-to-path-104' into 'master'

Add a "Copy Path" button to copy path to clipboard

Closes #104

See merge request !47
parents 29b4de1d 738fef17
Pipeline #26667 passed with stages
in 66 minutes and 6 seconds
...@@ -12,6 +12,7 @@ import { ...@@ -12,6 +12,7 @@ import {
Input, Input,
InputGroupAddon, InputGroupAddon,
InputGroup, InputGroup,
Button,
} from 'reactstrap'; } from 'reactstrap';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
...@@ -100,7 +101,7 @@ export class EntityDetail extends React.Component<Props, State> { ...@@ -100,7 +101,7 @@ export class EntityDetail extends React.Component<Props, State> {
const usern = segs.shift(); const usern = segs.shift();
const expn = segs.pop(); const expn = segs.pop();
const tcn = segs.join('/'); const tcn = segs.join('/');
expName = <span>{ usern }/<Link to={`/toolchain/${ tcn }`}>{ tcn }</Link>/{ expn }</span> expName = <span>{ usern }/<Link to={`/toolchain/${ tcn }`}>{ tcn }</Link>/{ expn }</span>;
} }
return ( return (
<Container> <Container>
...@@ -121,10 +122,26 @@ export class EntityDetail extends React.Component<Props, State> { ...@@ -121,10 +122,26 @@ export class EntityDetail extends React.Component<Props, State> {
<InputGroup> <InputGroup>
<InputGroupAddon addonType='prepend'>Path:</InputGroupAddon> <InputGroupAddon addonType='prepend'>Path:</InputGroupAddon>
<Input <Input
id='objectPath'
readOnly readOnly
width='80' width='80'
value={`${ this.props.prefix }/${ pluralize(this.props.entity) }/${ name }`} value={`${ this.props.prefix }/${ pluralize(this.props.entity) }/${ name }`}
/> />
<InputGroupAddon addonType='append'>
<Button
outline
color='secondary'
title={`Copy the object's path to the clipboard`}
onClick={(e) => {
const toCopy = document.querySelector('#objectPath');
toCopy.select();
document.execCommand('copy');
}}
>
{/*UTF8 char for the clipboard: 📋*/}
Copy Path
</Button>
</InputGroupAddon>
</InputGroup> </InputGroup>
</Col> </Col>
</Row> </Row>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment