mirror of
https://github.com/Radarr/Radarr.git
synced 2025-04-23 14:07:20 -04:00
New: Ensure all unmapped folders are fetched when importing from a root folder
Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com> #4548
This commit is contained in:
parent
5edbe4200b
commit
f069801eba
7 changed files with 38 additions and 25 deletions
|
@ -79,7 +79,6 @@ class ImportMovie extends Component {
|
|||
rootFolderId,
|
||||
path,
|
||||
rootFoldersFetching,
|
||||
rootFoldersPopulated,
|
||||
rootFoldersError,
|
||||
unmappedFolders
|
||||
} = this.props;
|
||||
|
@ -98,24 +97,30 @@ class ImportMovie extends Component {
|
|||
onScroll={this.onScroll}
|
||||
>
|
||||
{
|
||||
rootFoldersFetching && !rootFoldersPopulated &&
|
||||
<LoadingIndicator />
|
||||
rootFoldersFetching ? <LoadingIndicator /> : null
|
||||
}
|
||||
|
||||
{
|
||||
!rootFoldersFetching && !!rootFoldersError &&
|
||||
<div>Unable to load root folders</div>
|
||||
!rootFoldersFetching && !!rootFoldersError ?
|
||||
<div>Unable to load root folders</div> :
|
||||
null
|
||||
}
|
||||
|
||||
{
|
||||
!rootFoldersError && rootFoldersPopulated && !unmappedFolders.length &&
|
||||
!rootFoldersError &&
|
||||
!rootFoldersFetching &&
|
||||
!unmappedFolders.length ?
|
||||
<div>
|
||||
All movies in {path} have been imported
|
||||
</div>
|
||||
</div> :
|
||||
null
|
||||
}
|
||||
|
||||
{
|
||||
!rootFoldersError && rootFoldersPopulated && !!unmappedFolders.length && scroller &&
|
||||
!rootFoldersError &&
|
||||
!rootFoldersFetching &&
|
||||
!!unmappedFolders.length &&
|
||||
scroller ?
|
||||
<ImportMovieTableConnector
|
||||
rootFolderId={rootFolderId}
|
||||
unmappedFolders={unmappedFolders}
|
||||
|
@ -126,17 +131,21 @@ class ImportMovie extends Component {
|
|||
onSelectAllChange={this.onSelectAllChange}
|
||||
onSelectedChange={this.onSelectedChange}
|
||||
onRemoveSelectedStateItem={this.onRemoveSelectedStateItem}
|
||||
/>
|
||||
/> :
|
||||
null
|
||||
}
|
||||
</PageContentBody>
|
||||
|
||||
{
|
||||
!rootFoldersError && rootFoldersPopulated && !!unmappedFolders.length &&
|
||||
!rootFoldersError &&
|
||||
!rootFoldersFetching &&
|
||||
!!unmappedFolders.length ?
|
||||
<ImportMovieFooterConnector
|
||||
selectedIds={this.getSelectedIds()}
|
||||
onInputChange={this.onInputChange}
|
||||
onImportPress={this.onImportPress}
|
||||
/>
|
||||
/> :
|
||||
null
|
||||
}
|
||||
</PageContent>
|
||||
);
|
||||
|
|
|
@ -71,15 +71,14 @@ class ImportMovieConnector extends Component {
|
|||
|
||||
componentDidMount() {
|
||||
const {
|
||||
rootFolderId,
|
||||
qualityProfiles,
|
||||
defaultQualityProfileId,
|
||||
dispatchFetchRootFolders,
|
||||
dispatchSetAddMovieDefault
|
||||
} = this.props;
|
||||
|
||||
if (!this.props.rootFoldersPopulated) {
|
||||
dispatchFetchRootFolders();
|
||||
}
|
||||
dispatchFetchRootFolders({ id: rootFolderId, timeout: false });
|
||||
|
||||
let setDefaults = false;
|
||||
const setDefaultPayload = {};
|
||||
|
@ -139,6 +138,8 @@ const routeMatchShape = createRouteMatchShape({
|
|||
|
||||
ImportMovieConnector.propTypes = {
|
||||
match: routeMatchShape.isRequired,
|
||||
rootFolderId: PropTypes.number.isRequired,
|
||||
rootFoldersFetching: PropTypes.bool.isRequired,
|
||||
rootFoldersPopulated: PropTypes.bool.isRequired,
|
||||
qualityProfiles: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
defaultQualityProfileId: PropTypes.number.isRequired,
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace NzbDrone.Api.Movies
|
|||
|
||||
Profile tempProfile = _profileService.All().First();
|
||||
|
||||
RootFolder rootFolder = _rootFolderService.Get(Request.Query.Id);
|
||||
RootFolder rootFolder = _rootFolderService.Get(Request.Query.Id, true);
|
||||
|
||||
int page = Request.Query.page;
|
||||
int per_page = Request.Query.per_page;
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace NzbDrone.Api.RootFolders
|
|||
|
||||
private RootFolderResource GetRootFolder(int id)
|
||||
{
|
||||
return _rootFolderService.Get(id).ToResource();
|
||||
return _rootFolderService.Get(id, true).ToResource();
|
||||
}
|
||||
|
||||
private int CreateRootFolder(RootFolderResource rootFolderResource)
|
||||
|
|
|
@ -142,7 +142,7 @@ namespace NzbDrone.Core.Test.RootFolderTests
|
|||
.Setup(s => s.GetDirectories(rootFolder.Path))
|
||||
.Returns(folders);
|
||||
|
||||
var unmappedFolders = Subject.Get(rootFolder.Id).UnmappedFolders;
|
||||
var unmappedFolders = Subject.Get(rootFolder.Id, true).UnmappedFolders;
|
||||
|
||||
unmappedFolders.Count.Should().BeGreaterThan(0);
|
||||
unmappedFolders.Should().NotContain(u => u.Name == subFolder);
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace NzbDrone.Core.RootFolders
|
|||
List<RootFolder> AllWithUnmappedFolders();
|
||||
RootFolder Add(RootFolder rootDir);
|
||||
void Remove(int id);
|
||||
RootFolder Get(int id);
|
||||
RootFolder Get(int id, bool timeout);
|
||||
string GetBestRootFolderPath(string path);
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ namespace NzbDrone.Core.RootFolders
|
|||
{
|
||||
if (folder.Path.IsPathValid())
|
||||
{
|
||||
GetDetails(folder);
|
||||
GetDetails(folder, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ namespace NzbDrone.Core.RootFolders
|
|||
|
||||
_rootFolderRepository.Insert(rootFolder);
|
||||
|
||||
GetDetails(rootFolder);
|
||||
GetDetails(rootFolder, true);
|
||||
|
||||
return rootFolder;
|
||||
}
|
||||
|
@ -161,10 +161,10 @@ namespace NzbDrone.Core.RootFolders
|
|||
return results.OrderBy(u => u.Name, StringComparer.InvariantCultureIgnoreCase).ToList();
|
||||
}
|
||||
|
||||
public RootFolder Get(int id)
|
||||
public RootFolder Get(int id, bool timeout)
|
||||
{
|
||||
var rootFolder = _rootFolderRepository.Get(id);
|
||||
GetDetails(rootFolder);
|
||||
GetDetails(rootFolder, timeout);
|
||||
|
||||
return rootFolder;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ namespace NzbDrone.Core.RootFolders
|
|||
return possibleRootFolder.Path;
|
||||
}
|
||||
|
||||
private void GetDetails(RootFolder rootFolder)
|
||||
private void GetDetails(RootFolder rootFolder, bool timeout)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ namespace NzbDrone.Core.RootFolders
|
|||
rootFolder.TotalSpace = _diskProvider.GetTotalSize(rootFolder.Path);
|
||||
rootFolder.UnmappedFolders = GetUnmappedFolders(rootFolder.Path);
|
||||
}
|
||||
}).Wait(5000);
|
||||
}).Wait(timeout ? 5000 : -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ using NzbDrone.Core.RootFolders;
|
|||
using NzbDrone.Core.Validation.Paths;
|
||||
using NzbDrone.SignalR;
|
||||
using Radarr.Http;
|
||||
using Radarr.Http.Extensions;
|
||||
|
||||
namespace Radarr.Api.V3.RootFolders
|
||||
{
|
||||
|
@ -41,7 +42,9 @@ namespace Radarr.Api.V3.RootFolders
|
|||
|
||||
private RootFolderResource GetRootFolder(int id)
|
||||
{
|
||||
return _rootFolderService.Get(id).ToResource();
|
||||
var timeout = Request.GetBooleanQueryParameter("timeout", true);
|
||||
|
||||
return _rootFolderService.Get(id, timeout).ToResource();
|
||||
}
|
||||
|
||||
private int CreateRootFolder(RootFolderResource rootFolderResource)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue