Skip to content

Commit

Permalink
Change build process, version upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan770 committed Dec 1, 2018
1 parent c8ce36f commit d975e5b
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 33 deletions.
57 changes: 43 additions & 14 deletions construct.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,55 @@
</head>

<body>
<table id="build">
<thead>
<tr>
<th>Column</th>
<th>Row</th>
</tr>
</thead>

<tbody>
</tbody>
</table>
<script>
<script src="js/jquery.min.js"></script>
<script>
const electron = require('electron')
const ipc = require('electron').ipcRenderer
ipc.on('build', function(event, arg1, arg2) {
build_add(arg1, arg2)
ipc.on('build', function(event, json) {
document.body.appendChild(buildHtmlTable(json));
})
ipc.on('clear', function(event) {
build_clear()
})
var _table_ = document.createElement('table'),
_tr_ = document.createElement('tr'),
_th_ = document.createElement('th'),
_td_ = document.createElement('td');

// Builds the HTML Table out of myList json data from Ivy restful service.
function buildHtmlTable(json) {
var table = _table_.cloneNode(false),
columns = addAllColumnHeaders(json, table);
for (var i=0, maxi=json.length; i < maxi; ++i) {
var tr = _tr_.cloneNode(false);
for (var j=0, maxj=columns.length; j < maxj ; ++j) {
var td = _td_.cloneNode(false);
cellValue = json[i][columns[j]];
td.appendChild(document.createTextNode(json[i][columns[j]] || ''));
tr.appendChild(td);
}
table.appendChild(tr);
}
return table;
}

function addAllColumnHeaders(json, table)
{
var columnSet = [],
tr = _tr_.cloneNode(false);
for (var i=0, l=json.length; i < l; i++) {
for (var key in json[i]) {
if (json[i].hasOwnProperty(key) && columnSet.indexOf(key)===-1) {
columnSet.push(key);
var th = _th_.cloneNode(false);
th.appendChild(document.createTextNode(key));
tr.appendChild(th);
}
}
}
table.appendChild(tr);
return columnSet;
}
</script>
<script src="js/build.js"></script>
<script type="text/javascript" src="js/materialize.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@
});
</script>
<script src="js/commands.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/materialize.min.js"></script>
<script>
if (window.module) module = window.module;
Expand Down
16 changes: 8 additions & 8 deletions js/build.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
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_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");
Expand Down
10 changes: 2 additions & 8 deletions js/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,8 @@ 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");
ipc.send("build", key, row[key])
});
});
ipc.send("build_clear")
ipc.send("build", result);
appendLog("Build completed!", "BUILD")
exec1 = performance.now()
exectime.innerText = "query: " + Math.round((exec1 - exec0)) + " ms";
Expand Down
2 changes: 2 additions & 0 deletions js/jquery.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ app.on('activate', function() {
ipc.on('developer', function(event) {
mainWindow.webContents.openDevTools()
settingsWin.webContents.openDevTools()
assistantWin.webContents.openDevTools()
})

ipc.on('exit', function(event) {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pinesql",
"version": "1.7.3",
"version": "1.8.0",
"description": "Electron-based SQL editor",
"productName": "PineSQL",
"main": "./main.js",
Expand Down

0 comments on commit d975e5b

Please sign in to comment.