mirror of
https://github.com/apache/superset.git
synced 2026-04-26 19:44:58 +00:00
feat: add separate endpoint to fetch function names for autocomplete (#12840)
* WIP * Add unit test for API * Add spec * Fix unit test * Fix unit test * Fix test * Fix test * Add period to error message
This commit is contained in:
@@ -41,6 +41,7 @@ type HotKey = {
|
||||
interface Props {
|
||||
actions: {
|
||||
queryEditorSetSelectedText: (edit: any, text: null | string) => void;
|
||||
queryEditorSetFunctionNames: (queryEditor: object, dbId: number) => void;
|
||||
addTable: (queryEditor: any, value: any, schema: any) => void;
|
||||
};
|
||||
autocomplete: boolean;
|
||||
@@ -85,6 +86,10 @@ class AceEditorWrapper extends React.PureComponent<Props, State> {
|
||||
componentDidMount() {
|
||||
// Making sure no text is selected from previous mount
|
||||
this.props.actions.queryEditorSetSelectedText(this.props.queryEditor, null);
|
||||
this.props.actions.queryEditorSetFunctionNames(
|
||||
this.props.queryEditor,
|
||||
this.props.queryEditor.dbId,
|
||||
);
|
||||
this.setAutoCompleter(this.props);
|
||||
}
|
||||
|
||||
|
||||
@@ -474,9 +474,7 @@ class SqlEditor extends React.PureComponent {
|
||||
sql={this.props.queryEditor.sql}
|
||||
schemas={this.props.queryEditor.schemaOptions}
|
||||
tables={this.props.queryEditor.tableOptions}
|
||||
functionNames={
|
||||
this.props.database ? this.props.database.function_names : []
|
||||
}
|
||||
functionNames={this.props.queryEditor.functionNames}
|
||||
extendedTables={this.props.tables}
|
||||
height={`${aceEditorHeight}px`}
|
||||
hotkeys={hotkeys}
|
||||
|
||||
@@ -80,6 +80,10 @@ export default class SqlEditorLeftBar extends React.PureComponent {
|
||||
|
||||
onDbChange(db) {
|
||||
this.props.actions.queryEditorSetDb(this.props.queryEditor, db.id);
|
||||
this.props.actions.queryEditorSetFunctionNames(
|
||||
this.props.queryEditor,
|
||||
db.id,
|
||||
);
|
||||
}
|
||||
|
||||
onTableChange(tableName, schemaName) {
|
||||
|
||||
Reference in New Issue
Block a user