sonarr-repo-only/NzbDrone.Web/Views/Log/Index.cshtml

66 lines
2.8 KiB
Plaintext
Raw Normal View History

@using NzbDrone.Common
@using NzbDrone.Core.Instrumentation
2012-01-23 02:24:16 +00:00
@using NzbDrone.Web.Helpers
@model IEnumerable<NzbDrone.Core.Instrumentation.Log>
@section Scripts{
2010-10-24 17:35:58 +00:00
<script type="text/javascript">
function onRowDataBound(e) {
e.row.style.boarder = "";
2011-04-22 05:49:50 +00:00
if (e.dataItem.Level == "Warn") {
2010-10-24 17:35:58 +00:00
e.row.style.backgroundColor = "#FFD700";
}
2011-04-22 05:49:50 +00:00
else if (e.dataItem.Level == "Error") {
2010-10-24 17:35:58 +00:00
e.row.style.backgroundColor = "#FF7500";
}
2011-04-22 05:49:50 +00:00
else if (e.dataItem.Level == "Fatal") {
2010-10-24 17:35:58 +00:00
e.row.style.backgroundColor = "black";
e.row.style.color = "red";
2010-10-24 17:35:58 +00:00
}
//e.row.style.color = 'blue';
}
</script>
}
@{ ViewBag.Title = "Logs";}
@section ActionMenu{
<ul class="sub-menu">
<li>@Ajax.ActionLink("Clear Logs", "Clear", "Log", new AjaxOptions { OnSuccess = "reloadGrid" })</li>
2012-01-23 02:24:16 +00:00
<li>@Html.ActionLink("File", "File", "Log")</li>
</ul>
}
2011-12-01 05:25:01 +00:00
<div class="infoBox">
Log entries older than 30 days are automatically deleted.</div>
@{Html.Telerik().Grid<Log>().Name("logsGrid")
.TableHtmlAttributes(new { @class = "Grid" })
2011-04-10 02:44:01 +00:00
.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");
2011-04-10 02:44:01 +00:00
columns.Bound(c => c.Message);
})
.DetailView(detailView => detailView.ClientTemplate(
2011-07-04 05:23:38 +00:00
"<div>Method: <#= Method #></div>" +
2011-05-21 00:21:31 +00:00
"<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()
2011-04-10 02:44:01 +00:00
.ClientEvents(c => c.OnRowDataBound("onRowDataBound"))
2011-12-01 05:25:01 +00:00
.Scrollable(c => c.Height(500))
.ClientEvents(clientEvents =>
{
if (EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError");
})
.Render();}
<script type="text/javascript">
function reloadGrid() {
var grid = $('#logsGrid').data('tGrid');
grid.rebind();
}
</script>