mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-12 16:13:58 -07:00
Added delete and redownload commands to History Grid (redownload will delete the existing item from history and then start an episode search)
This commit is contained in:
parent
1d983801e8
commit
ac3c3386fc
4 changed files with 83 additions and 5 deletions
|
@ -4,6 +4,7 @@ using System.Linq;
|
|||
using System.Web.Mvc;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Jobs;
|
||||
using NzbDrone.Web.Models;
|
||||
using Telerik.Web.Mvc;
|
||||
|
||||
|
@ -12,10 +13,12 @@ namespace NzbDrone.Web.Controllers
|
|||
public class HistoryController : Controller
|
||||
{
|
||||
private readonly HistoryProvider _historyProvider;
|
||||
private readonly JobProvider _jobProvider;
|
||||
|
||||
public HistoryController(HistoryProvider historyProvider)
|
||||
public HistoryController(HistoryProvider historyProvider, JobProvider jobProvider)
|
||||
{
|
||||
_historyProvider = historyProvider;
|
||||
_jobProvider = jobProvider;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -38,6 +41,27 @@ namespace NzbDrone.Web.Controllers
|
|||
return Json(new NotificationResult() { Title = "History Cleared" });
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public JsonResult Delete(int historyId)
|
||||
{
|
||||
//Delete the existing item from history
|
||||
_historyProvider.Delete(historyId);
|
||||
|
||||
return Json(new NotificationResult() { Title = "History Item Deleted" });
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public JsonResult Redownload(int historyId, int episodeId)
|
||||
{
|
||||
//Delete the existing item from history
|
||||
_historyProvider.Delete(historyId);
|
||||
|
||||
//Queue a job to download the replacement episode
|
||||
_jobProvider.QueueJob(typeof(EpisodeSearchJob), episodeId);
|
||||
|
||||
return Json(new NotificationResult() { Title = "Episode Redownload Started" });
|
||||
}
|
||||
|
||||
[GridAction]
|
||||
public ActionResult _AjaxBinding()
|
||||
{
|
||||
|
@ -53,7 +77,8 @@ namespace NzbDrone.Web.Controllers
|
|||
Quality = h.Quality.ToString(),
|
||||
IsProper = h.IsProper,
|
||||
Date = h.Date,
|
||||
Indexer = h.Indexer
|
||||
Indexer = h.Indexer,
|
||||
EpisodeId = h.EpisodeId
|
||||
});
|
||||
|
||||
return View(new GridModel(history));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue