Add copy to clipboard buttons in explore and sqllab (#6461)

* Add copy to clipboard buttons in explore and sqllab

* Eslint fixes

* Review changes: deconstruct props, extract function to utils, add tests
This commit is contained in:
leakingoxide
2018-12-07 19:03:33 +01:00
committed by Hugh A. Miles II
parent fc8acf27c8
commit eb408d71c4
5 changed files with 68 additions and 2 deletions

View File

@@ -9,6 +9,8 @@ import ExploreResultsButton from './ExploreResultsButton';
import HighlightedSql from './HighlightedSql';
import FilterableTable from '../../components/FilterableTable/FilterableTable';
import QueryStateLabel from './QueryStateLabel';
import CopyToClipboard from '../../components/CopyToClipboard';
import { prepareCopyToClipboardTabularData } from '../../utils/common';
const propTypes = {
actions: PropTypes.object,
@@ -112,6 +114,16 @@ export default class ResultSet extends React.PureComponent {
<Button bsSize="small" href={'/superset/csv/' + this.props.query.id}>
<i className="fa fa-file-text-o" /> {t('.CSV')}
</Button>}
<CopyToClipboard
text={prepareCopyToClipboardTabularData(this.props.query.results.data)}
wrapped={false}
copyNode={
<Button bsSize="small">
<i className="fa fa-clipboard" /> {t('Clipboard')}
</Button>
}
/>
</ButtonGroup>
</div>
<div className="pull-right">