64 lines
1.3 KiB
HTML
64 lines
1.3 KiB
HTML
|
<html>
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
|
||
|
</head>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<body>
|
||
|
<div id='container'>
|
||
|
<form id='in'>
|
||
|
</form>
|
||
|
</div>
|
||
|
<script>
|
||
|
|
||
|
function generateInput(parameters){
|
||
|
let container = document.getElementById('in');
|
||
|
|
||
|
let list = document.createElement("select");
|
||
|
list.id = "list_";
|
||
|
container.appendChild(list);
|
||
|
|
||
|
|
||
|
//let json = JSON.parse(parameters);
|
||
|
parameters.map ( e => {
|
||
|
let element = document.createElement("option");
|
||
|
element.value = e;
|
||
|
element.innerHTML = e;
|
||
|
list.appendChild(element);
|
||
|
})
|
||
|
|
||
|
let arguments = document.createElement("input");
|
||
|
arguments.id = "args";
|
||
|
container.appendChild(arguments);
|
||
|
|
||
|
let button = document.createElement("Button");
|
||
|
button.innerHTML = "Execute";
|
||
|
container.appendChild(button);
|
||
|
button.onclick = request;
|
||
|
|
||
|
//container.appendChild(foo);
|
||
|
}
|
||
|
|
||
|
|
||
|
function request(){
|
||
|
let app = document.querySelector('#list_');
|
||
|
let val = app.options[app.selectedIndex].value;
|
||
|
let parameter = document.getElementById('args').value;
|
||
|
console.log(parameter);
|
||
|
fetch("/apps/start/" + val + "/" + parameter).then(console.log);
|
||
|
|
||
|
}
|
||
|
|
||
|
let apps = fetch("/apps/list").then(res => res.json().then(generateInput));
|
||
|
|
||
|
//generateInput("[ \"bla\", \"foo\", \"baz\" ]");
|
||
|
|
||
|
</script>
|
||
|
</body>
|
||
|
|
||
|
|
||
|
|
||
|
</html>
|