36 lines
1.4 KiB
JavaScript
36 lines
1.4 KiB
JavaScript
let param = {
|
|
'workflow': 'energy_plus',
|
|
'application': 'Energy+'
|
|
}
|
|
document.getElementById("runWorkflow").addEventListener("click", runWorkflow)
|
|
document.getElementById("geometry_file").addEventListener("change", (event) => {
|
|
const file = event.target.files[0]
|
|
document.getElementById('parameters').style.visibility = 'visible'
|
|
if (file.type == 'application/geo+json') {
|
|
document.getElementById('height').style.display = 'block'
|
|
}
|
|
else {
|
|
document.getElementById('height').style.display = 'none'
|
|
}
|
|
param['geometry_file'] = file.path
|
|
})
|
|
async function runWorkflow() {
|
|
try {
|
|
document.getElementById('links').innerHTML = '<img id="spinner" src="../../img/spinner.gif" width="50px" />'
|
|
//params
|
|
param['height_field']= document.getElementById('height_field').value
|
|
param['year_of_construction_field']= document.getElementById('year_of_construction_field').value
|
|
param['function_field']= document.getElementById('function_field').value
|
|
param['function_to_hub']= document.getElementById('function_to_hub').value
|
|
param['construction_handler']= document.getElementById('construction_handler').value
|
|
param['usage_handler']= document.getElementById('usage_handler').value
|
|
await window.functions.run(param)
|
|
}
|
|
catch(ex) {
|
|
alert(ex)
|
|
}
|
|
}
|
|
window.functions.onTaskCompleted((value) => {
|
|
console.log(typeof(value))
|
|
document.getElementById('links').innerHTML = value
|
|
}) |