You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2020/12/17 00:27:29 UTC

[incubator-superset] branch debugging-initstate created (now 9036cb0)

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

hugh pushed a change to branch debugging-initstate
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git.


      at 9036cb0  saving these logs

This branch includes the following new commits:

     new 9036cb0  saving these logs

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-superset] 01/01: saving these logs

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hugh pushed a commit to branch debugging-initstate
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit 9036cb054a04c098409bc3d4fdede5dab6845696
Author: hughhhh <hu...@gmail.com>
AuthorDate: Wed Dec 16 19:26:40 2020 -0500

    saving these logs
---
 superset-frontend/src/SqlLab/App.jsx               |  3 +++
 .../src/SqlLab/components/TabbedSqlEditors.jsx     | 24 ++++++++++++++++++++--
 .../src/SqlLab/reducers/getInitialState.js         |  3 ++-
 superset-frontend/src/chart/chartAction.js         |  1 +
 .../components/controls/DatasourceControl.jsx      |  1 +
 superset-frontend/src/explore/exploreUtils.js      |  1 +
 6 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/superset-frontend/src/SqlLab/App.jsx b/superset-frontend/src/SqlLab/App.jsx
index 10f1e51..b69237f 100644
--- a/superset-frontend/src/SqlLab/App.jsx
+++ b/superset-frontend/src/SqlLab/App.jsx
@@ -49,7 +49,10 @@ const bootstrapData = JSON.parse(appContainer.getAttribute('data-bootstrap'));
 
 initFeatureFlags(bootstrapData.common.feature_flags);
 
+console.log('in App', bootstrapData);
 const initialState = getInitialState(bootstrapData);
+console.log('in App initialState', initialState);
+
 const sqlLabPersistStateConfig = {
   paths: ['sqlLab'],
   config: {
diff --git a/superset-frontend/src/SqlLab/components/TabbedSqlEditors.jsx b/superset-frontend/src/SqlLab/components/TabbedSqlEditors.jsx
index f0f6d48..296d11f 100644
--- a/superset-frontend/src/SqlLab/components/TabbedSqlEditors.jsx
+++ b/superset-frontend/src/SqlLab/components/TabbedSqlEditors.jsx
@@ -31,6 +31,7 @@ import { areArraysShallowEqual } from 'src/reduxUtils';
 import * as Actions from '../actions/sqlLab';
 import SqlEditor from './SqlEditor';
 import TabStatusIcon from './TabStatusIcon';
+import { codePointAt } from 'spec/__mocks__/fileMock';
 
 const propTypes = {
   actions: PropTypes.object.isRequired,
@@ -116,6 +117,24 @@ class TabbedSqlEditors extends React.PureComponent {
     }
 
     // merge post form data with GET search params
+    console.log('in tabbedSqlEditors', this.props.requestedQuery);
+    // const appContainer = document.getElementById('app');
+    // const bootstrapData = JSON.parse(
+    //   appContainer?.getAttribute('data-bootstrap') || '{}',
+    // );
+    // let query;
+    // if (bootstrapData.requested_query !== undefined) {
+    //   query = {
+    //     ...bootstrapData.requested_query,
+    //     ...URI(window.location).search(true),
+    //   };
+    // } else {
+    //   query = {
+    //     ...this.props.requestedQuery,
+    //     ...URI(window.location).search(true),
+    //   };
+    // }
+
     const query = {
       ...this.props.requestedQuery,
       ...URI(window.location).search(true),
@@ -412,7 +431,8 @@ class TabbedSqlEditors extends React.PureComponent {
 TabbedSqlEditors.propTypes = propTypes;
 TabbedSqlEditors.defaultProps = defaultProps;
 
-function mapStateToProps({ sqlLab, common, requestedQuery }) {
+function mapStateToProps({ sqlLab, common }) {
+  console.log('in mapStateToProps', sqlLab);
   return {
     databases: sqlLab.databases,
     queryEditors: sqlLab.queryEditors,
@@ -426,7 +446,7 @@ function mapStateToProps({ sqlLab, common, requestedQuery }) {
     maxRow: common.conf.SQL_MAX_ROW,
     saveQueryWarning: common.conf.SQLLAB_SAVE_WARNING_MESSAGE,
     scheduleQueryWarning: common.conf.SQLLAB_SCHEDULE_WARNING_MESSAGE,
-    requestedQuery,
+    requestedQuery: sqlLab.requestedQuery,
   };
 }
 function mapDispatchToProps(dispatch) {
diff --git a/superset-frontend/src/SqlLab/reducers/getInitialState.js b/superset-frontend/src/SqlLab/reducers/getInitialState.js
index 9f7a0a1..fa37723 100644
--- a/superset-frontend/src/SqlLab/reducers/getInitialState.js
+++ b/superset-frontend/src/SqlLab/reducers/getInitialState.js
@@ -170,6 +170,7 @@ export default function getInitialState({
     }
   }
 
+  console.log('in initialState', requestedQuery);
   return {
     sqlLab: {
       activeSouthPaneTab: 'Results',
@@ -182,8 +183,8 @@ export default function getInitialState({
       tables,
       queriesLastUpdate: Date.now(),
       user,
+      requestedQuery,
     },
-    requestedQuery,
     messageToasts: getToastsFromPyFlashMessages(
       (common || {}).flash_messages || [],
     ),
diff --git a/superset-frontend/src/chart/chartAction.js b/superset-frontend/src/chart/chartAction.js
index 0198b33..e14cf34 100644
--- a/superset-frontend/src/chart/chartAction.js
+++ b/superset-frontend/src/chart/chartAction.js
@@ -481,6 +481,7 @@ export function postChartFormData(
 }
 
 export function redirectSQLLab(formData) {
+  console.log('formData', formData);
   return dispatch => {
     getChartDataRequest({ formData, resultFormat: 'json', resultType: 'query' })
       .then(({ result }) => {
diff --git a/superset-frontend/src/explore/components/controls/DatasourceControl.jsx b/superset-frontend/src/explore/components/controls/DatasourceControl.jsx
index f8f79d3..2b01b24 100644
--- a/superset-frontend/src/explore/components/controls/DatasourceControl.jsx
+++ b/superset-frontend/src/explore/components/controls/DatasourceControl.jsx
@@ -144,6 +144,7 @@ class DatasourceControl extends React.PureComponent {
       this.toggleEditDatasourceModal();
     }
     if (key === VIEW_IN_SQL_LAB) {
+      console.log('hitting this line of code');
       const { datasource } = this.props;
       const payload = {
         datasourceKey: `${datasource.id}__${datasource.type}`,
diff --git a/superset-frontend/src/explore/exploreUtils.js b/superset-frontend/src/explore/exploreUtils.js
index 3b70733..5800b38 100644
--- a/superset-frontend/src/explore/exploreUtils.js
+++ b/superset-frontend/src/explore/exploreUtils.js
@@ -245,6 +245,7 @@ export function postForm(url, payload, target = '_blank') {
   data.value = safeStringify(payload);
   hiddenForm.appendChild(data);
 
+  console.log(hiddenForm);
   document.body.appendChild(hiddenForm);
   hiddenForm.submit();
   document.body.removeChild(hiddenForm);