|
@@ -31,7 +31,8 @@ import {
|
|
|
import {
|
|
import {
|
|
|
CONFIG_REFRESHED_EVENT,
|
|
CONFIG_REFRESHED_EVENT,
|
|
|
GET_KNOWN_CONFIG_EVENT,
|
|
GET_KNOWN_CONFIG_EVENT,
|
|
|
- findEditorConnector
|
|
|
|
|
|
|
+ findEditorConnector,
|
|
|
|
|
+ getLastKnownConfig
|
|
|
} from 'utils/hueConfig';
|
|
} from 'utils/hueConfig';
|
|
|
|
|
|
|
|
class EditorViewModel {
|
|
class EditorViewModel {
|
|
@@ -277,20 +278,20 @@ class EditorViewModel {
|
|
|
return this.snippetViewSettings.default;
|
|
return this.snippetViewSettings.default;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- init() {
|
|
|
|
|
|
|
+ async init() {
|
|
|
if (this.editorId) {
|
|
if (this.editorId) {
|
|
|
- this.openNotebook(this.editorId);
|
|
|
|
|
|
|
+ await this.openNotebook(this.editorId);
|
|
|
} else if (
|
|
} else if (
|
|
|
window.location.getParameter('gist') !== '' ||
|
|
window.location.getParameter('gist') !== '' ||
|
|
|
window.location.getParameter('type') !== ''
|
|
window.location.getParameter('type') !== ''
|
|
|
) {
|
|
) {
|
|
|
- this.newNotebook(window.location.getParameter('type'));
|
|
|
|
|
|
|
+ await this.newNotebook(window.location.getParameter('type'));
|
|
|
} else if (window.location.getParameter('editor') !== '') {
|
|
} else if (window.location.getParameter('editor') !== '') {
|
|
|
- this.openNotebook(window.location.getParameter('editor'));
|
|
|
|
|
|
|
+ await this.openNotebook(window.location.getParameter('editor'));
|
|
|
} else if (this.notebooks.length > 0) {
|
|
} else if (this.notebooks.length > 0) {
|
|
|
this.loadNotebook(this.notebooks[0]); // Old way of loading json for /browse
|
|
this.loadNotebook(this.notebooks[0]); // Old way of loading json for /browse
|
|
|
} else {
|
|
} else {
|
|
|
- this.newNotebook();
|
|
|
|
|
|
|
+ await this.newNotebook();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -320,7 +321,18 @@ class EditorViewModel {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async newNotebook(connectorId, callback, queryTab) {
|
|
async newNotebook(connectorId, callback, queryTab) {
|
|
|
- const connector = findEditorConnector(connector => connector.id === connectorId);
|
|
|
|
|
|
|
+ if (!connectorId) {
|
|
|
|
|
+ connectorId = getLastKnownConfig().default_sql_interpreter;
|
|
|
|
|
+ }
|
|
|
|
|
+ let connector;
|
|
|
|
|
+ if (connectorId) {
|
|
|
|
|
+ connector = findEditorConnector(connector => connector.id === connectorId);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const connectors = getLastKnownConfig().app_config.editor.interpreters;
|
|
|
|
|
+ if (connectors.length) {
|
|
|
|
|
+ connector = connectors[0];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
if (!connector) {
|
|
if (!connector) {
|
|
|
console.warn('No connector found for ID ' + connectorId);
|
|
console.warn('No connector found for ID ' + connectorId);
|
|
|
} else {
|
|
} else {
|