workflow_launcher/workflows/retrofit/run.js

30 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2024-03-11 11:01:07 -04:00
let param = {
'workflow': 'retrofit',
'application': '',
'buildings': []
}
2024-05-24 02:25:41 -04:00
document.getElementById('runWorkflow').addEventListener('click', runWorkflow)
2024-05-14 10:21:06 -04:00
async function runWorkflow() {
2024-03-11 11:01:07 -04:00
try {
2024-03-12 02:13:02 -04:00
document.getElementById('links').innerHTML = '<img id="spinner" src="../../img/spinner.gif" width="50px" />'
2024-05-24 02:25:41 -04:00
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-05-24 02:25:41 -04:00
if (buildingsString == '')
2024-03-12 02:13:02 -04:00
{
document.getElementById('links').innerHTML = ''
2024-05-24 02:25:41 -04:00
document.getElementById('buildings').style.backgroundColor = '#FFAAAA'
2024-03-12 02:13:02 -04:00
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
})