diff --git a/jitney_events b/jitney_events new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/superset/assets/javascripts/explorev2/components/ChartContainer.jsx b/superset/assets/javascripts/explorev2/components/ChartContainer.jsx index 66879d949d7df..ce6a5b9b1c0fc 100644 --- a/superset/assets/javascripts/explorev2/components/ChartContainer.jsx +++ b/superset/assets/javascripts/explorev2/components/ChartContainer.jsx @@ -211,6 +211,8 @@ class ChartContainer extends React.PureComponent { if (this.props.standalone) { return this.renderChart(); } + const queryResponse = this.props.queryResponse; + const query = queryResponse && queryResponse.query ? queryResponse.query : null; return (
diff --git a/superset/assets/javascripts/explorev2/components/DisplayQueryButton.jsx b/superset/assets/javascripts/explorev2/components/DisplayQueryButton.jsx index 769c064846bfd..cf39a6c3930cd 100644 --- a/superset/assets/javascripts/explorev2/components/DisplayQueryButton.jsx +++ b/superset/assets/javascripts/explorev2/components/DisplayQueryButton.jsx @@ -6,6 +6,7 @@ import { github } from 'react-syntax-highlighter/dist/styles'; const $ = window.$ = require('jquery'); const propTypes = { + query: PropTypes.string, queryEndpoint: PropTypes.string.isRequired, }; @@ -25,22 +26,29 @@ export default class DisplayQueryButton extends React.PureComponent { src="/static/assets/images/loading.gif" />), }); - $.ajax({ - type: 'GET', - url: this.props.queryEndpoint, - success: (data) => { - const modalBody = data.language ? - - {data.query} - - : -
{data.query}
; - this.setState({ modalBody }); - }, - error(data) { - this.setState({ modalBody: (
{data.error}
) }); - }, - }); + if (this.props.query) { + const modalBody = ( +
{this.props.query}
+ ); + this.setState({ modalBody }); + } else { + $.ajax({ + type: 'GET', + url: this.props.queryEndpoint, + success: (data) => { + const modalBody = data.language ? + + {data.query} + + : +
{data.query}
; + this.setState({ modalBody }); + }, + error(data) { + this.setState({ modalBody: (
{data.error}
) }); + }, + }); + } } render() { return ( diff --git a/superset/assets/javascripts/explorev2/components/ExploreActionButtons.jsx b/superset/assets/javascripts/explorev2/components/ExploreActionButtons.jsx index 5823c93bf6f5a..bb30c9821b685 100644 --- a/superset/assets/javascripts/explorev2/components/ExploreActionButtons.jsx +++ b/superset/assets/javascripts/explorev2/components/ExploreActionButtons.jsx @@ -8,9 +8,10 @@ const propTypes = { canDownload: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]).isRequired, slice: PropTypes.object, queryEndpoint: PropTypes.string, + query: PropTypes.string, }; -export default function ExploreActionButtons({ canDownload, slice, queryEndpoint }) { +export default function ExploreActionButtons({ canDownload, slice, query, queryEndpoint }) { const exportToCSVClasses = cx('btn btn-default btn-sm', { 'disabled disabledButton': !canDownload, }); @@ -40,6 +41,7 @@ export default function ExploreActionButtons({ canDownload, slice, queryEndpoint diff --git a/superset/views/core.py b/superset/views/core.py index 80d0e61924540..1b5f008419cd0 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -2184,7 +2184,8 @@ def search_queries(self): def refresh_datasources(self): """endpoint that refreshes druid datasources metadata""" session = db.session() - DruidCluster = ConnectorRegistry.sources['druid'] + DruidDatasource = ConnectorRegistry.sources['druid'] + DruidCluster = DruidDatasource.cluster_class for cluster in session.query(DruidCluster).all(): cluster_name = cluster.cluster_name try: