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

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

commit 30ded7ddaa457a5a2938091d30bdf21c4b5d2fb4
Author: Grace Guo <[email protected]>
AuthorDate: Fri Aug 16 14:12:35 2019 -0700

    [sql lab] persist tables list in localStorage (#8054)
    
    * [sql lab] persist tables list in localStorage
    
    * persist ediotor panel size setting
    
    (cherry picked from commit 51bd34704cd0c6e6f3b49150743c32de16765673)
---
 superset/assets/src/SqlLab/App.jsx                                 | 1 -
 superset/assets/src/SqlLab/actions/sqlLab.js                       | 4 ++--
 superset/assets/src/SqlLab/components/SqlEditor.jsx                | 6 +++---
 superset/assets/src/SqlLab/reducers/sqlLab.js                      | 3 ++-
 superset/assets/src/SqlLab/utils/reduxStateToLocalStorageHelper.js | 4 ++++
 5 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/superset/assets/src/SqlLab/App.jsx 
b/superset/assets/src/SqlLab/App.jsx
index af35a1e..54c4711 100644
--- a/superset/assets/src/SqlLab/App.jsx
+++ b/superset/assets/src/SqlLab/App.jsx
@@ -58,7 +58,6 @@ const sqlLabPersistStateConfig = {
             ...state[path],
             queries: emptyQueryResults(state[path].queries),
             queryEditors: clearQueryEditors(state[path].queryEditors),
-            tables: [],
           };
         }
       });
diff --git a/superset/assets/src/SqlLab/actions/sqlLab.js 
b/superset/assets/src/SqlLab/actions/sqlLab.js
index d7b15c5..ca36428 100644
--- a/superset/assets/src/SqlLab/actions/sqlLab.js
+++ b/superset/assets/src/SqlLab/actions/sqlLab.js
@@ -455,8 +455,8 @@ export function setUserOffline(offline) {
   return { type: SET_USER_OFFLINE, offline };
 }
 
-export function persistEditorHeight(queryEditor, currentHeight) {
-  return { type: QUERY_EDITOR_PERSIST_HEIGHT, queryEditor, currentHeight };
+export function persistEditorHeight(queryEditor, northPercent, southPercent) {
+  return { type: QUERY_EDITOR_PERSIST_HEIGHT, queryEditor, northPercent, 
southPercent };
 }
 
 export function popStoredQuery(urlId) {
diff --git a/superset/assets/src/SqlLab/components/SqlEditor.jsx 
b/superset/assets/src/SqlLab/components/SqlEditor.jsx
index 9448a0b..8524daa 100644
--- a/superset/assets/src/SqlLab/components/SqlEditor.jsx
+++ b/superset/assets/src/SqlLab/components/SqlEditor.jsx
@@ -87,8 +87,8 @@ class SqlEditor extends React.PureComponent {
     this.state = {
       autorun: props.queryEditor.autorun,
       ctas: '',
-      northPercent: INITIAL_NORTH_PERCENT,
-      southPercent: INITIAL_SOUTH_PERCENT,
+      northPercent: props.queryEditor.northPercent || INITIAL_NORTH_PERCENT,
+      southPercent: props.queryEditor.southPercent || INITIAL_SOUTH_PERCENT,
       sql: props.queryEditor.sql,
     };
     this.sqlEditorRef = React.createRef();
@@ -143,7 +143,7 @@ class SqlEditor extends React.PureComponent {
 
     if (this.northPaneRef.current && this.northPaneRef.current.clientHeight) {
       this.props.actions.persistEditorHeight(this.props.queryEditor,
-        this.northPaneRef.current.clientHeight);
+        northPercent, southPercent);
     }
   }
   onSqlChanged(sql) {
diff --git a/superset/assets/src/SqlLab/reducers/sqlLab.js 
b/superset/assets/src/SqlLab/reducers/sqlLab.js
index 2244096..700c982 100644
--- a/superset/assets/src/SqlLab/reducers/sqlLab.js
+++ b/superset/assets/src/SqlLab/reducers/sqlLab.js
@@ -311,7 +311,8 @@ export default function sqlLabReducer(state = {}, action) {
     },
     [actions.QUERY_EDITOR_PERSIST_HEIGHT]() {
       return alterInArr(state, 'queryEditors', action.queryEditor, {
-        height: action.currentHeight,
+        northPercent: action.northPercent,
+        southPercent: action.southPercent,
       });
     },
     [actions.SET_DATABASES]() {
diff --git a/superset/assets/src/SqlLab/utils/reduxStateToLocalStorageHelper.js 
b/superset/assets/src/SqlLab/utils/reduxStateToLocalStorageHelper.js
index 6a517f6..aef0867 100644
--- a/superset/assets/src/SqlLab/utils/reduxStateToLocalStorageHelper.js
+++ b/superset/assets/src/SqlLab/utils/reduxStateToLocalStorageHelper.js
@@ -21,10 +21,14 @@ import { LOCALSTORAGE_MAX_QUERY_AGE_MS } from 
'../constants';
 const PERSISTENT_QUERY_EDITOR_KEYS = new Set([
   'autorun',
   'dbId',
+  'height',
   'id',
   'latestQueryId',
+  'northPercent',
   'queryLimit',
+  'schema',
   'selectedText',
+  'southPercent',
   'sql',
   'templateParams',
   'title',

Reply via email to