diff options
| author | James Barnett <noreply@jamesbarnett.xyz> | 2018-02-20 21:44:28 +0000 |
|---|---|---|
| committer | James Barnett <noreply@jamesbarnett.xyz> | 2018-02-20 21:44:28 +0000 |
| commit | b81c0f834f7f2285c40cfd57eb2943140025edad (patch) | |
| tree | 2c45b5d844e2a8413f3189090e5f6373226f4fca /new-connection.js | |
| parent | 52f6783f63d2e2f52e06d14a97b5e00eab8ac1c0 (diff) | |
| download | sql-plus-plus-b81c0f834f7f2285c40cfd57eb2943140025edad.tar.xz sql-plus-plus-b81c0f834f7f2285c40cfd57eb2943140025edad.zip | |
Dynamically create query executors - WIP
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 |