diff options
| -rw-r--r-- | editor-instance.html | 2 | ||||
| -rw-r--r-- | index.html | 11 | ||||
| -rw-r--r-- | instance-manager.js | 18 | ||||
| -rw-r--r-- | main.js | 24 | ||||
| -rw-r--r-- | new-connection.html | 62 | ||||
| -rw-r--r-- | package-lock.json | 6 | ||||
| -rw-r--r-- | package.json | 3 | ||||
| -rw-r--r-- | styles/editor-instance.css (renamed from styles/style.css) | 3 | ||||
| -rw-r--r-- | styles/instance-manager.css | 28 | ||||
| -rw-r--r-- | styles/new-connection.css | 3 |
10 files changed, 149 insertions, 11 deletions
diff --git a/editor-instance.html b/editor-instance.html index 1983bfe..454c6ce 100644 --- a/editor-instance.html +++ b/editor-instance.html @@ -9,7 +9,7 @@ <link rel="stylesheet" href="node_modules/codemirror/theme/dracula.css"></link> <link rel="stylesheet" href="node_modules/codemirror/addon/hint/show-hint.css"></link> <link rel="stylesheet" href="node_modules/jquery.tabulator/dist/css/tabulator.css"></link> - <link rel="stylesheet" type="text/css" href="./styles/style.css"></link> + <link rel="stylesheet" type="text/css" href="./styles/editor-instance.css"></link> <link rel="stylesheet" type="text/css" href="./styles/table-style.css"></link> </head> @@ -5,17 +5,16 @@ <title>SQL++</title> <link rel="stylesheet" href="node_modules/electron-tabs/electron-tabs.css"></link> - <style> - body { - margin: 0; - } - </style> + <link rel="stylesheet" href="./styles/instance-manager.css"></link> + </head> <body> <div class="etabs-tabgroup"> <div class="etabs-tabs"></div> - <div class="etabs-buttons"></div> + <div class="etabs-buttons"> + <button id="new-connection">New connection</button> + </div> </div> <div class="etabs-views"></div> diff --git a/instance-manager.js b/instance-manager.js index e8b803e..115f359 100644 --- a/instance-manager.js +++ b/instance-manager.js @@ -2,6 +2,7 @@ const { ipcRenderer } = require('electron'); const TabGroup = require("electron-tabs"); +const $ = window.jQuery = require("jquery"); let tabGroup = new TabGroup(); let tab = tabGroup.addTab({ @@ -26,4 +27,19 @@ let tab2 = tabGroup.addTab({ visible: true, active: true, webviewAttributes: { "nodeintegration": true }, -});
\ No newline at end of file +}); + +function createNewConnection() { + ipcRenderer.send("instanceManager.openNewConnectionDialog"); +} + +ipcRenderer.on("instanceManager.newConnectionCallback", (event, response) => { + console.log(response); +}); + + +$(document).ready(() => { + $("#new-connection").click(() => { + createNewConnection(); + }) +})
\ No newline at end of file @@ -5,6 +5,7 @@ const url = require("url"); let uiWindow; let queryExecutorProcess; +let newConnectionDialog; function createMainWindow() { uiWindow = new BrowserWindow({ @@ -25,7 +26,7 @@ function createMainWindow() { function createQueryExecutorProcess() { queryExecutorProcess = new BrowserWindow({ - show: true + show: false }); queryExecutorProcess.loadURL(url.format({ @@ -57,6 +58,27 @@ app.on("activate", () => { } }); +function createNewConnectionDialog() { + newConnectionDialog = new BrowserWindow({ + width: 400, + height: 470 + }); + newConnectionDialog.loadURL(url.format({ + pathname: path.join(__dirname, "new-connection.html"), + protocol: "file:", + slashes: true + })); + + newConnectionDialog.on("closed", () => { + newConnectionDialog = null; + }); +} + +ipcMain.on("instanceManager.openNewConnectionDialog", (event, payload) => { + createNewConnectionDialog(); +}); + + const { webContents } = require('electron'); // TODO - only send messages to instance manager which will route request to correct webView, rather than diff --git a/new-connection.html b/new-connection.html new file mode 100644 index 0000000..dace021 --- /dev/null +++ b/new-connection.html @@ -0,0 +1,62 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="UTF-8"> + <title>SQL++ - New connection</title> + <link rel="stylesheet" href="node_modules/bulma/css/bulma.css"></link> + <link rel="stylesheet" href="./styles/new-connection.css"></link> + </head> + <body> + + <h4 class="title is-4" >Add new connection</h4> + + <div class="field"> + <label class="label is-small" for="vendor">Vendor</label> + <div class="control"> + <div class="select is-small"> + <select id="vendor"> + <option>Postgres</option> + <option>MySQL/MariaDB</option> + <option>Oracle</option> + </select> + </div> + </div> + </div> + <div class="field"> + <label class="label is-small" for="hostname">Hostname</label> + <div class="control"> + <input id="hostname" class="input is-small" type="text"/> + </div> + </div> + <div class="field"> + <label class="label is-small" for="port">Port</label> + <div class="control"> + <input id="port" class="input is-small" type="text" placeholder="5432"/> + </div> + </div> + <div class="field"> + <label class="label is-small" for="username">Username</label> + <div class="control"> + <input id="username" class="input is-small" type="text"/> + </div> + </div> + <div class="field"> + <label class="label is-small" for="password">Password</label> + <div class="control"> + <input id="password" class="input is-small" type="text"/> + </div> + </div> + <div class="field is-grouped"> + <div class="control"> + <button id="create-connection" class="button is-link is-small">Add</button> + </div> + <div class="control"> + <button id="test-connection" class="button is-small">Test connection</button> + </div> + <div class="control"> + <button id="cancel" class="button is-text is-small">Cancel</button> + </div> + </div> + </body> + +</html>
\ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 7d59e86..b05f744 100644 --- a/package-lock.json +++ b/package-lock.json @@ -111,6 +111,12 @@ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, + "bulma": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/bulma/-/bulma-0.6.2.tgz", + "integrity": "sha1-9LHRHVrMUaeWROsKKwsQZJ09cfU=", + "dev": true + }, "camelcase": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", diff --git a/package.json b/package.json index 5f05487..5dd96cb 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "jquery-ui": "1.12.1", "jquery.tabulator": "3.4.2", "electron-tabs": "0.9.0", - "uuid": "3.2.1" + "uuid": "3.2.1", + "bulma": "0.6.2" } } diff --git a/styles/style.css b/styles/editor-instance.css index 7ae5727..99ac763 100644 --- a/styles/style.css +++ b/styles/editor-instance.css @@ -32,7 +32,8 @@ body { .flex-wrapper .row.header { flex: 0 1 auto; - background-color: #474A5E; + /* background-color: #474A5E; */ + background: #6D8A88; color: white; } diff --git a/styles/instance-manager.css b/styles/instance-manager.css new file mode 100644 index 0000000..8449b9c --- /dev/null +++ b/styles/instance-manager.css @@ -0,0 +1,28 @@ +body { + margin: 0; +} + +.etabs-tabgroup { + background-color: #282a36; +} + +.etabs-tab { + color: white; + background: none; + background-color: #474A5E; + border: none; +} + +.etabs-tab.active { + background: #6D8A88; +} + +.etabs-views { + border: none; +} + +.etabs-buttons button { + width: inherit; + padding: 4px 6px; + background: #6D8A88; +}
\ No newline at end of file diff --git a/styles/new-connection.css b/styles/new-connection.css new file mode 100644 index 0000000..97aaae6 --- /dev/null +++ b/styles/new-connection.css @@ -0,0 +1,3 @@ +html, body { + padding: 8px; +}
\ No newline at end of file |