1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-12 11:15:43 +02:00

Merge branch 'master' of git://github.com/kayone/NzbDrone

This commit is contained in:
Mark McDowall 2011-08-21 18:09:18 -07:00
commit 626b1407ee
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);
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()
{
_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]

View File

@ -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 @@ public JsonResult Clear()
{
_logProvider.DeleteAll();
return new JsonResult { Data = "ok" };
return Json(new NotificationResult() { Title = "Logs Cleared" });
}
[GridAction]

View File

@ -321,7 +321,7 @@ public JsonResult SaveSabnzbd(SabnzbdSettingsModel data)
[HttpPost]
public ActionResult SaveQuality(QualityModel data)
public JsonResult SaveQuality(QualityModel data)
{
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 (!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 @@ public ActionResult SaveQuality(QualityModel data)
}
[HttpPost]
public ActionResult SaveNotifications(NotificationSettingsModel data)
public JsonResult SaveNotifications(NotificationSettingsModel data)
{
if (ModelState.IsValid)
{
@ -385,7 +385,7 @@ public ActionResult SaveNotifications(NotificationSettingsModel data)
}
[HttpPost]
public ActionResult SaveEpisodeSorting(EpisodeSortingModel data)
public JsonResult SaveEpisodeSorting(EpisodeSortingModel data)
{
if (ModelState.IsValid)
{

View File

@ -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({

View File

@ -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();
}