suddjian commented on a change in pull request #9370: Add visualization flow to 
the CTA queries
URL: 
https://github.com/apache/incubator-superset/pull/9370#discussion_r398095648
 
 

 ##########
 File path: superset-frontend/src/SqlLab/actions/sqlLab.js
 ##########
 @@ -1249,3 +1249,27 @@ export function createDatasource(vizOptions) {
       });
   };
 }
+
+export function createCtasDatasource(vizOptions) {
+  return dispatch => {
+    dispatch(createDatasourceStarted());
+    return SupersetClient.post({
+      endpoint: '/superset/sqllab_table_viz/',
+      postPayload: { data: vizOptions },
+    })
+      .then(({ json }) => {
+        dispatch(createDatasourceSuccess(json));
+
+        return Promise.resolve(json);
+      })
+      .catch(() => {
+        dispatch(
+          createDatasourceFailed(
+            t('An error occurred while creating the data source'),
+          ),
+        );
+
+        return Promise.reject();
 
 Review comment:
   Promises should be rejected with an Error object.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to