2021-10-04 13:03:26 +10:30
|
|
|
{{ define "content" }}
|
2021-06-02 23:42:29 +09:30
|
|
|
|
|
|
|
<main role="main" class="inner DAU">
|
2021-06-08 22:19:54 +09:30
|
|
|
<h1 class="DAU-heading">Logs</h1>
|
2021-06-02 23:42:29 +09:30
|
|
|
<p class="lead">Discord-auto-upload logs</p>
|
|
|
|
|
2021-06-06 17:15:38 +09:30
|
|
|
<div class="container">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-sm">
|
|
|
|
<button type="button" onClick="debug=1; get_logs();" class="btn btn-primary">all logs</button>
|
|
|
|
</div>
|
|
|
|
<div class="col-sm">
|
|
|
|
<button type="button" onClick="debug=0; get_logs();" class="btn btn-primary">no debug</button>
|
|
|
|
</div>
|
|
|
|
<div class="col-sm">
|
|
|
|
<button type="button" id="scroll-button" onClick="toggle_scroll();" class="btn btn-primary">disable auto-scroll</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2021-06-03 19:36:48 +09:30
|
|
|
<pre id="logs" class="text-left pre-scrollable">
|
|
|
|
</pre>
|
2021-06-02 23:42:29 +09:30
|
|
|
</main>
|
|
|
|
|
2021-10-04 13:03:26 +10:30
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
{{ define "js" }}
|
|
|
|
|
2021-06-02 23:42:29 +09:30
|
|
|
<script>
|
2021-06-06 17:15:38 +09:30
|
|
|
var debug = 0;
|
|
|
|
var scrl = true;
|
2021-06-02 23:42:29 +09:30
|
|
|
$(document).ready(function() {
|
2021-06-06 17:15:38 +09:30
|
|
|
get_logs();
|
|
|
|
setInterval(function() { get_logs(); }, 1000);
|
|
|
|
});
|
|
|
|
|
|
|
|
function toggle_scroll() {
|
|
|
|
scrl = !scrl;
|
|
|
|
if (scrl) {
|
|
|
|
$('#scroll-button').text('disable auto-scroll');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#scroll-button').text('auto-scroll');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_logs() {
|
|
|
|
$.ajax({ method: 'get', url: '/rest/logs', data: { debug : debug }})
|
|
|
|
.done(function(data) {
|
|
|
|
$('#logs').text(data);
|
|
|
|
console.log('scrl is ', scrl);
|
|
|
|
if (scrl) {
|
|
|
|
$('#logs').scrollTop(10000);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-06-02 23:42:29 +09:30
|
|
|
</script>
|
2021-10-04 13:03:26 +10:30
|
|
|
|
|
|
|
|
|
|
|
{{ end }}
|