Improve log display, use a <pre> so it can be easily cut and pasted.

This commit is contained in:
2021-06-03 19:36:48 +09:30
parent b69cdebf3b
commit fdf70daba7
7 changed files with 84 additions and 64 deletions

View File

@@ -123,10 +123,11 @@ $(document).ready(function() {
.done(function(data) {
var this_el = $(".config-item[data-key='"+key+"']").find('.rest-field');
if (this_el.hasClass('rest-field-boolean')) {
this_el.prop('checked', data.Value);
this_el.prop('checked', data.value);
}
else {
this_el.val(data.Value);
this_el.val(data.value);
}
update_sadness();
@@ -142,7 +143,7 @@ $(document).ready(function() {
}
$.post('/rest/config/'+key, { value: val })
.done(function(d) {
if (d.Success) {
if (d.success) {
alert('Updated config');
} else {
alert("Error: " + d.Error);

View File

@@ -42,6 +42,10 @@ body {
max-width: 42em;
}
pre {
background-color: black;
color: aliceblue;
}
/*
* Header

View File

@@ -3,17 +3,8 @@
<h1 class="DAU-heading">Config</h1>
<p class="lead">Discord-auto-upload logs</p>
<table class="table table-condensed">
<thead>
<tr>
<th>time</th><th>entry</th>
</tr>
</thead>
<tbody id="logs">
</tbody>
</table>
<pre id="logs" class="text-left pre-scrollable">
</pre>
</main>
<script>
@@ -21,15 +12,7 @@ $(document).ready(function() {
$.ajax({ method: 'get', url: '/rest/logs'})
.done(function(data) {
console.log(data);
$.each(data, function(i, d) {
console.log('do', d);
$('#logs').append(
$('<tr>').append(
$('<th>').text(d.ts),
$('<td>').text(d.log)
)
);
});
$('#logs').text(data);
});
});
</script>