1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-14 15:03:42 +01:00
Radarr/NzbDrone.Web/Views/Log/Index.cshtml
2011-11-30 21:25:01 -08:00

62 lines
2.5 KiB
Plaintext

@using NzbDrone.Core.Instrumentation
@model IEnumerable<NzbDrone.Core.Instrumentation.Log>
@section Scripts{
<script type="text/javascript">
function onRowDataBound(e) {
e.row.style.boarder = "";
if (e.dataItem.Level == "Warn") {
e.row.style.backgroundColor = "#FFD700";
}
else if (e.dataItem.Level == "Error") {
e.row.style.backgroundColor = "#FF7500";
}
else if (e.dataItem.Level == "Fatal") {
e.row.style.backgroundColor = "black";
e.row.style.color = "red";
}
//e.row.style.color = 'blue';
}
</script>
}
@section TitleContent{
Logs
}
@section ActionMenu{
<ul class="sub-menu">
<li>@Ajax.ActionLink("Clear Logs", "Clear", "Log", new AjaxOptions { OnSuccess = "reloadGrid" })</li>
</ul>
<div style="margin-bottom: 10px">
</div>
}
<div class="infoBox">
Log entries older than 30 days are automatically deleted.</div>
@{Html.Telerik().Grid<Log>().Name("logsGrid")
.TableHtmlAttributes(new { @class = "Grid" })
.Columns(columns =>
{
columns.Bound(c => c.Time).Title("Time").Width(170);
columns.Bound(c => c.Level).Title("Level").Width(70);
columns.Bound(c => c.Logger).Title("Source");
columns.Bound(c => c.Message);
})
.DetailView(detailView => detailView.ClientTemplate(
"<div>Method: <#= Method #></div>" +
"<div><#= ExceptionType #></div>" +
"<div class='stackframe'><#= Exception #></div>"
))
.DataBinding(data => data.Ajax().Select("AjaxBinding", "Log").Enabled(true))
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.Time).Descending()).Enabled(true))
.Pageable(paging => paging.Style(GridPagerStyles.Status).PageOnScroll(true).PageSize(100))
.Filterable()
.ClientEvents(c => c.OnRowDataBound("onRowDataBound"))
.Scrollable(c => c.Height(500))
.Render();}
<script type="text/javascript">
function reloadGrid() {
var grid = $('#logsGrid').data('tGrid');
grid.rebind();
}
</script>