workflow_launcher/workflows/retrofit/run.js

30 lines
1.0 KiB
JavaScript
Raw Normal View History

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