workflow_launcher/workflows/retrofit/run.js
2024-05-24 08:25:41 +02:00

30 lines
1.0 KiB
JavaScript

let param = {
'workflow': 'retrofit',
'application': '',
'buildings': []
}
document.getElementById('runWorkflow').addEventListener('click', runWorkflow)
async function runWorkflow() {
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
})