Files
LazyLibrarian/data/interfaces/legacy/logs.html

136 lines
4.8 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.LOGLEVEL >= 2:
<li><a href="toggleLog" id="button"> Stop Debug Log</a></li>
<li><a href="saveLog" id="button"> Save Debug Log</a></li>
%else:
<li><a href="toggleLog" id="button"> Start Debug Log</a></li>
%endif
</ul>
</div>
</%def>
<%def name="body()">
<BR><BR>
<h1>&nbsp;&nbsp;${title}</h1>
<div align="center">Refresh rate:
<select id="refreshrate" onchange="setRefresh()">
<option value="0" selected="selected">No Refresh</option>
<option value="5">5 Seconds</option>
<option value="15">15 Seconds</option>
<option value="30">30 Seconds</option>
<option value="60">60 Seconds</option>
<option value="300">5 Minutes</option>
<option value="600">10 Minutes</option>
</select></div>
<table class="display" id="log_table">
<thead>
<tr>
<th id="timestamp">Timestamp</th>
<th id="level">Level</th>
%if lazylibrarian.LOGLEVEL >= 2:
<th class="thead">Thread</th>
<th class="file">File</th>
<th class="method">Method</th>
<th class="lineno">Line No</th>
%endif
<th id="message">Message</th>
</tr>
</thead>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</%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,
"aoColumnDefs": [
%if lazylibrarian.LOGLEVEL >= 2:
{ "sWidth": "3%", "aTargets": [ 0,1,2,3,4,5 ] },
{ "sWidth": "60%", "aTargets": [ 6 ] }
%else:
{ "sWidth": "3%", "aTargets": [ 0,1 ] },
{ "sWidth": "60%", "aTargets": [ 6 ] }
%endif
],
"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.CONFIG['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');
}
%if lazylibrarian.LOGLEVEL < 2:
$('td', nRow).eq(2).addClass("hidden");
$('td', nRow).eq(3).addClass("hidden");
$('td', nRow).eq(4).addClass("hidden");
$('td', nRow).eq(5).addClass("hidden");
%endif
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)});
});
</script>
<script>
var timer;
function setRefresh()
{
refreshrate = document.getElementById('refreshrate');
if(refreshrate != null)
{
if(timer)
{
clearInterval(timer);
}
if(refreshrate.value != 0)
{
timer = setInterval("$('#log_table').dataTable().fnDraw()",1000*refreshrate.value);
}
}
}
</script>
</%def>