Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Commit 2c45e6d

Browse files
committed
move preview state from local to global
1 parent 27888e7 commit 2c45e6d

File tree

10 files changed

+209
-241
lines changed

10 files changed

+209
-241
lines changed

app/actions/sessions.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const setIndex = createAction('SET_INDEX');
1212
export const mergeConnections = createAction('MERGE_CONNECTIONS');
1313
export const updateConnection = createAction('UPDATE_CREDENTIAL');
1414
export const deleteConnection = createAction('DELETE_CREDENTIAL');
15+
export const updatePreview = createAction('UPDATE_PREVIEW');
1516

1617
const DELETE_TAB_MESSAGE = 'You are about to delete a connection. ' +
1718
'If you have scheduled persistent queries with that connection, they ' +
@@ -52,8 +53,6 @@ function POST(path, body = {}) {
5253
body: body ? JSON.stringify(body) : null
5354
};
5455

55-
console.warn('POST: ', path, payload);
56-
5756
return fetch(`${baseUrl()}/${path}`, payload);
5857
}
5958

@@ -224,9 +223,8 @@ export function previewTable (connectionId, dialect, table, database) {
224223
export function getSqlSchema (connectionId, dialect, database) {
225224
const body = {
226225
query: DATABASE_SCHEMA(dialect, database)
227-
};
228-
console.warn(dialect, database, body);
229-
return apiThunk(
226+
};
227+
return apiThunk(
230228
`connections/${connectionId}/query`,
231229
'POST',
232230
'previewTableRequest',

app/components/Settings/OptionsDropdown/TableDropdown.react.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

app/components/Settings/Preview/CodeEditorField.react.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
'use es6';
22
import React, { Component } from 'react';
33
import {connect} from 'react-redux';
4-
import CodeMirror from 'react-codemirror';
4+
// https://github.com/JedWatson/react-codemirror/issues/106
5+
import CodeMirror from '@skidding/react-codemirror';
56
// assuming a setup with webpack/create-react-app import the additional js/css files
67
import 'codemirror/mode/sql/sql';
78
import 'codemirror/addon/hint/show-hint';
@@ -16,7 +17,8 @@ class CodeEditorField extends Component {
1617
this.handleChange = this.handleChange.bind(this);
1718

1819
this.state = {
19-
tables: {}
20+
tables: {},
21+
code: ''
2022
}
2123
}
2224

@@ -49,7 +51,6 @@ class CodeEditorField extends Component {
4951
}
5052
newColumnArray.push(row[COLUMN_NAME]);
5153
});
52-
console.warn(schema, tables);
5354
this.setState({tables: tables});
5455
})
5556
.catch(function(error) {
@@ -102,6 +103,8 @@ class CodeEditorField extends Component {
102103
}
103104
};
104105

106+
console.log('cm', this.props.value);
107+
105108
return (
106109
<CodeMirror
107110
ref="CodeMirror"

0 commit comments

Comments
 (0)