first try to set timer from web ui
This commit is contained in:
parent
538de91555
commit
b563f3890a
10881
assets/web/files/jquery.js
vendored
Normal file
10881
assets/web/files/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
27
assets/web/files/schnutibox.js
Normal file
27
assets/web/files/schnutibox.js
Normal file
@ -0,0 +1,27 @@
|
||||
if(typeof(EventSource) !== "undefined") {
|
||||
var source = new EventSource("/log");
|
||||
source.onmessage = function(event) {
|
||||
var j = JSON.parse(event.data);
|
||||
if (j.hasOwnProperty('message')) {
|
||||
document.getElementById("log").innerHTML += j.message + "<br>";
|
||||
}
|
||||
};
|
||||
} else {
|
||||
document.getElementById("log").innerHTML = "Sorry, your browser does not support server-sent events...";
|
||||
}
|
||||
|
||||
$("#timerForm").submit(function(event){
|
||||
event.preventDefault();
|
||||
var $form = $(this),
|
||||
duration = $form.find("input[name='s']").val(),
|
||||
url = $form.attr("action");
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "POST",
|
||||
data: JSON.stringify({"duration": duration}),
|
||||
contentType: "application/json",
|
||||
dataType: "json"
|
||||
});
|
||||
|
||||
})
|
46
assets/web/swagger-ui/google/api/annotations.swagger.json
Normal file
46
assets/web/swagger-ui/google/api/annotations.swagger.json
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "google/api/annotations.proto",
|
||||
"version": "version not set"
|
||||
},
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"paths": {},
|
||||
"definitions": {
|
||||
"protobufAny": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"typeUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "string",
|
||||
"format": "byte"
|
||||
}
|
||||
}
|
||||
},
|
||||
"rpcStatus": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"details": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/protobufAny"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
46
assets/web/swagger-ui/google/api/http.swagger.json
Normal file
46
assets/web/swagger-ui/google/api/http.swagger.json
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "google/api/http.proto",
|
||||
"version": "version not set"
|
||||
},
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"paths": {},
|
||||
"definitions": {
|
||||
"protobufAny": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"typeUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "string",
|
||||
"format": "byte"
|
||||
}
|
||||
}
|
||||
},
|
||||
"rpcStatus": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"details": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/protobufAny"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -10,6 +10,14 @@
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>schnutibox</h1>
|
||||
|
||||
<h2>Timer</h2>
|
||||
Takes only seconds. Example: 600s
|
||||
<form action="/api/v1/timer" id="timerForm">
|
||||
<input type="text" name="s" placeholder="600s">
|
||||
<input type="submit" value="Set">
|
||||
</form>
|
||||
|
||||
<h2>logs</h2>
|
||||
<pre>
|
||||
<code>
|
||||
@ -17,18 +25,7 @@
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
<script>
|
||||
if(typeof(EventSource) !== "undefined") {
|
||||
var source = new EventSource("/log");
|
||||
source.onmessage = function(event) {
|
||||
var j = JSON.parse(event.data);
|
||||
if (j.hasOwnProperty('message')) {
|
||||
document.getElementById("log").innerHTML += j.message + "<br>";
|
||||
}
|
||||
};
|
||||
} else {
|
||||
document.getElementById("log").innerHTML = "Sorry, your browser does not support server-sent events...";
|
||||
}
|
||||
</script>
|
||||
<script src=/static/jquery.js></script>
|
||||
<script src=/static/schnutibox.js></script>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user