Besides some syntax-errors in your example code, I've got it running after adding this to the gui-template.html:
</script>
<script src="js/socket.io.js"></script>
<script var socket = io(); </script>
To run the selected project:
function runProject(projectName) {
socket.emit('process-event', {
event: 'run',
currentProject: projectName
});
}
function mySelectEvent() {
let item = sel.value();
runProject(item);
}
To fill the select button:
socket.on('init', (data) => {
console.log(data.projects); // this is the list of projects that you can use to fill in a dropdown
for(var i=0;i<data.projects.length;i++)
{
if(data.projects[i]!=="undefined")
sel.option(data.projects[i]);
}
})
The updated project function creates a lot of 'undefined'. I'm not sure, where this comes from.
Otherwise, as a proof on concept, it works like a charm. Thanks.
