mirror of
https://github.com/lazylibrarian/LazyLibrarian.git
synced 2026-01-26 06:38:20 -05:00
116 lines
4.0 KiB
HTML
116 lines
4.0 KiB
HTML
<%inherit file="base.html"/>
|
|
<%!
|
|
import lazylibrarian
|
|
%>
|
|
<%def name="headerIncludes()">
|
|
<div id="subhead_container">
|
|
<ul id="subhead_menu">
|
|
<li><a href="clearLog" id="button"> Clear Log </a></li>
|
|
%if lazylibrarian.LOGFULL == True:
|
|
<li><a href="toggleLog" id="button"> Stop Debug Log</a></li>
|
|
%else:
|
|
<li><a href="toggleLog" id="button"> Start Debug Log</a></li>
|
|
%endif
|
|
</ul>
|
|
</div>
|
|
</%def>
|
|
<%def name="body()">
|
|
<BR>
|
|
<h1>  Logs</h1><br>
|
|
<table class="display" id="log_table">
|
|
<thead>
|
|
<tr>
|
|
<th id="timestamp">Timestamp</th>
|
|
<th id="level">Level</th>
|
|
<th id="message">Message</th>
|
|
</tr>
|
|
</thead>
|
|
<!-- we don't use this section now as we do it server-side
|
|
<tbody>
|
|
%for line in lineList:
|
|
<%
|
|
timestamp, message, level, threadname = line
|
|
|
|
if level == 'WARNING' or level == 'ERROR':
|
|
grade = 'X'
|
|
else:
|
|
grade = 'Z'
|
|
%>
|
|
<tr class="grade${grade}">
|
|
<td id="timestamp">${timestamp}</td>
|
|
<td id="level">${level}</td>
|
|
<td id="message">${message}</td>
|
|
</tr>
|
|
%endfor
|
|
</tbody>
|
|
-->
|
|
</table>
|
|
</%def>
|
|
|
|
<%def name="headIncludes()">
|
|
<link rel="stylesheet" href="css/data_table.css">
|
|
</%def>
|
|
|
|
<%def name="javascriptIncludes()">
|
|
<script src="js/libs/jquery.dataTables.min.js"></script>
|
|
<script>
|
|
$(document).ready(function()
|
|
{
|
|
var oTable = $('#log_table').dataTable(
|
|
{
|
|
"bAutoWidth": false,
|
|
"oLanguage": {
|
|
"sSearch":"",
|
|
"sLengthMenu":"Show _MENU_ rows per page",
|
|
"sEmptyTable": "No log information available",
|
|
"sInfo":"Showing _START_ to _END_ of _TOTAL_ rows",
|
|
"sInfoEmpty":"Showing 0 to 0 of 0 rows",
|
|
"sInfoFiltered":"(filtered from _MAX_ total rows)"},
|
|
"aLengthMenu": [[5, 10, 15, 25, 50, 100, -1], [5, 10, 15, 25, 50, 100, "All"]],
|
|
"iDisplayLength": ${lazylibrarian.DISPLAYLENGTH},
|
|
"sPaginationType": "full_numbers",
|
|
"aaSorting": [],
|
|
"bServerSide": true,
|
|
"sAjaxSource": 'getLog',
|
|
"bFilter": true,
|
|
"fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
|
|
if (aData[1] === "WARNING" || aData[1] === "ERROR")
|
|
{
|
|
$('td', nRow).closest('tr').addClass("gradeX");
|
|
}
|
|
else
|
|
{
|
|
$('td', nRow).closest('tr').addClass("gradeZ");
|
|
}
|
|
var w = window.innerWidth;
|
|
if ( w < 640 ) // hide timestamp on smallest devices
|
|
{
|
|
$('td', nRow).eq(0).addClass('hidden');
|
|
}
|
|
return nRow;
|
|
},
|
|
"fnServerData": function (sSource, aoData, fnCallback) {
|
|
/* Add some extra data to the sender */
|
|
$.getJSON(sSource, aoData, function (json) {
|
|
fnCallback(json)
|
|
});
|
|
}
|
|
});
|
|
$('.dataTables_filter input').attr("placeholder", "Search table here");
|
|
$(window).resize(function() {oTable.fnDraw(false)});
|
|
|
|
// dont keep refreshing the log table on mobile devices
|
|
var isiPad = navigator.userAgent.match(/iPad/i) != null;
|
|
// Why is the log page auto-refreshing in the first place?
|
|
|
|
// if (!isiPad && !((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))))
|
|
// {
|
|
// // Refresh the log table
|
|
// setInterval(function() {
|
|
// $('#log_table').dataTable().fnDraw();
|
|
// }, 10000);
|
|
// }
|
|
});
|
|
</script>
|
|
</%def>
|