mirror of
https://github.com/apache/superset.git
synced 2026-04-10 20:06:13 +00:00
* Add KeyValue model for storing id-value pairs use it for storing shared queries * Change string to text and added test * Put getQueryLink in one place * Changed migration down version * Changes based on comments * Update bcf3126872fc_add_keyvalue.py
40 lines
914 B
JavaScript
40 lines
914 B
JavaScript
import React from 'react';
|
|
import CopyToClipboard from '../../components/CopyToClipboard';
|
|
import { storeQuery } from '../../../utils/common';
|
|
|
|
const propTypes = {
|
|
queryEditor: React.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;
|