2011-04-09 19:44:01 -07:00
|
|
|
using System.Web.Mvc;
|
2010-10-24 00:46:58 -07:00
|
|
|
using NzbDrone.Core.Instrumentation;
|
2011-08-21 18:00:12 -07:00
|
|
|
using NzbDrone.Web.Models;
|
2010-10-24 00:46:58 -07:00
|
|
|
using Telerik.Web.Mvc;
|
2011-09-05 12:59:39 -07:00
|
|
|
using System.Linq;
|
2010-10-24 00:46:58 -07:00
|
|
|
|
|
|
|
namespace NzbDrone.Web.Controllers
|
|
|
|
{
|
|
|
|
public class LogController : Controller
|
|
|
|
{
|
2011-04-09 17:14:51 -07:00
|
|
|
private readonly LogProvider _logProvider;
|
2010-10-24 00:46:58 -07:00
|
|
|
|
2011-04-09 17:14:51 -07:00
|
|
|
public LogController(LogProvider logProvider)
|
2010-10-24 00:46:58 -07:00
|
|
|
{
|
|
|
|
_logProvider = logProvider;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ActionResult Index()
|
|
|
|
{
|
|
|
|
return View();
|
|
|
|
}
|
|
|
|
|
2011-09-05 12:59:39 -07:00
|
|
|
public ActionResult All()
|
|
|
|
{
|
|
|
|
return View();
|
|
|
|
}
|
|
|
|
|
2011-08-05 19:04:35 -07:00
|
|
|
public JsonResult Clear()
|
2010-10-24 00:46:58 -07:00
|
|
|
{
|
|
|
|
_logProvider.DeleteAll();
|
2011-08-05 19:04:35 -07:00
|
|
|
|
2011-09-05 12:59:39 -07:00
|
|
|
return Json(new NotificationResult { Title = "Logs Cleared" });
|
|
|
|
}
|
|
|
|
|
|
|
|
[GridAction]
|
|
|
|
public ActionResult _TopAjaxBinding()
|
|
|
|
{
|
2011-09-07 17:01:51 -07:00
|
|
|
var logs = _logProvider.TopLogs(5000);
|
2011-09-05 12:59:39 -07:00
|
|
|
|
|
|
|
return View(new GridModel(logs));
|
2010-10-24 00:46:58 -07:00
|
|
|
}
|
|
|
|
|
2011-09-02 23:41:50 -07:00
|
|
|
[GridAction(EnableCustomBinding = true)]
|
2011-09-05 12:59:39 -07:00
|
|
|
public ActionResult _AllAjaxBinding(GridCommand gridCommand)
|
2010-10-24 00:46:58 -07:00
|
|
|
{
|
2011-09-02 23:41:50 -07:00
|
|
|
var logs = _logProvider.GetPagedLogs(gridCommand.Page, gridCommand.PageSize);
|
|
|
|
|
|
|
|
return View(new GridModel{ Data = logs.Items, Total = (int)logs.TotalItems });
|
2010-10-24 00:46:58 -07:00
|
|
|
}
|
|
|
|
}
|
2011-04-09 19:44:01 -07:00
|
|
|
}
|