betodealmeida commented on a change in pull request #11755:
URL:
https://github.com/apache/incubator-superset/pull/11755#discussion_r527249206
##########
File path: superset-frontend/src/SqlLab/components/ResultSet.tsx
##########
@@ -166,14 +194,126 @@ export default class ResultSet extends
React.PureComponent<
}
}
+ handleOverwriteDatasetOption(data, option) {
+ this.setState({ datasetToOverwrite: option })
+ }
+
+ handleOverwriteDataset() {
+ const { sql, results } = this.props.query;
+ const { datasetToOverwrite } = this.state
+
+ // HACK: to clear the columns in the previous dataset and update
+ // it with the new selected columns from the query
+ // Todo: move this to actions file
+ SupersetClient.put({
+ endpoint: `api/v1/dataset/${datasetToOverwrite.dataSetId}`,
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({
+ columns: [],
+ }),
+ })
+ .then(d => {
+ console.log(d);
+ })
+ .catch(err => console.log(err));
+
+ SupersetClient.put({
Review comment:
I think you need to chain these two calls, otherwise in theory they
could run in reverse order and you end up with no columns.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]