1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-23 02:05:27 +02:00
Sonarr/NzbDrone.Web/Views/System/Logs.cshtml

102 lines
3.8 KiB
Plaintext
Raw Normal View History

@using NzbDrone.Core.Instrumentation
2012-02-13 09:38:57 +03:00
@model IEnumerable<Log>
@{ ViewBag.Title = "Logs";}
@section ActionMenu{
<ul class="sub-menu">
2012-03-14 00:04:42 +03:00
<li>@Ajax.ActionLink("Clear Logs", "Clear", "Log", null, new AjaxOptions{ OnSuccess = "redrawGrid", Confirm = "Delete all logs?" }, new { Title = "Delete all logs" })</li>
2012-03-16 10:02:33 +03:00
<li>@Html.ActionLink("File", "File", "Log", null, new { Title = "View debug log file" })</li>
</ul>
}
@section HeaderContent{
<style>
2012-02-13 09:38:57 +03:00
#logGrid td
{
padding: 2px 8px 2px 8px;
}
</style>
}
2011-12-01 08:25:01 +03:00
<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>
2012-02-13 09:38:57 +03:00
<th>
Time
</th>
<th>
Level
</th>
<th>
Source
</th>
<th>
Message
</th>
@*Details Column*@
2012-02-13 09:38:57 +03:00
<th style="display: none;">
Details
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
@section Scripts{
<script type="text/javascript">
2012-02-13 09:38:57 +03:00
$(document).ready(function () {
$('.dataTablesGrid').removeClass('hidden-grid');
oTable = $('#logGrid').dataTable({
2012-10-23 18:10:23 +03:00
"sAjaxSource": "/log/ajaxbinding",
2012-02-18 03:43:16 +03:00
"bProcessing": false,
"bServerSide": true,
"bShowAll": false,
"bPaginate": true,
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": true,
"bAutoWidth": false,
"iDisplayLength": 50,
"sPaginationType": "four_button",
"aoColumns": [
2013-01-08 11:57:38 +03:00
{ sName: "Time", sWidth: '150px', "mDataProp": "Time", bSearchable: false }, //Time
{ sName: "Level", sWidth: '60px', "mDataProp": "Level" }, //Level
{ sName: "Logger", sWidth: '240px', "mDataProp": "Source" }, //Source
{ sName: "Message", sWidth: 'auto', "mDataProp": "Message", "bSortable": false }, //Message
{ sName: "Exception", sWidth: 'auto', "mDataProp": "Details", "bSortable": false, "bVisible": false, "fnRender": function (row) {
2012-02-13 09:38:57 +03:00
var result = "<div>Method: " + row.aData["Method"] + "</div>";
if (row.aData["ExceptionType"] !== null) {
result += "<div>Exception Type: " + row.aData["ExceptionType"] + "</div>" +
"<div class=\"stackFrame\">Exception: " + row.aData["Exception"] + "</div>";
}
2012-02-13 09:38:57 +03:00
return result;
}
} //Details
],
"aaSorting": [[0, 'desc']],
2012-02-13 09:38:57 +03:00
"fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
fnRowCallback(nRow, aData);
}
});
});
function fnRowCallback(nRow, aData) {
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>
2012-02-13 09:38:57 +03:00
}