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 /new-connection.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 'new-connection.js')
| -rw-r--r-- | new-connection.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/new-connection.js b/new-connection.js new file mode 100644 index 0000000..2493c25 --- /dev/null +++ b/new-connection.js @@ -0,0 +1,46 @@ +"use strict"; + +const { remote, ipcRenderer } = require("electron"); +const $ = window.jQuery = require("jquery"); + +function cancel() { + let confirm = remote.dialog.showMessageBox(remote.getCurrentWindow(), { + type: "question", + buttons: ["Yes", "No"], + title: "Confirm", + message: "Remove this connection?" + }); + + if (confirm === 0) { + remote.getCurrentWindow().close(); + } +} + +function parseForm() { + let formData = {}; + + $("form").serializeArray().forEach((input) => { + formData[input.name] = input.value; + }); + + return formData; +} + +function createConnection() { + let connectionProps = parseForm(); + ipcRenderer.send("newConnection.createConnection", connectionProps); +} + +$(document).ready(() => { + $("#create-connection").click(() => { + createConnection(); + }); + + $("#test-connection").click(() => { + //TODO + }); + + $("#cancel").click(() => { + cancel(); + }); +});
\ No newline at end of file |