mirror of https://github.com/Sonarr/Sonarr
All profiles (including the default ones) are now editable.
This commit is contained in:
parent
f819a24e65
commit
72e73b7513
|
@ -29,11 +29,12 @@ namespace NzbDrone.Web.Controllers
|
|||
private readonly AutoConfigureProvider _autoConfigureProvider;
|
||||
private readonly NotificationProvider _notificationProvider;
|
||||
private readonly DiskProvider _diskProvider;
|
||||
private readonly SeriesProvider _seriesProvider;
|
||||
|
||||
public SettingsController(ConfigProvider configProvider, IndexerProvider indexerProvider,
|
||||
QualityProvider qualityProvider, RootDirProvider rootDirProvider,
|
||||
AutoConfigureProvider autoConfigureProvider, NotificationProvider notificationProvider,
|
||||
DiskProvider diskProvider)
|
||||
DiskProvider diskProvider, SeriesProvider seriesProvider)
|
||||
{
|
||||
_configProvider = configProvider;
|
||||
_indexerProvider = indexerProvider;
|
||||
|
@ -42,6 +43,7 @@ namespace NzbDrone.Web.Controllers
|
|||
_autoConfigureProvider = autoConfigureProvider;
|
||||
_notificationProvider = notificationProvider;
|
||||
_diskProvider = diskProvider;
|
||||
_seriesProvider = seriesProvider;
|
||||
}
|
||||
|
||||
public ActionResult Test()
|
||||
|
@ -131,7 +133,6 @@ namespace NzbDrone.Web.Controllers
|
|||
|
||||
ViewData["Qualities"] = qualityTypes;
|
||||
|
||||
var userProfiles = _qualityProvider.GetAllProfiles().Where(q => q.UserProfile).ToList();
|
||||
var profiles = _qualityProvider.GetAllProfiles().ToList();
|
||||
|
||||
var defaultQualityQualityProfileId = Convert.ToInt32(_configProvider.DefaultQualityProfile);
|
||||
|
@ -142,7 +143,6 @@ namespace NzbDrone.Web.Controllers
|
|||
var model = new QualityModel
|
||||
{
|
||||
Profiles = profiles,
|
||||
UserProfiles = userProfiles,
|
||||
DefaultQualityProfileId = defaultQualityQualityProfileId,
|
||||
DownloadPropers = downloadPropers,
|
||||
SelectList = selectList
|
||||
|
@ -199,7 +199,7 @@ namespace NzbDrone.Web.Controllers
|
|||
return View("Index", model);
|
||||
}
|
||||
|
||||
public ViewResult AddUserProfile()
|
||||
public ViewResult AddProfile()
|
||||
{
|
||||
var qualityTypes = new List<QualityTypes>();
|
||||
|
||||
|
@ -213,7 +213,6 @@ namespace NzbDrone.Web.Controllers
|
|||
var qualityProfile = new QualityProfile
|
||||
{
|
||||
Name = "New Profile",
|
||||
UserProfile = true,
|
||||
Allowed = new List<QualityTypes> { QualityTypes.Unknown },
|
||||
Cutoff = QualityTypes.Unknown,
|
||||
};
|
||||
|
@ -224,7 +223,7 @@ namespace NzbDrone.Web.Controllers
|
|||
|
||||
ViewData["ProfileId"] = id;
|
||||
|
||||
return View("UserProfileSection", qualityProfile);
|
||||
return View("QualityProfileItem", qualityProfile);
|
||||
}
|
||||
|
||||
public ActionResult GetQualityProfileView(QualityProfile profile)
|
||||
|
@ -238,7 +237,7 @@ namespace NzbDrone.Web.Controllers
|
|||
ViewData["Qualities"] = qualityTypes;
|
||||
ViewData["ProfileId"] = profile.QualityProfileId;
|
||||
|
||||
return PartialView("UserProfileSection", profile);
|
||||
return PartialView("QualityProfileItem", profile);
|
||||
}
|
||||
|
||||
public ViewResult AddRootDir()
|
||||
|
@ -294,6 +293,9 @@ namespace NzbDrone.Web.Controllers
|
|||
{
|
||||
try
|
||||
{
|
||||
if (_seriesProvider.GetAllSeries().Where(s => s.QualityProfileId == profileId).Count() != 0)
|
||||
return new JsonResult { Data = "Unable to delete Profile, it is still in use." };
|
||||
|
||||
_qualityProvider.Delete(profileId);
|
||||
}
|
||||
|
||||
|
@ -460,12 +462,12 @@ namespace NzbDrone.Web.Controllers
|
|||
_configProvider.DownloadPropers = data.DownloadPropers;
|
||||
|
||||
//Saves only the Default Quality, skips User Profiles since none exist
|
||||
if (data.UserProfiles == null)
|
||||
if (data.Profiles == null)
|
||||
return Content(SETTINGS_SAVED);
|
||||
|
||||
foreach (var profile in data.UserProfiles)
|
||||
foreach (var profile in data.Profiles)
|
||||
{
|
||||
Logger.Debug(String.Format("Updating User Profile: {0}", profile));
|
||||
Logger.Debug(String.Format("Updating Profile: {0}", profile));
|
||||
|
||||
profile.Allowed = new List<QualityTypes>();
|
||||
foreach (var quality in profile.AllowedString.Split(','))
|
||||
|
|
|
@ -8,7 +8,6 @@ namespace NzbDrone.Web.Models
|
|||
public class QualityModel
|
||||
{
|
||||
public List<QualityProfile> Profiles { get; set; }
|
||||
public List<QualityProfile> UserProfiles { get; set; }
|
||||
|
||||
[DisplayName("Default Quality Profile")]
|
||||
[Description("The default quality to use when adding series to NzbDrone")]
|
||||
|
|
|
@ -712,7 +712,7 @@
|
|||
<Content Include="Views\Series\SubMenu.cshtml" />
|
||||
<Content Include="Views\Series\SeriesSearchResults.cshtml" />
|
||||
<Content Include="Views\Shared\Error.cshtml" />
|
||||
<Content Include="Views\Settings\UserProfileSection.cshtml" />
|
||||
<Content Include="Views\Settings\QualityProfileItem.cshtml" />
|
||||
<Content Include="Views\System\Indexers.cshtml" />
|
||||
<Content Include="Views\System\Config.cshtml" />
|
||||
</ItemGroup>
|
||||
|
@ -871,9 +871,6 @@
|
|||
<ItemGroup>
|
||||
<Content Include="Views\Series\SingleSeason.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\AddSeries\Copy of AddNew.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
|
|
@ -74,13 +74,13 @@
|
|||
<div id="leftSide" style="width:35%;">
|
||||
<div style="padding-top: 10px;">
|
||||
<div style="padding-left: 7px; margin-bottom: 5px;">
|
||||
<a id="addItem" style="text-decoration:none;" href="@Url.Action("AddUserProfile", "Settings")">
|
||||
<a id="addItem" style="text-decoration:none;" href="@Url.Action("AddProfile", "Settings")">
|
||||
<img src="../../Content/Images/Plus.png" alt="Add New Profile" />
|
||||
<h4 style="margin-left: 3px; display: inline; color: Black;">Add New Profile</h4></a>
|
||||
</div>
|
||||
|
||||
<div id="user-profiles">
|
||||
@foreach (var item in Model.UserProfiles)
|
||||
<div id="profiles">
|
||||
@foreach (var item in Model.Profiles)
|
||||
{
|
||||
Html.RenderAction("GetQualityProfileView", item);
|
||||
}
|
||||
|
@ -103,7 +103,7 @@
|
|||
url: this.href,
|
||||
cache: false,
|
||||
success: function (html) {
|
||||
$("#user-profiles").prepend(html);
|
||||
$("#profiles").prepend(html);
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -114,8 +114,6 @@
|
|||
|
||||
function deleteProfile(id) {
|
||||
sendToServer(id);
|
||||
$("#div_" + id).remove();
|
||||
removeOption(id);
|
||||
}
|
||||
|
||||
function sendToServer(id) {
|
||||
|
@ -125,6 +123,16 @@
|
|||
data: jQuery.param({ profileId: id }),
|
||||
error: function (req, status, error) {
|
||||
alert("Sorry! We could not delete your Profile at this time. " + error);
|
||||
},
|
||||
success: function (data, textStatus, jqXHR) {
|
||||
if (data == "ok") {
|
||||
$("#div_" + id).remove();
|
||||
removeOption(id);
|
||||
}
|
||||
|
||||
else {
|
||||
alert(data);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
@using (Html.BeginCollectionItem("UserProfiles"))
|
||||
@using (Html.BeginCollectionItem("Profiles"))
|
||||
{
|
||||
var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_');
|
||||
var ugly = ViewData.TemplateInfo.HtmlFieldPrefix;
|
||||
|
@ -64,14 +64,14 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
<div class="userProfileSectionEditor" id="div_@(ViewData["ProfileId"])">
|
||||
<div class="profileSectionEditor" id="div_@(ViewData["ProfileId"])">
|
||||
|
||||
<fieldset style="width:285px; max-width:285px; margin:5px; margin-top: 0px; border-color:#CCCCCD">
|
||||
<div id="tester"></div>
|
||||
|
||||
<div id="qualityHeader" style="padding-bottom: 5px; margin: 0px;">
|
||||
<h2 style="display:inline; padding-right: 4px; margin-left: 4px;" id="@title">@{Html.DisplayTextFor(m => m.Name);}</h2>
|
||||
<a href="#" id="@Model.QualityProfileId" class="deleteRow" onclick="deleteProfile('@ViewData["ProfileId"]')" style="float:right; padding-top:15px;"><img src="../../Content/Images/X.png" alt="Delete"/></a>
|
||||
<a href="#" id="@Model.QualityProfileId" class="deleteRow" onclick="deleteProfile('@ViewData["ProfileId"]'); return false;" style="float:right; padding-top:15px;"><img src="../../Content/Images/X.png" alt="Delete"/></a>
|
||||
</div>
|
||||
|
||||
<div class="config-group" style="width: 270px; margin-bottom: 5px; margin-left: 5px;">
|
Loading…
Reference in New Issue