superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grace...@apache.org
Subject [incubator-superset] branch master updated: [explore] allow URL shortner even if no slice exist (#4457)
Date Wed, 21 Feb 2018 18:35:41 GMT
This is an automated email from the ASF dual-hosted git repository.

graceguo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 0eecec1  [explore] allow URL shortner even if no slice exist (#4457)
0eecec1 is described below

commit 0eecec10cdc3b88295fbb296f9a74d80b7190ad2
Author: Maxime Beauchemin <maximebeauchemin@gmail.com>
AuthorDate: Wed Feb 21 10:35:38 2018 -0800

    [explore] allow URL shortner even if no slice exist (#4457)
    
    recent regression perhaps from the PR that moved to using POST .
---
 .../explore/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 74f9b73..ec9d214 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 (
-      <div className="btn-group results" role="group">
-        <URLShortLinkButton latestQueryFormData={latestQueryFormData} />
+  return (
+    <div className="btn-group results" role="group">
+      {latestQueryFormData &&
+        <URLShortLinkButton latestQueryFormData={latestQueryFormData} />}
 
-        <EmbedCodeButton latestQueryFormData={latestQueryFormData} />
+      {latestQueryFormData &&
+        <EmbedCodeButton latestQueryFormData={latestQueryFormData} />}
 
+      {latestQueryFormData &&
         <a
           onClick={doExportChart}
           className="btn btn-default btn-sm"
@@ -38,8 +39,8 @@ export default function ExploreActionButtons({
           rel="noopener noreferrer"
         >
           <i className="fa fa-file-code-o" /> .json
-        </a>
-
+        </a>}
+      {latestQueryFormData &&
         <a
           onClick={doExportCSV}
           className={exportToCSVClasses}
@@ -48,18 +49,13 @@ export default function ExploreActionButtons({
           rel="noopener noreferrer"
         >
           <i className="fa fa-file-text-o" /> .csv
-        </a>
-
-        <DisplayQueryButton
-          queryResponse={queryResponse}
-          latestQueryFormData={latestQueryFormData}
-          chartStatus={chartStatus}
-        />
-      </div>
-    );
-  }
-  return (
-    <DisplayQueryButton latestQueryFormData={latestQueryFormData} />
+        </a>}
+      <DisplayQueryButton
+        queryResponse={queryResponse}
+        latestQueryFormData={latestQueryFormData}
+        chartStatus={chartStatus}
+      />
+    </div>
   );
 }
 
diff --git a/superset/assets/spec/javascripts/explore/components/ExploreActionButtons_spec.jsx
b/superset/assets/spec/javascripts/explore/components/ExploreActionButtons_spec.jsx
index 506dd23..545446e 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',
   };
 

-- 
To stop receiving notification emails like this one, please contact
graceguo@apache.org.

Mime
View raw message