[SQL Lab] Adding DB options for SQL LAb (#1054)

* [SQL Lab] Adding DB options for SQL LAb

each db can be exposed or not in SQL Lab
CTAS is an option
target_schema placeholder (not hooked yet, but would force the CTAS to
target a specific schema)

* Addressing comments
This commit is contained in:
Maxime Beauchemin
2016-09-01 14:21:46 -07:00
committed by GitHub
parent 1667d15f31
commit 4b77710016
16 changed files with 170 additions and 66 deletions

View File

@@ -15,6 +15,7 @@ const defaultQueryEditor = {
export const initialState = {
alerts: [],
queries: {},
databases: {},
queryEditors: [defaultQueryEditor],
tabHistory: [defaultQueryEditor.id],
tables: [],
@@ -166,6 +167,13 @@ export const sqlLabReducer = function (state, action) {
[actions.ADD_ALERT]() {
return addToArr(state, 'alerts', action.alert);
},
[actions.SET_DATABASES]() {
const databases = {};
action.databases.forEach((db) => {
databases[db.id] = db;
});
return Object.assign({}, state, { databases });
},
[actions.REMOVE_ALERT]() {
return removeFromArr(state, 'alerts', action.alert);
},