mirror of https://github.com/Sonarr/Sonarr
Log view now uses proper paging so it doesn't take a year to load up each page.
This commit is contained in:
parent
c2c62aa538
commit
780abad3f7
|
@ -21,6 +21,11 @@ namespace NzbDrone.Core.Instrumentation
|
|||
return _database.Fetch<Log>();
|
||||
}
|
||||
|
||||
public Page<Log> GetPagedLogs(int pageNumber, int pageSize)
|
||||
{
|
||||
return _database.Page<Log>(pageNumber, pageSize, "SELECT * FROM Logs ORDER BY Time DESC");
|
||||
}
|
||||
|
||||
public void DeleteAll()
|
||||
{
|
||||
_database.Delete<Log>("");
|
||||
|
|
|
@ -26,10 +26,12 @@ namespace NzbDrone.Web.Controllers
|
|||
return Json(new NotificationResult() { Title = "Logs Cleared" });
|
||||
}
|
||||
|
||||
[GridAction]
|
||||
public ActionResult _AjaxBinding()
|
||||
[GridAction(EnableCustomBinding = true)]
|
||||
public ActionResult _AjaxBinding(GridCommand gridCommand)
|
||||
{
|
||||
return View(new GridModel(_logProvider.GetAllLogs()));
|
||||
var logs = _logProvider.GetPagedLogs(gridCommand.Page, gridCommand.PageSize);
|
||||
|
||||
return View(new GridModel{ Data = logs.Items, Total = (int)logs.TotalItems });
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,9 +44,10 @@ Logs
|
|||
"<div><#= ExceptionType #></div>" +
|
||||
"<div class='stackframe'><#= Exception #></div>"
|
||||
)).DataBinding(data => data.Ajax().Select("_AjaxBinding", "Log"))
|
||||
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.Time).Descending()).Enabled(true))
|
||||
//.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.Time).Descending()).Enabled(true))
|
||||
.Pageable(c => c.PageSize(50).Position(GridPagerPosition.Bottom).Style(GridPagerStyles.NextPrevious))
|
||||
.Filterable()
|
||||
.EnableCustomBinding(true)
|
||||
//.Filterable()
|
||||
.ClientEvents(c => c.OnRowDataBound("onRowDataBound"))
|
||||
.Render();}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue