mirror of
https://github.com/lidarr/Lidarr
synced 2025-03-03 10:06:06 +00:00
Better ajax notification for queued jobs.
This commit is contained in:
parent
39be4c567d
commit
3aa0a8f9ee
4 changed files with 19 additions and 11 deletions
|
@ -32,19 +32,19 @@ public CommandController(JobProvider jobProvider, SabProvider sabProvider,
|
|||
public JsonResult RssSync()
|
||||
{
|
||||
_jobProvider.QueueJob(typeof(RssSyncJob));
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
return JsonNotificationResult.Queued("RSS sync");
|
||||
}
|
||||
|
||||
public JsonResult BacklogSearch()
|
||||
{
|
||||
_jobProvider.QueueJob(typeof(BacklogSearchJob));
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
return JsonNotificationResult.Queued("Backlog search");
|
||||
}
|
||||
|
||||
public JsonResult RecentBacklogSearch()
|
||||
{
|
||||
_jobProvider.QueueJob(typeof(RecentBacklogSearchJob));
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
return JsonNotificationResult.Queued("Recent backlog search");
|
||||
}
|
||||
|
||||
public JsonResult ForceRefresh(int seriesId)
|
||||
|
@ -52,7 +52,7 @@ public JsonResult ForceRefresh(int seriesId)
|
|||
_jobProvider.QueueJob(typeof(UpdateInfoJob), seriesId);
|
||||
_jobProvider.QueueJob(typeof(DiskScanJob), seriesId);
|
||||
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
return JsonNotificationResult.Queued("Episode update/Disk scan");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
@ -66,7 +66,7 @@ public JsonResult GetSabnzbdCategories(string host, int port, string apiKey, str
|
|||
public JsonResult SendTestEmail(string server, int port, bool ssl, string username, string password, string fromAddress, string toAddresses)
|
||||
{
|
||||
if (_smtpProvider.SendTestEmail(server, port, ssl, username, password, fromAddress, toAddresses))
|
||||
JsonNotificationResult.Info("Successfull", "Test email sent.");
|
||||
JsonNotificationResult.Info("Successful", "Test email sent.");
|
||||
|
||||
return JsonNotificationResult.Oops("Couldn't send Email, please check your settings");
|
||||
}
|
||||
|
|
|
@ -17,31 +17,34 @@ public EpisodeController(JobProvider jobProvider)
|
|||
public JsonResult Search(int episodeId)
|
||||
{
|
||||
_jobProvider.QueueJob(typeof(EpisodeSearchJob), episodeId);
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
return JsonNotificationResult.Queued("Episode search");
|
||||
}
|
||||
|
||||
public JsonResult SearchSeason(int seriesId, int seasonNumber)
|
||||
{
|
||||
_jobProvider.QueueJob(typeof(SeasonSearchJob), seriesId, seasonNumber);
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
return JsonNotificationResult.Queued("Season search");
|
||||
|
||||
}
|
||||
|
||||
public JsonResult BacklogSeries(int seriesId)
|
||||
{
|
||||
_jobProvider.QueueJob(typeof(SeriesSearchJob), seriesId);
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
return JsonNotificationResult.Queued("Series Backlog");
|
||||
|
||||
}
|
||||
|
||||
public JsonResult RenameSeason(int seriesId, int seasonNumber)
|
||||
{
|
||||
_jobProvider.QueueJob(typeof(RenameSeasonJob), seriesId, seasonNumber);
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
return JsonNotificationResult.Queued("Season rename");
|
||||
|
||||
}
|
||||
|
||||
public JsonResult RenameEpisodes(int seriesId)
|
||||
{
|
||||
_jobProvider.QueueJob(typeof(RenameSeriesJob), seriesId);
|
||||
return JsonNotificationResult.Info("Queued");
|
||||
return JsonNotificationResult.Queued("Series rename");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -79,7 +79,7 @@ public JsonResult Redownload(int historyId, int episodeId)
|
|||
//Queue a job to download the replacement episode
|
||||
_jobProvider.QueueJob(typeof(EpisodeSearchJob), episodeId);
|
||||
|
||||
return JsonNotificationResult.Info("Episode Redownload Started");
|
||||
return JsonNotificationResult.Queued("Episode search");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -34,6 +34,11 @@ public static JsonResult Oops(string text)
|
|||
return GetJsonResult(NotificationType.Error, "Oops!", text);
|
||||
}
|
||||
|
||||
public static JsonResult Queued(string task)
|
||||
{
|
||||
return GetJsonResult(NotificationType.Info, "Added to queue", string.Format("{0} will start soon.", task.Trim()));
|
||||
}
|
||||
|
||||
|
||||
public static JsonResult GetJsonResult(NotificationType notificationType, string title, string text)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue