Complete energy+ call
This commit is contained in:
parent
a89ebc252e
commit
b8171e0934
8
package-lock.json
generated
8
package-lock.json
generated
@ -10,7 +10,8 @@
|
|||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"browser-fs-access": "^0.35.0",
|
"browser-fs-access": "^0.35.0",
|
||||||
"dotenv": "^16.4.5"
|
"dotenv": "^16.4.5",
|
||||||
|
"filereader": "^0.10.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^28.2.3",
|
"electron": "^28.2.3",
|
||||||
@ -1963,6 +1964,11 @@
|
|||||||
"minimatch": "^5.0.1"
|
"minimatch": "^5.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/filereader": {
|
||||||
|
"version": "0.10.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/filereader/-/filereader-0.10.3.tgz",
|
||||||
|
"integrity": "sha512-7F8w6GSXuHLN80ukaVOcHgBaiTRHUZr8GeEhNdqfAECcnBoROg4i8hTl+KqtF4yUPffOJVHEFg4iDJb7xIYFng=="
|
||||||
|
},
|
||||||
"node_modules/foreground-child": {
|
"node_modules/foreground-child": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz",
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"browser-fs-access": "^0.35.0",
|
"browser-fs-access": "^0.35.0",
|
||||||
"dotenv": "^16.4.5"
|
"dotenv": "^16.4.5",
|
||||||
|
"filereader": "^0.10.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
const { dialog, BrowserWindow } = require('electron')
|
const { dialog, BrowserWindow } = require('electron')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const { fileOpen, directoryOpen, fileSave, supported } = require('browser-fs-access')
|
|
||||||
const { Blob } = require('buffer')
|
const { Blob } = require('buffer')
|
||||||
const dotenv = require('dotenv')
|
const dotenv = require('dotenv')
|
||||||
const session_start = 'https://nextgenerations-cities.encs.concordia.ca/api/v1.4/session/start'
|
const session_start = 'https://nextgenerations-cities.encs.concordia.ca/api/v1.4/session/start'
|
||||||
//const energy_plus = 'https://nextgenerations-cities.encs.concordia.ca/api/v1.4/workflow/energy-plus'
|
const energy_plus = 'https://nextgenerations-cities.encs.concordia.ca/api/v1.4/workflow/energy-plus'
|
||||||
const energy_plus = 'http://172.16.252.117:15789/v1.4/workflow/energy-plus'
|
|
||||||
|
|
||||||
|
|
||||||
exports.run = async (application, param, tmp_path) => {
|
exports.run = async (application, param, tmp_path) => {
|
||||||
console.log(`Executing ${application}`)
|
console.log(`Executing ${application}`)
|
||||||
@ -50,9 +47,13 @@ exports.run = async (application, param, tmp_path) => {
|
|||||||
var error = ''
|
var error = ''
|
||||||
if (response.status == 200) {
|
if (response.status == 200) {
|
||||||
var blob = await response.blob()
|
var blob = await response.blob()
|
||||||
await fileSave(blob, 'test.zip', ['.zip'])
|
const buffer = Buffer.from(await blob.arrayBuffer())
|
||||||
console.log(file)
|
require("fs").writeFile(
|
||||||
BrowserWindow.fromId(1).webContents.send('task-completed', '<a href="../../tmp/files.zip">meb</a>')
|
`${tmp_path}energyplus_results.zip`,
|
||||||
|
buffer,
|
||||||
|
(err) => { console.log(err ? err : 'energy+ zip saved'); }
|
||||||
|
)
|
||||||
|
BrowserWindow.fromId(1).webContents.send('task-completed', '<a href="../../tmp/energyplus_results.zip">Energy plus results</a>')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
else if (response.status == 400) {
|
else if (response.status == 400) {
|
||||||
|
@ -31,5 +31,6 @@ async function runWorkflow() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.functions.onTaskCompleted((value) => {
|
window.functions.onTaskCompleted((value) => {
|
||||||
|
console.log(typeof(value))
|
||||||
document.getElementById('links').innerHTML = value
|
document.getElementById('links').innerHTML = value
|
||||||
})
|
})
|
Loading…
Reference in New Issue
Block a user