remove public from gitignore
parent
6d0edd55f6
commit
1fbac0740a
|
|
@ -1,5 +1,4 @@
|
|||
gollum
|
||||
public
|
||||
**.sw*
|
||||
**/**.sw*
|
||||
*.sw*
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,29 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="/css/water.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>
|
||||
Firestormy
|
||||
</h1>
|
||||
<details>
|
||||
<summary>Upsert Job</summary>
|
||||
<form id="upserts" action="#" method="get" onsubmit="upserts(); return false;">
|
||||
<input type="text" name="id" placeholder="id"/>
|
||||
<select name="language" required>
|
||||
<option value="bash" selected>bash</option>
|
||||
</select>
|
||||
<input type="text" name="cron" placeholder="cron" value="@daily"/>
|
||||
<textarea name="script" placeholder="script" required rows="5"></textarea>
|
||||
<button type="submit">Upsert</button>
|
||||
</form>
|
||||
</details>
|
||||
<table id="jobs">
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
<footer>
|
||||
<script src="/js/js.js"></script>
|
||||
</footer>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
function http(method, remote, callback, body) {
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (xmlhttp.readyState == XMLHttpRequest.DONE) {
|
||||
callback(xmlhttp.responseText, xmlhttp.status)
|
||||
}
|
||||
};
|
||||
xmlhttp.open(method, remote, true);
|
||||
if (typeof body == "undefined") {
|
||||
body = null
|
||||
}
|
||||
xmlhttp.send(body);
|
||||
}
|
||||
|
||||
function upserts() {
|
||||
function cb(body, status) {
|
||||
console.log(status, body)
|
||||
}
|
||||
http("POST", "/upserts", cb, jsonifyForm("upserts"))
|
||||
}
|
||||
|
||||
function jsonifyForm(id) {
|
||||
var form = document.getElementById(id)
|
||||
var entries = new FormData(form).entries();
|
||||
var json = Object.assign(...Array.from(entries, ([x,y]) => ({[x]:y})));
|
||||
var s = JSON.stringify(json)
|
||||
return s
|
||||
}
|
||||
|
||||
function init() {
|
||||
function cb(body, status) {
|
||||
var jobs = JSON.parse(body)
|
||||
jobs.forEach(function(job) {
|
||||
var s = format(job)
|
||||
inject(s)
|
||||
console.log("job=", job)
|
||||
console.log("s=", s)
|
||||
})
|
||||
}
|
||||
function format(job) {
|
||||
return `<tr><td><details>
|
||||
<summary>(${job.last.status}) ${job.id}</summary>
|
||||
<table>
|
||||
<tr>
|
||||
<td><code>${job.cron}</code></td>
|
||||
<td><code>${job.language}</code></td>
|
||||
<td><code>${job.script}</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>${job.last.run}</code></td>
|
||||
<td><code>${job.last.runtime}</code></td>
|
||||
<td><code>${job.last.output}</code></td>
|
||||
</tr>
|
||||
</table>
|
||||
</details></td></tr>`
|
||||
}
|
||||
function inject(s) {
|
||||
var table = document.getElementById("jobs").getElementsByTagName("tbody")[0]
|
||||
table.innerHTML += s
|
||||
}
|
||||
http("GET", "/list", cb, null)
|
||||
}
|
||||
|
||||
init()
|
||||
Loading…
Reference in New Issue