From a1173f4346b24c2754355b390fc2d7076d39589e Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Wed, 21 Feb 2018 10:35:38 -0800 Subject: [PATCH] [explore] allow URL shortner even if no slice exist (#4457) recent regression perhaps from the PR that moved to using POST . (cherry picked from commit 0eecec10cdc3b88295fbb296f9a74d80b7190ad2) --- .../components/ExploreActionButtons.jsx | 38 +++++++++---------- .../components/ExploreActionButtons_spec.jsx | 7 +--- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/superset/assets/javascripts/explore/components/ExploreActionButtons.jsx b/superset/assets/javascripts/explore/components/ExploreActionButtons.jsx index 74f9b73348ef3..ec9d214c072b3 100644 --- a/superset/assets/javascripts/explore/components/ExploreActionButtons.jsx +++ b/superset/assets/javascripts/explore/components/ExploreActionButtons.jsx @@ -9,27 +9,28 @@ import { exportChart } from '../exploreUtils'; const propTypes = { canDownload: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]).isRequired, - slice: PropTypes.object, chartStatus: PropTypes.string, latestQueryFormData: PropTypes.object, queryResponse: PropTypes.object, }; export default function ExploreActionButtons({ - canDownload, slice, chartStatus, latestQueryFormData, queryResponse }) { + canDownload, chartStatus, latestQueryFormData, queryResponse }) { const exportToCSVClasses = cx('btn btn-default btn-sm', { 'disabled disabledButton': !canDownload, }); const doExportCSV = exportChart.bind(this, latestQueryFormData, 'csv'); const doExportChart = exportChart.bind(this, latestQueryFormData, 'json'); - if (slice) { - return ( -
- + return ( +
+ {latestQueryFormData && + } - + {latestQueryFormData && + } + {latestQueryFormData && .json - - + } + {latestQueryFormData && .csv - - - -
- ); - } - return ( - + } + +
); } diff --git a/superset/assets/spec/javascripts/explore/components/ExploreActionButtons_spec.jsx b/superset/assets/spec/javascripts/explore/components/ExploreActionButtons_spec.jsx index 506dd23f97bec..545446ecbe6e9 100644 --- a/superset/assets/spec/javascripts/explore/components/ExploreActionButtons_spec.jsx +++ b/superset/assets/spec/javascripts/explore/components/ExploreActionButtons_spec.jsx @@ -8,12 +8,7 @@ import ExploreActionButtons from describe('ExploreActionButtons', () => { const defaultProps = { canDownload: 'True', - slice: { - data: { - csv_endpoint: '', - json_endpoint: '', - }, - }, + latestQueryFormData: {}, queryEndpoint: 'localhost', };