html foo
This commit is contained in:
		
							
								
								
									
										64
									
								
								html/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								html/index.html
									
									
									
									
									
										Normal 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>
 | 
			
		||||
		Reference in New Issue
	
	Block a user