ChristopherCFleming commented on a change in pull request #17939:
URL: https://github.com/apache/superset/pull/17939#discussion_r797932823
##########
File path:
superset-frontend/src/SqlLab/components/ExploreCtasResultsButton/index.jsx
##########
@@ -35,29 +35,24 @@ const propTypes = {
templateParams: PropTypes.string,
};
-class ExploreCtasResultsButton extends React.PureComponent {
- constructor(props) {
- super(props);
- this.visualize = this.visualize.bind(this);
- this.onClick = this.onClick.bind(this);
- }
-
- onClick() {
- this.visualize();
- }
-
- buildVizOptions() {
- return {
- datasourceName: this.props.table,
- schema: this.props.schema,
- dbId: this.props.dbId,
- templateParams: this.props.templateParams,
- };
- }
+function ExploreCtasResultsButton({
+ table,
+ schema,
+ dbId,
+ templateParams,
+ errorMessage,
+ actions,
+}) {
+ const { createCtasDatasource, addInfoToast, addDangerToast } = actions;
+ const buildVizOptions = {
+ datasourceName: table,
+ schema,
+ dbId,
+ templateParams,
+ };
- visualize() {
- this.props.actions
- .createCtasDatasource(this.buildVizOptions())
+ const visualize = () => {
+ createCtasDatasource(buildVizOptions())
Review comment:
AH! I get it. I should remove the "()" after buildVizOptions on line 55
then if we want it to just be an object. Or make buildVizOptions back into a
function. Which would you prefer?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]