diff options
| author | James Barnett <noreply@jamesbarnett.xyz> | 2018-02-17 18:03:34 +0000 |
|---|---|---|
| committer | James Barnett <noreply@jamesbarnett.xyz> | 2018-02-17 18:03:34 +0000 |
| commit | 2327e4e536e3be29ffd7af54ebba6ae24265c692 (patch) | |
| tree | 1441aaa24076633c08fa05da4f17f202e6301af7 | |
| parent | 6e21916395fac6861783c2b930b47242ac0f4c09 (diff) | |
| download | sql-plus-plus-2327e4e536e3be29ffd7af54ebba6ae24265c692.tar.xz sql-plus-plus-2327e4e536e3be29ffd7af54ebba6ae24265c692.zip | |
WIP - Add basic unstyled static tabs. IPC needs work
| -rw-r--r-- | editor-instance.html | 45 | ||||
| -rw-r--r-- | editor-instance.js (renamed from renderer.js) | 2 | ||||
| -rw-r--r-- | index.html | 38 | ||||
| -rw-r--r-- | instance-manager.js | 29 | ||||
| -rw-r--r-- | main.js | 16 | ||||
| -rw-r--r-- | package-lock.json | 6 | ||||
| -rw-r--r-- | package.json | 3 |
7 files changed, 108 insertions, 31 deletions
diff --git a/editor-instance.html b/editor-instance.html new file mode 100644 index 0000000..1983bfe --- /dev/null +++ b/editor-instance.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<html> + +<head> + <meta charset="UTF-8"> + <title>SQL++</title> + + <link rel="stylesheet" href="node_modules/codemirror/lib/codemirror.css"></link> + <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/table-style.css"></link> + +</head> + +<body> + + <div class="flex-wrapper"> + <div class="row header"> + <input id="run-query" type="button" value="Run"></input> + </div> + + + <div class="row content"> + <div id="editor" class="editor-row split-row"></div> + + <div class="results-row split-row"> + <div id="result-table"></div> + <div id="result-error"></div> + </div> + </div> + + <div class="row footer"> + <div id="execution-status" class="exec-idle">Idle</div> + <div id="execution-time"></div> + <div id="cursor-coords"></div> + </div> + </div> + <script> + require("./editor-instance.js"); + </script> +</body> + +</html>
\ No newline at end of file diff --git a/renderer.js b/editor-instance.js index 9fe1be7..3ec123a 100644 --- a/renderer.js +++ b/editor-instance.js @@ -202,7 +202,7 @@ function _setExecutionStatusIndicator(status) { } function _destroyDataTable() { - if(dataTable) { + if (dataTable) { _resultTable().tabulator("destroy"); _resultTable().removeAttr("style").empty(); dataTable = undefined; @@ -4,37 +4,23 @@ <meta charset="UTF-8"> <title>SQL++</title> - <link rel="stylesheet" href="node_modules/codemirror/lib/codemirror.css"></link> - <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/table-style.css"></link> + <link rel="stylesheet" href="node_modules/electron-tabs/electron-tabs.css"></link> + <style> + body { + margin: 0; + } + </style> </head> <body> - <div class="flex-wrapper"> - <div class="row header"> - <input id="run-query" type="button" value="Run"></input> - </div> - - <div class="row content"> - <div id="editor" class="editor-row split-row"></div> - - <div class="results-row split-row"> - <div id="result-table"></div> - <div id="result-error"></div> - </div> - </div> - - <div class="row footer"> - <div id="execution-status" class="exec-idle">Idle</div> - <div id="execution-time"></div> - <div id="cursor-coords"></div> - </div> + <div class="etabs-tabgroup"> + <div class="etabs-tabs"></div> + <div class="etabs-buttons"></div> </div> + <div class="etabs-views"></div> + <script> - require("./renderer.js"); + require("./instance-manager.js"); </script> </body> </html>
\ No newline at end of file diff --git a/instance-manager.js b/instance-manager.js new file mode 100644 index 0000000..e8b803e --- /dev/null +++ b/instance-manager.js @@ -0,0 +1,29 @@ +"use strict"; + +const { ipcRenderer } = require('electron'); +const TabGroup = require("electron-tabs"); + +let tabGroup = new TabGroup(); +let tab = tabGroup.addTab({ + title: "Electron", + 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.openDevTools(); + // }) + // } + // } +}); + +let tab2 = tabGroup.addTab({ + title: "Electron", + src: 'file://' + __dirname + '/editor-instance.html', + visible: true, + active: true, + webviewAttributes: { "nodeintegration": true }, +});
\ No newline at end of file @@ -25,7 +25,7 @@ function createMainWindow() { function createQueryExecutorProcess() { queryExecutorProcess = new BrowserWindow({ - show: false + show: true }); queryExecutorProcess.loadURL(url.format({ @@ -57,8 +57,18 @@ app.on("activate", () => { } }); -ipcMain.on("queryExecutor.runQueryComplete", (event, payload) => uiWindow.webContents.send("queryExecutor.runQueryComplete", payload)); +const { webContents } = require('electron'); + +ipcMain.on("queryExecutor.runQueryComplete", (event, payload) => { + webContents.getAllWebContents().forEach((w) => { + w.send("queryExecutor.runQueryComplete", payload); + }) +}); ipcMain.on("queryExecutor.runQuery", (event, payload) => queryExecutorProcess.webContents.send("queryExecutor.runQuery", payload)); -ipcMain.on("queryExecutor.queryTableMetadataComplete", (event, payload) => uiWindow.webContents.send("queryExecutor.queryTableMetadataComplete", payload)); +ipcMain.on("queryExecutor.queryTableMetadataComplete", (event, payload) => { + webContents.getAllWebContents().forEach((w) => { + w.send("queryExecutor.queryTableMetadataComplete", payload); + }) +}); ipcMain.on("queryExecutor.queryTableMetadata", (event, payload) => queryExecutorProcess.webContents.send("queryExecutor.queryTableMetadata", payload));
\ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 04cec7a..7d59e86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -318,6 +318,12 @@ "sumchecker": "1.3.1" } }, + "electron-tabs": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/electron-tabs/-/electron-tabs-0.9.0.tgz", + "integrity": "sha1-kb+L66dftJjp0vjf5WHhH6cLm34=", + "dev": true + }, "error-ex": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", diff --git a/package.json b/package.json index ae1958c..f0ab1d3 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "pg": "7.4.1", "split.js": "1.3.5", "jquery-ui": "1.12.1", - "jquery.tabulator": "3.4.2" + "jquery.tabulator": "3.4.2", + "electron-tabs": "0.9.0" } } |