This is an automated email from the ASF dual-hosted git repository.

erikrit 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 28c05b2  [SQL Lab] Implement refetch results button properly (#9220)
28c05b2 is described below

commit 28c05b22e8b3b02a28341b376a15ffaee68b8f87
Author: Erik Ritter <[email protected]>
AuthorDate: Mon Mar 2 16:10:40 2020 -0800

    [SQL Lab] Implement refetch results button properly (#9220)
---
 .../src/SqlLab/components/ResultSet.jsx            | 52 +++++++++++++++-------
 1 file changed, 36 insertions(+), 16 deletions(-)

diff --git a/superset-frontend/src/SqlLab/components/ResultSet.jsx 
b/superset-frontend/src/SqlLab/components/ResultSet.jsx
index e7adae5..b7655d5 100644
--- a/superset-frontend/src/SqlLab/components/ResultSet.jsx
+++ b/superset-frontend/src/SqlLab/components/ResultSet.jsx
@@ -64,6 +64,11 @@ export default class ResultSet extends React.PureComponent {
       showExploreResultsButton: false,
       data: null,
     };
+
+    this.changeSearch = this.changeSearch.bind(this);
+    this.fetchResults = this.fetchResults.bind(this);
+    this.popSelectStar = this.popSelectStar.bind(this);
+    this.reFetchQueryResults = this.reFetchQueryResults.bind(this);
     this.toggleExploreResultsButton = this.toggleExploreResultsButton.bind(
       this,
     );
@@ -171,7 +176,7 @@ export default class ResultSet extends React.PureComponent {
               {this.props.search && (
                 <input
                   type="text"
-                  onChange={this.changeSearch.bind(this)}
+                  onChange={this.changeSearch}
                   value={this.state.searchText}
                   className="form-control input-sm"
                   placeholder={t('Filter Results')}
@@ -219,7 +224,7 @@ export default class ResultSet extends React.PureComponent {
             <Button
               bsSize="small"
               className="m-r-5"
-              onClick={this.popSelectStar.bind(this)}
+              onClick={this.popSelectStar}
             >
               {t('Query in a new tab')}
             </Button>
@@ -240,7 +245,7 @@ export default class ResultSet extends React.PureComponent {
           : [];
         return (
           <>
-            {this.renderControls.bind(this)()}
+            {this.renderControls()}
             {sql}
             <FilterableTable
               data={data}
@@ -258,19 +263,34 @@ export default class ResultSet extends 
React.PureComponent {
       }
     }
     if (query.cached || (query.state === 'success' && !query.results)) {
-      return (
-        <Button
-          bsSize="sm"
-          className="fetch"
-          bsStyle="primary"
-          onClick={this.reFetchQueryResults.bind(this, {
-            ...query,
-            isDataPreview: true,
-          })}
-        >
-          {t('Fetch data preview')}
-        </Button>
-      );
+      if (query.isDataPreview) {
+        return (
+          <Button
+            bsSize="sm"
+            className="fetch"
+            bsStyle="primary"
+            onClick={() =>
+              this.reFetchQueryResults({
+                ...query,
+                isDataPreview: true,
+              })
+            }
+          >
+            {t('Fetch data preview')}
+          </Button>
+        );
+      } else if (query.resultsKey) {
+        return (
+          <Button
+            bsSize="sm"
+            className="fetch"
+            bsStyle="primary"
+            onClick={() => this.fetchResults(query)}
+          >
+            {t('Refetch Results')}
+          </Button>
+        );
+      }
     }
     let progressBar;
     let trackingUrl;

Reply via email to