From f93bb4441b2c2d7281eea89e145f7eef192242be Mon Sep 17 00:00:00 2001 From: ivan770 Date: Tue, 22 May 2018 17:46:54 +0300 Subject: [PATCH] Add table-based build --- construct.html | 29 ++++++++++++++++++++++------- index.html | 10 +++++----- js/build.js | 15 +++++++++++++++ js/commands.js | 5 ++++- main.js | 10 +++++++++- 5 files changed, 55 insertions(+), 14 deletions(-) create mode 100644 js/build.js diff --git a/construct.html b/construct.html index 3f5abdf..2174487 100644 --- a/construct.html +++ b/construct.html @@ -8,13 +8,28 @@ -
-
- - - -
-
+ + + + + + + + + + +
ColumnRow
+ + diff --git a/index.html b/index.html index 5ae4976..603ca04 100644 --- a/index.html +++ b/index.html @@ -21,7 +21,7 @@ Run Previous command - + Build result
No command assigned
@@ -57,7 +57,7 @@ const paraminput = document.getElementById('param') const prevValue = document.getElementById('prevValue') const prevButton = document.getElementById('prevButton') - const assistantButton = document.getElementById('assistantButton') + const buildButton = document.getElementById('buildButton') const pingObj = document.getElementById("ping") const pjson = require('./package.json'); @@ -142,9 +142,9 @@ } }); - /* assistantButton.addEventListener("click" , function (e) { - ipc.send('assistant') - }) */ + buildButton.addEventListener("click" , function (e) { + ipc.send('buildOpen') + }) cmd.addEventListener("keyup", function(e) { var split = cmd.value.split(" "); diff --git a/js/build.js b/js/build.js new file mode 100644 index 0000000..3d3ef57 --- /dev/null +++ b/js/build.js @@ -0,0 +1,15 @@ +function build_add (c1, c2) { + let table = document.getElementById("build"); + let row = table.insertRow(1); + let cell1 = row.insertCell(0); + let cell2 = row.insertCell(1); + cell1.innerHTML = `${c1}`; + cell2.innerHTML = `${c2}`; +} + +function build_clear () { + let table = document.getElementById("build"); + while(table.rows.length > 1) { + table.deleteRow(1); + } +} diff --git a/js/commands.js b/js/commands.js index 78435b3..5cd0948 100644 --- a/js/commands.js +++ b/js/commands.js @@ -88,12 +88,15 @@ function querydb(host, user, password, query, database, port, build) { throw err } else { if (build == 1) { + ipc.send("build_clear") Object.keys(result).forEach(function(key) { var row = result[key]; Object.keys(row).forEach(function(key) { - appendLog(key + ' // ' + row[key], "BUILD"); + // appendLog(key + ' // ' + row[key], "BUILD"); + ipc.send("build", key, row[key]) }); }); + appendLog("Build completed!", "BUILD") } else { appendLog('Result(JSON): ' + JSON.stringify(result), 'QUERYDB') } diff --git a/main.js b/main.js index 7c04ae0..0951998 100644 --- a/main.js +++ b/main.js @@ -131,6 +131,14 @@ ipc.on('exit', function(event) { app.exit() }) -ipc.on('assistant', function(event) { +ipc.on('buildOpen', function(event) { assistantWin.show() }) + +ipc.on('build', function(event, arg1, arg2) { + assistantWin.webContents.send('build', arg1, arg2); +}) + +ipc.on('build_clear', function(event) { + assistantWin.webContents.send('clear'); +})