1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-27 01:57:21 +00:00
Lidarr/NzbDrone.Web/Views/Log/Index.cshtml
Mark McDowall bc3e7239c2 Log grid will reload when logs are cleared.
History grid will reload when history is trimmed or purged.
2012-02-10 21:00:22 -08:00

94 lines
No EOL
3.4 KiB
Text

@using NzbDrone.Common
@using NzbDrone.Core.Instrumentation
@using NzbDrone.Web.Helpers
@model IEnumerable<NzbDrone.Core.Instrumentation.Log>
@{ ViewBag.Title = "Logs";}
@section ActionMenu{
<ul class="sub-menu">
<li>@Ajax.ActionLink("Clear Logs", "Clear", "Log", new AjaxOptions { OnSuccess = "redrawGrid" })</li>
<li>@Html.ActionLink("File", "File", "Log")</li>
</ul>
}
@section HeaderContent{
<style>
#logGrid td {
padding: 2px 8px 2px 8px;
}
</style>
}
<div class="infoBox">
Log entries older than 30 days are automatically deleted.</div>
<div class="grid-container">
<table id="logGrid" class="dataTablesGrid hidden-grid">
<thead>
<tr>
<th>Time</th>
<th>Level</th>
<th>Source</th>
<th>Message</th>
@*Details Column*@
<th style="display: none;">Details</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
@section Scripts{
<script type="text/javascript">
$(document).ready(function() {
$('.dataTablesGrid').removeClass('hidden-grid');
oTable = $('#logGrid').dataTable({
"sAjaxSource": "Log/AjaxBinding",
"bProcessing": true,
"bServerSide": true,
"bShowAll": false,
"bPaginate": true,
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": true,
"bAutoWidth": false,
"iDisplayLength": 50,
"sPaginationType": "four_button",
"aoColumns": [
{ sWidth: '150px', "mDataProp": "Time" }, //Time
{ sWidth: '80px', "mDataProp": "Level" }, //Level
{ sWidth: '240px', "mDataProp": "Source" }, //Source
{ sWidth: 'auto', "mDataProp": "Message", "bSortable": false }, //Message
{ sWidth: 'auto', "mDataProp": "Details", "bSortable": false, "bVisible": false, "fnRender": function (row) {
var result = "<div>Method: " + row.aData["Method"] + "</div>" +
"<div>Exception Type: " + row.aData["ExceptionType"] + "</div>" +
"<div class=\"stackFrame\">Exception: " + row.aData["Exception"] + "</div>";
return result;
}
} //Details
],
"aaSorting": [[0, 'desc']],
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull) {
fnRowCallback(nRow, aData);
}
});
});
function fnRowCallback(nRow, aData) {
//e.row.style.boarder = "";
if (aData["Level"] == "Warn") {
nRow.style.backgroundColor = "#FFD700";
}
else if (aData["Level"] == "Error") {
nRow.style.backgroundColor = "#FF7500";
}
else if (aData["Level"] == "Fatal") {
nRow.style.backgroundColor = "black";
nRow.style.color = "red";
}
}
</script>
}