workflow_launcher/workflows/retrofit/run.js
2024-03-12 07:13:02 +01:00

31 lines
1.1 KiB
JavaScript

let param = {
'workflow': 'retrofit',
'application': '',
'buildings': []
}
document.getElementById("runScenario").addEventListener("click", runScenario)
async function runScenario() {
try {
document.getElementById('links').innerHTML = '<img id="spinner" src="../../img/spinner.gif" width="50px" />'
document.getElementById('buildings').style.backgroundColor = "#FFFFFF"
param['application'] = document.getElementById('application').value
let buildingsString = document.getElementById('buildings').value
if (buildingsString == "")
{
document.getElementById('links').innerHTML = ''
document.getElementById('buildings').style.backgroundColor = "#FFAAAA"
return
}
buildings = buildingsString.replace('\r', '').replace('\n', '').replace('\t', '').split(';').map(e => e.trim())
param['buildings'] = buildings
console.log(buildings)
await window.functions.run(param)
}
catch(ex) {
alert(ex)
}
}
window.functions.onTaskCompleted((value) => {
document.getElementById('links').innerHTML = value
})
console.log('run script loaded')