mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
Use POST in sqllab_viz instead of url params to avoid error with long queries (#1933)
* Use POST in sqllab_viz instead of url params to avoid error with long queries * Delete error handling * Fix returning statement
This commit is contained in:
@@ -4,6 +4,7 @@ import { Alert, Button, Col, Modal } from 'react-bootstrap';
|
||||
import Select from 'react-select';
|
||||
import { Table } from 'reactable';
|
||||
import shortid from 'shortid';
|
||||
import $ from 'jquery';
|
||||
|
||||
const CHART_TYPES = [
|
||||
{ value: 'dist_bar', label: 'Distribution - Bar Chart', requiresTime: false },
|
||||
@@ -105,7 +106,17 @@ class VisualizeModal extends React.PureComponent {
|
||||
sql: this.props.query.sql,
|
||||
dbId: this.props.query.dbId,
|
||||
};
|
||||
window.open('/superset/sqllab_viz/?data=' + JSON.stringify(vizOptions));
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/superset/sqllab_viz/',
|
||||
async: false,
|
||||
data: {
|
||||
data: JSON.stringify(vizOptions),
|
||||
},
|
||||
success: (url) => {
|
||||
window.open(url);
|
||||
},
|
||||
});
|
||||
}
|
||||
changeDatasourceName(event) {
|
||||
this.setState({ datasourceName: event.target.value });
|
||||
|
||||
@@ -2222,10 +2222,10 @@ class Superset(BaseSupersetView):
|
||||
return Response(status=201)
|
||||
|
||||
@has_access
|
||||
@expose("/sqllab_viz/")
|
||||
@expose("/sqllab_viz/", methods=['POST'])
|
||||
@log_this
|
||||
def sqllab_viz(self):
|
||||
data = json.loads(request.args.get('data'))
|
||||
data = json.loads(request.form.get('data'))
|
||||
table_name = data.get('datasourceName')
|
||||
viz_type = data.get('chartType')
|
||||
table = (
|
||||
@@ -2283,8 +2283,7 @@ class Superset(BaseSupersetView):
|
||||
'limit': '0',
|
||||
}
|
||||
params = "&".join([k + '=' + v for k, v in params.items() if v])
|
||||
url = '/superset/explore/table/{table.id}/?{params}'.format(**locals())
|
||||
return redirect(url)
|
||||
return '/superset/explore/table/{table.id}/?{params}'.format(**locals())
|
||||
|
||||
@has_access
|
||||
@expose("/table/<database_id>/<table_name>/<schema>/")
|
||||
|
||||
Reference in New Issue
Block a user