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