mirror of
https://github.com/apache/superset.git
synced 2026-04-10 11:55:24 +00:00
Use a key-value store model for sharing long queries (#1951)
* 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
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import CopyToClipboard from '../../components/CopyToClipboard';
|
||||
import { getShortUrl } from '../../../utils/common';
|
||||
import { storeQuery } from '../../../utils/common';
|
||||
|
||||
const propTypes = {
|
||||
queryEditor: React.PropTypes.object.isRequired,
|
||||
@@ -9,16 +9,14 @@ const propTypes = {
|
||||
export default class CopyQueryTabUrl extends React.PureComponent {
|
||||
getUrl(callback) {
|
||||
const qe = this.props.queryEditor;
|
||||
const params = [];
|
||||
if (qe.dbId) params.push('dbid=' + qe.dbId);
|
||||
if (qe.title) params.push('title=' + encodeURIComponent(qe.title));
|
||||
if (qe.schema) params.push('schema=' + encodeURIComponent(qe.schema));
|
||||
if (qe.autorun) params.push('autorun=' + qe.autorun);
|
||||
if (qe.sql) params.push('sql=' + encodeURIComponent(qe.sql));
|
||||
|
||||
const queryString = params.join('&');
|
||||
const queryLink = window.location.pathname + '?' + queryString;
|
||||
getShortUrl(queryLink, callback);
|
||||
const sharedQuery = {
|
||||
dbId: qe.dbId,
|
||||
title: qe.title,
|
||||
schema: qe.schema,
|
||||
autorun: qe.autorun,
|
||||
sql: qe.sql,
|
||||
};
|
||||
storeQuery(sharedQuery, callback);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
Reference in New Issue
Block a user