leftover notification code

pull/4/head
kay.one 13 years ago
parent 5ab07d7028
commit 1e9ae9a508

@ -123,12 +123,12 @@ namespace NzbDrone.Web.Controllers
_seriesProvider.AddSeries(path, series.Id, qualityProfileId);
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});
}
}

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

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

@ -321,7 +321,7 @@ namespace NzbDrone.Web.Controllers
[HttpPost]
public ActionResult SaveQuality(QualityModel data)
public JsonResult SaveQuality(QualityModel data)
{
if (ModelState.IsValid)
{
@ -348,7 +348,7 @@ namespace NzbDrone.Web.Controllers
//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))
return Content("Error Saving Settings, please fix any errors");
return GetInvalidModelResult();
//profile.Cutoff = profile.Allowed.Last();
_qualityProvider.Update(profile);
@ -361,7 +361,7 @@ namespace NzbDrone.Web.Controllers
}
[HttpPost]
public ActionResult SaveNotifications(NotificationSettingsModel data)
public JsonResult SaveNotifications(NotificationSettingsModel data)
{
if (ModelState.IsValid)
{
@ -385,7 +385,7 @@ namespace NzbDrone.Web.Controllers
}
[HttpPost]
public ActionResult SaveEpisodeSorting(EpisodeSortingModel data)
public JsonResult SaveEpisodeSorting(EpisodeSortingModel data)
{
if (ModelState.IsValid)
{

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

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

Loading…
Cancel
Save