From 5228879c9640b08fdd9668c86fd938d6ed19cda8 Mon Sep 17 00:00:00 2001 From: Maxime Bloch Date: Thu, 26 Sep 2019 18:37:48 +0200 Subject: [PATCH] start on a simple client with fields and buttons --- client/index.css | 11 +++++++++++ client/index.html | 33 +++++++++++++++++++++++++++++++++ client/index.js | 18 ++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 client/index.css create mode 100644 client/index.html create mode 100644 client/index.js diff --git a/client/index.css b/client/index.css new file mode 100644 index 0000000..5e714e8 --- /dev/null +++ b/client/index.css @@ -0,0 +1,11 @@ +.input-group { + padding: 10px; +} + +input { + padding: 5px; +} + +label { + margin-right: 10px; +} diff --git a/client/index.html b/client/index.html new file mode 100644 index 0000000..bbc989b --- /dev/null +++ b/client/index.html @@ -0,0 +1,33 @@ + + + + + + + + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+
+ +

Result:

+ + + + diff --git a/client/index.js b/client/index.js new file mode 100644 index 0000000..b0c619d --- /dev/null +++ b/client/index.js @@ -0,0 +1,18 @@ +let call_backend = function(e) { + console.log("Call backend"); + type = event.target.getAttribute('name'); + console.log(type); + + var url = document.forms["link"]["url-field"].value; + var run = document.forms["link"]["run-field"].value; + var link = document.forms["link"]["link-field"].value; + + xmlhttp = new XMLHttpRequest(); + xmlhttp.onreadystatechange = function() { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { + document.getElementById("result").innerHTML = xmlhttp.responseText; + }; + }; + xmlhttp.open("POST", url + "/link/" (type==="start" ? "start" : "handoff") + "/" + run + "/" + link, true); + xmlhttp.send(); +}