mirror of
https://github.com/apache/superset.git
synced 2026-04-09 19:35:21 +00:00
* Fixing PropTypes warning message React recently started warning on the upcoming deprecation of React.PropTypes, the new approach is to use the `prop-types` npm package instead. * Fixing the tests
41 lines
944 B
JavaScript
41 lines
944 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import CopyToClipboard from '../../components/CopyToClipboard';
|
|
import { storeQuery } from '../../../utils/common';
|
|
|
|
const propTypes = {
|
|
queryEditor: PropTypes.object.isRequired,
|
|
};
|
|
|
|
export default class CopyQueryTabUrl extends React.PureComponent {
|
|
getUrl(callback) {
|
|
const qe = this.props.queryEditor;
|
|
const sharedQuery = {
|
|
dbId: qe.dbId,
|
|
title: qe.title,
|
|
schema: qe.schema,
|
|
autorun: qe.autorun,
|
|
sql: qe.sql,
|
|
};
|
|
storeQuery(sharedQuery, callback);
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<CopyToClipboard
|
|
inMenu
|
|
copyNode={(
|
|
<div>
|
|
<i className="fa fa-clipboard" /> <span>share query</span>
|
|
</div>
|
|
)}
|
|
tooltipText="copy URL to clipboard"
|
|
shouldShowText={false}
|
|
getText={this.getUrl.bind(this)}
|
|
/>
|
|
);
|
|
}
|
|
}
|
|
|
|
CopyQueryTabUrl.propTypes = propTypes;
|