mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-25 22:37:27 -04:00
Validation, settings UI cleanup and different settings models, oh my
New: Download client UI matches other settings Fixed: Prevent drone factory folder from being set to invalid paths/root path for series Fixed: Switching pages in settings will not hide changes Fixed: Test download clients Fixed: Settings are validated before saving
This commit is contained in:
@@ -5,7 +5,7 @@ using FluentValidation.Results;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
using NzbDrone.Api.Mapping;
|
||||
using NzbDrone.Api.Validation;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
|
||||
namespace NzbDrone.Api.RootFolders
|
||||
{
|
||||
@@ -13,7 +13,11 @@ namespace NzbDrone.Api.RootFolders
|
||||
{
|
||||
private readonly IRootFolderService _rootFolderService;
|
||||
|
||||
public RootFolderModule(IRootFolderService rootFolderService, ICommandExecutor commandExecutor)
|
||||
public RootFolderModule(IRootFolderService rootFolderService,
|
||||
ICommandExecutor commandExecutor,
|
||||
RootFolderValidator rootFolderValidator,
|
||||
PathExistsValidator pathExistsValidator,
|
||||
DroneFactoryValidator droneFactoryValidator)
|
||||
: base(commandExecutor)
|
||||
{
|
||||
_rootFolderService = rootFolderService;
|
||||
@@ -23,7 +27,10 @@ namespace NzbDrone.Api.RootFolders
|
||||
CreateResource = CreateRootFolder;
|
||||
DeleteResource = DeleteFolder;
|
||||
|
||||
SharedValidator.RuleFor(c => c.Path).IsValidPath();
|
||||
SharedValidator.RuleFor(c => c.Path).IsValidPath()
|
||||
.SetValidator(rootFolderValidator)
|
||||
.SetValidator(pathExistsValidator)
|
||||
.SetValidator(droneFactoryValidator);
|
||||
}
|
||||
|
||||
private RootFolderResource GetRootFolder(int id)
|
||||
@@ -33,15 +40,7 @@ namespace NzbDrone.Api.RootFolders
|
||||
|
||||
private int CreateRootFolder(RootFolderResource rootFolderResource)
|
||||
{
|
||||
try
|
||||
{
|
||||
return GetNewId<RootFolder>(_rootFolderService.Add, rootFolderResource);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ValidationException(new [] { new ValidationFailure("Path", ex.Message) });
|
||||
}
|
||||
|
||||
return GetNewId<RootFolder>(_rootFolderService.Add, rootFolderResource);
|
||||
}
|
||||
|
||||
private List<RootFolderResource> GetRootFolders()
|
||||
|
||||
Reference in New Issue
Block a user