1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-25 01:11:43 +00:00

leftover notification code

This commit is contained in:
kay.one 2011-08-21 18:00:12 -07:00
parent 5ab07d7028
commit 1e9ae9a508
6 changed files with 16 additions and 13 deletions

View file

@ -123,12 +123,12 @@ public JsonResult AddExistingSeries(string path, string seriesName, int qualityP
_seriesProvider.AddSeries(path, series.Id, qualityProfileId); _seriesProvider.AddSeries(path, series.Id, qualityProfileId);
ScanNewSeries(); ScanNewSeries();
return new JsonResult { Data = "ok" }; return Json(new NotificationResult() { Title = seriesName, Text = "Was added successfully" });
} }
catch (Exception) catch (Exception ex)
{ {
return new JsonResult { Data = "failed" }; return Json(new NotificationResult() { Title = "Failed", Text = ex.Message, NotificationType = NotificationType.Error});
} }
} }

View file

@ -29,13 +29,13 @@ public ActionResult Index()
public JsonResult Trim() public JsonResult Trim()
{ {
_historyProvider.Trim(); _historyProvider.Trim();
return new JsonResult { Data = "ok" }; return Json(new NotificationResult() { Title = "Trimmed History items"});
} }
public JsonResult Purge() public JsonResult Purge()
{ {
_historyProvider.Purge(); _historyProvider.Purge();
return new JsonResult { Data = "ok" }; return Json(new NotificationResult() { Title = "History Cleared" });
} }
[GridAction] [GridAction]

View file

@ -1,5 +1,6 @@
using System.Web.Mvc; using System.Web.Mvc;
using NzbDrone.Core.Instrumentation; using NzbDrone.Core.Instrumentation;
using NzbDrone.Web.Models;
using Telerik.Web.Mvc; using Telerik.Web.Mvc;
namespace NzbDrone.Web.Controllers namespace NzbDrone.Web.Controllers
@ -22,7 +23,7 @@ public JsonResult Clear()
{ {
_logProvider.DeleteAll(); _logProvider.DeleteAll();
return new JsonResult { Data = "ok" }; return Json(new NotificationResult() { Title = "Logs Cleared" });
} }
[GridAction] [GridAction]

View file

@ -321,7 +321,7 @@ public JsonResult SaveSabnzbd(SabnzbdSettingsModel data)
[HttpPost] [HttpPost]
public ActionResult SaveQuality(QualityModel data) public JsonResult SaveQuality(QualityModel data)
{ {
if (ModelState.IsValid) if (ModelState.IsValid)
{ {
@ -348,7 +348,7 @@ public ActionResult SaveQuality(QualityModel data)
//If the Cutoff value selected is not in the allowed list then use the last allowed value, this should be validated on submit //If the Cutoff value selected is not in the allowed list then use the last allowed value, this should be validated on submit
if (!profile.Allowed.Contains(profile.Cutoff)) if (!profile.Allowed.Contains(profile.Cutoff))
return Content("Error Saving Settings, please fix any errors"); return GetInvalidModelResult();
//profile.Cutoff = profile.Allowed.Last(); //profile.Cutoff = profile.Allowed.Last();
_qualityProvider.Update(profile); _qualityProvider.Update(profile);
@ -361,7 +361,7 @@ public ActionResult SaveQuality(QualityModel data)
} }
[HttpPost] [HttpPost]
public ActionResult SaveNotifications(NotificationSettingsModel data) public JsonResult SaveNotifications(NotificationSettingsModel data)
{ {
if (ModelState.IsValid) if (ModelState.IsValid)
{ {
@ -385,7 +385,7 @@ public ActionResult SaveNotifications(NotificationSettingsModel data)
} }
[HttpPost] [HttpPost]
public ActionResult SaveEpisodeSorting(EpisodeSortingModel data) public JsonResult SaveEpisodeSorting(EpisodeSortingModel data)
{ {
if (ModelState.IsValid) if (ModelState.IsValid)
{ {

View file

@ -13,6 +13,8 @@
jqXHR.success(function (data) { jqXHR.success(function (data) {
//Check if the response is a message type, //Check if the response is a message type,
console.log(this.url);
if (data.IsMessage) { if (data.IsMessage) {
if (data.NotificationType === 0) { if (data.NotificationType === 0) {
$.gritter.add({ $.gritter.add({

View file

@ -5,8 +5,8 @@ History
} }
@section ActionMenu{ @section ActionMenu{
<ul id="sub-menu"> <ul id="sub-menu">
<li>@Ajax.ActionLink("Trim History", "Trim", "History", new AjaxOptions{ OnSuccess = "reloadGrid" })</li> <li>@Ajax.ActionLink("Trim History", "Trim", "History", new AjaxOptions{ OnSuccess = "reloadHistoryGrid" })</li>
<li>@Ajax.ActionLink("Purge History", "Purge", "History", new AjaxOptions{ OnSuccess = "reloadGrid" })</li> <li>@Ajax.ActionLink("Purge History", "Purge", "History", new AjaxOptions { OnSuccess = "reloadHistoryGrid"})</li>
</ul> </ul>
} }
@section MainContent{ @section MainContent{
@ -44,7 +44,7 @@ History
<script type="text/javascript"> <script type="text/javascript">
function reloadGrid() { function reloadHistoryGrid() {
var grid = $('#history').data('tGrid'); var grid = $('#history').data('tGrid');
grid.rebind(); grid.rebind();
} }