2024-04-25 00:54:32 -04:00
|
|
|
let param = {
|
2024-05-10 01:32:16 -04:00
|
|
|
'workflow': 'energy_plus',
|
|
|
|
'application': 'Energy+'
|
2024-04-25 00:54:32 -04:00
|
|
|
}
|
2024-05-24 02:25:41 -04:00
|
|
|
document.getElementById('runWorkflow').addEventListener('click', runWorkflow)
|
|
|
|
document.getElementById('geometry_file').addEventListener('change', (event) => {
|
2024-05-10 01:32:16 -04:00
|
|
|
const file = event.target.files[0]
|
|
|
|
document.getElementById('parameters').style.visibility = 'visible'
|
2024-05-15 07:38:15 -04:00
|
|
|
let extension
|
2024-05-14 10:21:06 -04:00
|
|
|
if (file.name.split('.').length == 2) {
|
2024-05-15 07:38:15 -04:00
|
|
|
extension = file.name.split('.')[1]
|
2024-05-14 10:21:06 -04:00
|
|
|
}
|
|
|
|
if (file.type == 'application/geo+json' || extension == 'geojson') {
|
2024-05-10 01:32:16 -04:00
|
|
|
document.getElementById('height').style.display = 'block'
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
document.getElementById('height').style.display = 'none'
|
|
|
|
}
|
|
|
|
param['geometry_file'] = file.path
|
|
|
|
})
|
|
|
|
async function runWorkflow() {
|
2024-04-25 00:54:32 -04:00
|
|
|
try {
|
|
|
|
document.getElementById('links').innerHTML = '<img id="spinner" src="../../img/spinner.gif" width="50px" />'
|
2024-05-10 01:32:16 -04:00
|
|
|
//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
|
2024-04-25 00:54:32 -04:00
|
|
|
await window.functions.run(param)
|
|
|
|
}
|
|
|
|
catch(ex) {
|
|
|
|
alert(ex)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
window.functions.onTaskCompleted((value) => {
|
2024-05-10 14:03:28 -04:00
|
|
|
console.log(typeof(value))
|
2024-04-25 00:54:32 -04:00
|
|
|
document.getElementById('links').innerHTML = value
|
|
|
|
})
|