diff --git a/frontend/src/AddSeries/ImportSeries/Import/ImportSeries.js b/frontend/src/AddSeries/ImportSeries/Import/ImportSeries.js
index cb6376806..9af842496 100644
--- a/frontend/src/AddSeries/ImportSeries/Import/ImportSeries.js
+++ b/frontend/src/AddSeries/ImportSeries/Import/ImportSeries.js
@@ -102,24 +102,30 @@ class ImportSeries extends Component {
onScroll={this.onScroll}
>
{
- rootFoldersFetching && !rootFoldersPopulated &&
-
+ rootFoldersFetching ? : null
}
{
- !rootFoldersFetching && !!rootFoldersError &&
-
Unable to load root folders
+ !rootFoldersFetching && !!rootFoldersError ?
+ Unable to load root folders
:
+ null
}
{
- !rootFoldersError && rootFoldersPopulated && !unmappedFolders.length &&
+ !rootFoldersError &&
+ !rootFoldersFetching &&
+ !unmappedFolders.length ?
All series in {path} have been imported
-
+ :
+ null
}
{
- !rootFoldersError && rootFoldersPopulated && !!unmappedFolders.length && scroller &&
+ !rootFoldersError &&
+ !rootFoldersFetching &&
+ !!unmappedFolders.length &&
+ scroller ?
+ /> :
+ null
}
{
- !rootFoldersError && rootFoldersPopulated && !!unmappedFolders.length &&
+ !rootFoldersError &&
+ !rootFoldersFetching &&
+ !!unmappedFolders.length ?
+ /> :
+ null
}
);
diff --git a/frontend/src/AddSeries/ImportSeries/Import/ImportSeriesConnector.js b/frontend/src/AddSeries/ImportSeries/Import/ImportSeriesConnector.js
index 0ab206ef9..71619acfa 100644
--- a/frontend/src/AddSeries/ImportSeries/Import/ImportSeriesConnector.js
+++ b/frontend/src/AddSeries/ImportSeries/Import/ImportSeriesConnector.js
@@ -76,6 +76,7 @@ class ImportSeriesConnector extends Component {
componentDidMount() {
const {
+ rootFolderId,
qualityProfiles,
languageProfiles,
defaultQualityProfileId,
@@ -84,9 +85,7 @@ class ImportSeriesConnector extends Component {
dispatchSetAddSeriesDefault
} = this.props;
- if (!this.props.rootFoldersPopulated) {
- dispatchFetchRootFolders();
- }
+ dispatchFetchRootFolders({ id: rootFolderId, timeout: false });
let setDefaults = false;
const setDefaultPayload = {};
@@ -154,6 +153,8 @@ const routeMatchShape = createRouteMatchShape({
ImportSeriesConnector.propTypes = {
match: routeMatchShape.isRequired,
+ rootFolderId: PropTypes.number.isRequired,
+ rootFoldersFetching: PropTypes.bool.isRequired,
rootFoldersPopulated: PropTypes.bool.isRequired,
qualityProfiles: PropTypes.arrayOf(PropTypes.object).isRequired,
languageProfiles: PropTypes.arrayOf(PropTypes.object).isRequired,
diff --git a/src/NzbDrone.Api/RootFolders/RootFolderModule.cs b/src/NzbDrone.Api/RootFolders/RootFolderModule.cs
index 581d0c97a..5d60cc7c1 100644
--- a/src/NzbDrone.Api/RootFolders/RootFolderModule.cs
+++ b/src/NzbDrone.Api/RootFolders/RootFolderModule.cs
@@ -43,7 +43,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)
diff --git a/src/NzbDrone.Core/RootFolders/RootFolderService.cs b/src/NzbDrone.Core/RootFolders/RootFolderService.cs
index f33e401f9..cf1d1ce6e 100644
--- a/src/NzbDrone.Core/RootFolders/RootFolderService.cs
+++ b/src/NzbDrone.Core/RootFolders/RootFolderService.cs
@@ -2,7 +2,6 @@ using System.Linq;
using System;
using System.Collections.Generic;
using System.IO;
-using System.Threading;
using System.Threading.Tasks;
using NLog;
using NzbDrone.Common;
@@ -18,7 +17,7 @@ namespace NzbDrone.Core.RootFolders
List AllWithUnmappedFolders();
RootFolder Add(RootFolder rootDir);
void Remove(int id);
- RootFolder Get(int id);
+ RootFolder Get(int id, bool timeout);
string GetBestRootFolderPath(string path);
}
@@ -71,7 +70,7 @@ namespace NzbDrone.Core.RootFolders
{
if (folder.Path.IsPathValid())
{
- GetDetails(folder);
+ GetDetails(folder, true);
}
}
//We don't want an exception to prevent the root folders from loading in the UI, so they can still be deleted
@@ -111,7 +110,7 @@ namespace NzbDrone.Core.RootFolders
_rootFolderRepository.Insert(rootFolder);
- GetDetails(rootFolder);
+ GetDetails(rootFolder, true);
return rootFolder;
}
@@ -155,10 +154,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;
}
@@ -177,7 +176,7 @@ namespace NzbDrone.Core.RootFolders
return possibleRootFolder.Path;
}
- private void GetDetails(RootFolder rootFolder)
+ private void GetDetails(RootFolder rootFolder, bool timeout)
{
Task.Run(() =>
{
@@ -188,7 +187,7 @@ namespace NzbDrone.Core.RootFolders
rootFolder.TotalSpace = _diskProvider.GetTotalSize(rootFolder.Path);
rootFolder.UnmappedFolders = GetUnmappedFolders(rootFolder.Path);
}
- }).Wait(5000);
+ }).Wait(timeout ? 5000 : -1);
}
}
}
diff --git a/src/Sonarr.Api.V3/RootFolders/RootFolderModule.cs b/src/Sonarr.Api.V3/RootFolders/RootFolderModule.cs
index e6e22525c..6747d98ec 100644
--- a/src/Sonarr.Api.V3/RootFolders/RootFolderModule.cs
+++ b/src/Sonarr.Api.V3/RootFolders/RootFolderModule.cs
@@ -1,9 +1,11 @@
using System.Collections.Generic;
+using System.Threading;
using FluentValidation;
using NzbDrone.Core.RootFolders;
using NzbDrone.Core.Validation.Paths;
using NzbDrone.SignalR;
using Sonarr.Http;
+using Sonarr.Http.Extensions;
namespace Sonarr.Api.V3.RootFolders
{
@@ -42,7 +44,9 @@ namespace Sonarr.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)