diff options
| author | James Barnett <james.barnett@fivium.co.uk> | 2018-02-21 21:42:55 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-02-21 21:42:55 +0000 |
| commit | 11e98009906651acb110cd3b1625a771b1e2f472 (patch) | |
| tree | de0a90c201f1949e701c969b2a3a94d7015f4006 /instance-manager.js | |
| parent | 6e21916395fac6861783c2b930b47242ac0f4c09 (diff) | |
| parent | 703f78867653ed9c53a745f9808eb96ae8a89dc7 (diff) | |
| download | sql-plus-plus-11e98009906651acb110cd3b1625a771b1e2f472.tar.xz sql-plus-plus-11e98009906651acb110cd3b1625a771b1e2f472.zip | |
Merge branch tabbed-interface into master
Support multiple, configurable connections
Each connection is displayed in its own tab in the main UI, and gets its own query executor.
New connections can be added dynamically through the new connection dialog.
Diffstat (limited to 'instance-manager.js')
| -rw-r--r-- | instance-manager.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/instance-manager.js b/instance-manager.js new file mode 100644 index 0000000..7d27a7e --- /dev/null +++ b/instance-manager.js @@ -0,0 +1,40 @@ +"use strict"; + +const { ipcRenderer } = require('electron'); +const TabGroup = require("electron-tabs"); +const $ = window.jQuery = require("jquery"); + +const tabGroup = new TabGroup(); + +function createNewConnection() { + ipcRenderer.send("instanceManager.openNewConnectionDialog"); +} + +function registerNewInstance(payload) { + tabGroup.addTab({ + title: payload.connectionName, + src: "file://" + __dirname + "/editor-instance.html", + visible: true, + active: true, + webviewAttributes: {"nodeintegration":true}, + ready: tab => { + let webview = tab.webview; + if (!!webview) { + webview.addEventListener("dom-ready", () => { + webview.send("editorInstance.registerQueryExecutor", payload.assignedQueryExecutorId); + }) + } + } + }); +} + +ipcRenderer.on("instanceManager.registerNewInstance", (event, payload) => { + registerNewInstance(payload); +}); + + +$(document).ready(() => { + $("#new-connection").click(() => { + createNewConnection(); + }) +})
\ No newline at end of file |