1
0
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:
Mark McDowall
2014-02-16 01:56:12 -08:00
parent 606d78f5e1
commit 77b83b521e
57 changed files with 667 additions and 484 deletions
@@ -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()