You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/01/05 23:47:51 UTC

[GitHub] [superset] eschutho commented on a change in pull request #17939: refactor(ExploreCtasResultsButton): convert to functional component

eschutho commented on a change in pull request #17939:
URL: https://github.com/apache/superset/pull/17939#discussion_r779210613



##########
File path: superset-frontend/src/SqlLab/components/ExploreCtasResultsButton/index.jsx
##########
@@ -68,38 +58,41 @@ class ExploreCtasResultsButton extends React.PureComponent {
           all_columns: [],
           row_limit: 1000,
         };
-        this.props.actions.addInfoToast(
+        props.actions.addInfoToast(
           t('Creating a data source and creating a new tab'),
         );
 
         // open new window for data visualization
         exploreChart(formData);
       })
       .catch(() => {
-        this.props.actions.addDangerToast(
-          this.props.errorMessage || t('An error occurred'),
+        props.actions.addDangerToast(
+          props.errorMessage || t('An error occurred'),
         );
       });
   }
 
-  render() {
-    return (
-      <>
-        <Button
-          buttonSize="small"
-          onClick={this.onClick}
-          tooltip={t('Explore the result set in the data exploration view')}
-        >
-          <InfoTooltipWithTrigger
-            icon="line-chart"
-            placement="top"
-            label="explore"
-          />{' '}
-          {t('Explore')}
-        </Button>
-      </>
-    );
+  function onClick() {
+    visualize();
   }
+
+  return (
+    <>
+      <Button
+        buttonSize="small"
+        onClick={onClick}
+        tooltip={t('Explore the result set in the data exploration view')}
+      >
+        <InfoTooltipWithTrigger
+          icon="line-chart"
+          placement="top"
+          label="explore"
+        />{' '}
+        {/* NOTE TO SELF: Below, the text should be "Explore" instead of "This is the button" */}
+        {t('This Is the button')}

Review comment:
       looks like this needs to be fixed.

##########
File path: superset-frontend/src/SqlLab/components/ExploreCtasResultsButton/index.jsx
##########
@@ -68,38 +58,41 @@ class ExploreCtasResultsButton extends React.PureComponent {
           all_columns: [],
           row_limit: 1000,
         };
-        this.props.actions.addInfoToast(
+        props.actions.addInfoToast(
           t('Creating a data source and creating a new tab'),
         );
 
         // open new window for data visualization
         exploreChart(formData);
       })
       .catch(() => {
-        this.props.actions.addDangerToast(
-          this.props.errorMessage || t('An error occurred'),
+        props.actions.addDangerToast(
+          props.errorMessage || t('An error occurred'),
         );
       });
   }
 
-  render() {
-    return (
-      <>
-        <Button
-          buttonSize="small"
-          onClick={this.onClick}
-          tooltip={t('Explore the result set in the data exploration view')}
-        >
-          <InfoTooltipWithTrigger
-            icon="line-chart"
-            placement="top"
-            label="explore"
-          />{' '}
-          {t('Explore')}
-        </Button>
-      </>
-    );
+  function onClick() {
+    visualize();
   }
+
+  return (
+    <>

Review comment:
       this extra fragment was left over from the original code, but you can remove it. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org