Better ajax notification for queued jobs.

pull/19/head
kay.one 13 years ago
parent 39be4c567d
commit 3aa0a8f9ee

@ -32,19 +32,19 @@ namespace NzbDrone.Web.Controllers
public JsonResult RssSync() public JsonResult RssSync()
{ {
_jobProvider.QueueJob(typeof(RssSyncJob)); _jobProvider.QueueJob(typeof(RssSyncJob));
return JsonNotificationResult.Info("Queued"); return JsonNotificationResult.Queued("RSS sync");
} }
public JsonResult BacklogSearch() public JsonResult BacklogSearch()
{ {
_jobProvider.QueueJob(typeof(BacklogSearchJob)); _jobProvider.QueueJob(typeof(BacklogSearchJob));
return JsonNotificationResult.Info("Queued"); return JsonNotificationResult.Queued("Backlog search");
} }
public JsonResult RecentBacklogSearch() public JsonResult RecentBacklogSearch()
{ {
_jobProvider.QueueJob(typeof(RecentBacklogSearchJob)); _jobProvider.QueueJob(typeof(RecentBacklogSearchJob));
return JsonNotificationResult.Info("Queued"); return JsonNotificationResult.Queued("Recent backlog search");
} }
public JsonResult ForceRefresh(int seriesId) public JsonResult ForceRefresh(int seriesId)
@ -52,7 +52,7 @@ namespace NzbDrone.Web.Controllers
_jobProvider.QueueJob(typeof(UpdateInfoJob), seriesId); _jobProvider.QueueJob(typeof(UpdateInfoJob), seriesId);
_jobProvider.QueueJob(typeof(DiskScanJob), seriesId); _jobProvider.QueueJob(typeof(DiskScanJob), seriesId);
return JsonNotificationResult.Info("Queued"); return JsonNotificationResult.Queued("Episode update/Disk scan");
} }
[HttpPost] [HttpPost]
@ -66,7 +66,7 @@ namespace NzbDrone.Web.Controllers
public JsonResult SendTestEmail(string server, int port, bool ssl, string username, string password, string fromAddress, string toAddresses) 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)) 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"); return JsonNotificationResult.Oops("Couldn't send Email, please check your settings");
} }

@ -17,31 +17,34 @@ namespace NzbDrone.Web.Controllers
public JsonResult Search(int episodeId) public JsonResult Search(int episodeId)
{ {
_jobProvider.QueueJob(typeof(EpisodeSearchJob), episodeId); _jobProvider.QueueJob(typeof(EpisodeSearchJob), episodeId);
return JsonNotificationResult.Info("Queued"); return JsonNotificationResult.Queued("Episode search");
} }
public JsonResult SearchSeason(int seriesId, int seasonNumber) public JsonResult SearchSeason(int seriesId, int seasonNumber)
{ {
_jobProvider.QueueJob(typeof(SeasonSearchJob), seriesId, seasonNumber); _jobProvider.QueueJob(typeof(SeasonSearchJob), seriesId, seasonNumber);
return JsonNotificationResult.Info("Queued"); return JsonNotificationResult.Queued("Season search");
} }
public JsonResult BacklogSeries(int seriesId) public JsonResult BacklogSeries(int seriesId)
{ {
_jobProvider.QueueJob(typeof(SeriesSearchJob), seriesId); _jobProvider.QueueJob(typeof(SeriesSearchJob), seriesId);
return JsonNotificationResult.Info("Queued"); return JsonNotificationResult.Queued("Series Backlog");
} }
public JsonResult RenameSeason(int seriesId, int seasonNumber) public JsonResult RenameSeason(int seriesId, int seasonNumber)
{ {
_jobProvider.QueueJob(typeof(RenameSeasonJob), seriesId, seasonNumber); _jobProvider.QueueJob(typeof(RenameSeasonJob), seriesId, seasonNumber);
return JsonNotificationResult.Info("Queued"); return JsonNotificationResult.Queued("Season rename");
} }
public JsonResult RenameEpisodes(int seriesId) public JsonResult RenameEpisodes(int seriesId)
{ {
_jobProvider.QueueJob(typeof(RenameSeriesJob), seriesId); _jobProvider.QueueJob(typeof(RenameSeriesJob), seriesId);
return JsonNotificationResult.Info("Queued"); return JsonNotificationResult.Queued("Series rename");
} }
} }
} }

@ -79,7 +79,7 @@ namespace NzbDrone.Web.Controllers
//Queue a job to download the replacement episode //Queue a job to download the replacement episode
_jobProvider.QueueJob(typeof(EpisodeSearchJob), episodeId); _jobProvider.QueueJob(typeof(EpisodeSearchJob), episodeId);
return JsonNotificationResult.Info("Episode Redownload Started"); return JsonNotificationResult.Queued("Episode search");
} }
} }
} }

@ -34,6 +34,11 @@ namespace NzbDrone.Web.Models
return GetJsonResult(NotificationType.Error, "Oops!", 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) public static JsonResult GetJsonResult(NotificationType notificationType, string title, string text)
{ {

Loading…
Cancel
Save