mirror of
https://github.com/apache/superset.git
synced 2026-04-21 00:54:44 +00:00
[sqllab] config item for SQLLAB_DEFAULT_DBID (#1793)
This commit is contained in:
committed by
GitHub
parent
a95cd71456
commit
aeda5bd260
@@ -4,27 +4,29 @@ import { now } from '../modules/dates';
|
||||
import { addToObject, alterInObject, alterInArr, removeFromArr, getFromArr, addToArr }
|
||||
from '../reduxUtils.js';
|
||||
|
||||
export const defaultQueryEditor = {
|
||||
id: shortid.generate(),
|
||||
title: 'Untitled Query',
|
||||
sql: 'SELECT *\nFROM\nWHERE',
|
||||
selectedText: null,
|
||||
latestQueryId: null,
|
||||
autorun: false,
|
||||
dbId: null,
|
||||
};
|
||||
export function getInitialState(defaultDbId) {
|
||||
const defaultQueryEditor = {
|
||||
id: shortid.generate(),
|
||||
title: 'Untitled Query',
|
||||
sql: 'SELECT *\nFROM\nWHERE',
|
||||
selectedText: null,
|
||||
latestQueryId: null,
|
||||
autorun: false,
|
||||
dbId: defaultDbId,
|
||||
};
|
||||
|
||||
export const initialState = {
|
||||
alerts: [],
|
||||
networkOn: true,
|
||||
queries: {},
|
||||
databases: {},
|
||||
queryEditors: [defaultQueryEditor],
|
||||
tabHistory: [defaultQueryEditor.id],
|
||||
tables: [],
|
||||
queriesLastUpdate: 0,
|
||||
activeSouthPaneTab: 'Results',
|
||||
};
|
||||
return {
|
||||
alerts: [],
|
||||
networkOn: true,
|
||||
queries: {},
|
||||
databases: {},
|
||||
queryEditors: [defaultQueryEditor],
|
||||
tabHistory: [defaultQueryEditor.id],
|
||||
tables: [],
|
||||
queriesLastUpdate: 0,
|
||||
activeSouthPaneTab: 'Results',
|
||||
};
|
||||
}
|
||||
|
||||
export const sqlLabReducer = function (state, action) {
|
||||
const actionHandlers = {
|
||||
@@ -70,7 +72,7 @@ export const sqlLabReducer = function (state, action) {
|
||||
return Object.assign({}, state, { queries: newQueries });
|
||||
},
|
||||
[actions.RESET_STATE]() {
|
||||
return Object.assign({}, initialState);
|
||||
return Object.assign({}, getInitialState());
|
||||
},
|
||||
[actions.MERGE_TABLE]() {
|
||||
const at = Object.assign({}, action.table);
|
||||
|
||||
Reference in New Issue
Block a user