diff --git a/superset/assets/javascripts/SqlLab/actions.js b/superset/assets/javascripts/SqlLab/actions.js index 4203a757420bf..517c5d28d933d 100644 --- a/superset/assets/javascripts/SqlLab/actions.js +++ b/superset/assets/javascripts/SqlLab/actions.js @@ -20,6 +20,8 @@ export const QUERY_EDITOR_SET_TITLE = 'QUERY_EDITOR_SET_TITLE'; export const QUERY_EDITOR_SET_AUTORUN = 'QUERY_EDITOR_SET_AUTORUN'; export const QUERY_EDITOR_SET_SQL = 'QUERY_EDITOR_SET_SQL'; export const QUERY_EDITOR_SET_SELECTED_TEXT = 'QUERY_EDITOR_SET_SELECTED_TEXT'; +export const QUERY_EDITOR_PERSIST_HEIGHT = 'QUERY_EDITOR_PERSIST_HEIGHT'; + export const SET_DATABASES = 'SET_DATABASES'; export const SET_ACTIVE_QUERY_EDITOR = 'SET_ACTIVE_QUERY_EDITOR'; export const SET_ACTIVE_SOUTHPANE_TAB = 'SET_ACTIVE_SOUTHPANE_TAB'; @@ -346,6 +348,10 @@ export function refreshQueries(alteredQueries) { return { type: REFRESH_QUERIES, alteredQueries }; } +export function persistEditorHeight(queryEditor, currentHeight) { + return { type: QUERY_EDITOR_PERSIST_HEIGHT, queryEditor, currentHeight }; +} + export function popStoredQuery(urlId) { return function (dispatch) { $.ajax({ diff --git a/superset/assets/javascripts/SqlLab/components/SqlEditor.jsx b/superset/assets/javascripts/SqlLab/components/SqlEditor.jsx index 5aa1497464f2a..63722259dd8b5 100644 --- a/superset/assets/javascripts/SqlLab/components/SqlEditor.jsx +++ b/superset/assets/javascripts/SqlLab/components/SqlEditor.jsx @@ -67,6 +67,10 @@ class SqlEditor extends React.PureComponent { southPaneHeight: height - this.refs.ace.clientHeight, height, }); + + if (this.refs.ace.clientHeight) { + this.props.actions.persistEditorHeight(this.props.queryEditor, this.refs.ace.clientHeight); + } } setQueryEditorSql(sql) { this.props.actions.queryEditorSetSql(this.props.queryEditor, sql); @@ -191,7 +195,7 @@ class SqlEditor extends React.PureComponent { } render() { const height = this.sqlEditorHeight(); - const defaultNorthHeight = 200; + const defaultNorthHeight = this.props.queryEditor.height || 200; return (