This commit is contained in:
Aeris 2018-08-22 21:14:11 +02:00
parent f15a9c4ebd
commit 35903fe95b

64
html/index.html Normal file
View File

@ -0,0 +1,64 @@
<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>