Fixed: Root Folder display when free diskspace cannot be determined (FreeBSD)
closes #3275
This commit is contained in:
parent
95ee7daf21
commit
6d232778e2
|
@ -13,13 +13,13 @@ function RootFolderRow(props) {
|
||||||
const {
|
const {
|
||||||
id,
|
id,
|
||||||
path,
|
path,
|
||||||
|
accessible,
|
||||||
freeSpace,
|
freeSpace,
|
||||||
unmappedFolders,
|
unmappedFolders,
|
||||||
onDeletePress
|
onDeletePress
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const unmappedFoldersCount = unmappedFolders.length || '-';
|
const isUnavailable = !accessible;
|
||||||
const isUnavailable = freeSpace == null;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableRow>
|
<TableRow>
|
||||||
|
@ -47,11 +47,11 @@ function RootFolderRow(props) {
|
||||||
</TableRowCell>
|
</TableRowCell>
|
||||||
|
|
||||||
<TableRowCell className={styles.freeSpace}>
|
<TableRowCell className={styles.freeSpace}>
|
||||||
{freeSpace ? formatBytes(freeSpace) : '-'}
|
{(isUnavailable || isNaN(freeSpace)) ? '-' : formatBytes(freeSpace)}
|
||||||
</TableRowCell>
|
</TableRowCell>
|
||||||
|
|
||||||
<TableRowCell className={styles.unmappedFolders}>
|
<TableRowCell className={styles.unmappedFolders}>
|
||||||
{unmappedFoldersCount}
|
{isUnavailable ? '-' : unmappedFolders.length}
|
||||||
</TableRowCell>
|
</TableRowCell>
|
||||||
|
|
||||||
<TableRowCell className={styles.actions}>
|
<TableRowCell className={styles.actions}>
|
||||||
|
@ -68,6 +68,7 @@ function RootFolderRow(props) {
|
||||||
RootFolderRow.propTypes = {
|
RootFolderRow.propTypes = {
|
||||||
id: PropTypes.number.isRequired,
|
id: PropTypes.number.isRequired,
|
||||||
path: PropTypes.string.isRequired,
|
path: PropTypes.string.isRequired,
|
||||||
|
accessible: PropTypes.bool.isRequired,
|
||||||
freeSpace: PropTypes.number,
|
freeSpace: PropTypes.number,
|
||||||
unmappedFolders: PropTypes.arrayOf(PropTypes.object).isRequired,
|
unmappedFolders: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
onDeletePress: PropTypes.func.isRequired
|
onDeletePress: PropTypes.func.isRequired
|
||||||
|
|
|
@ -59,6 +59,7 @@ function RootFolders(props) {
|
||||||
key={rootFolder.id}
|
key={rootFolder.id}
|
||||||
id={rootFolder.id}
|
id={rootFolder.id}
|
||||||
path={rootFolder.path}
|
path={rootFolder.path}
|
||||||
|
accessible={rootFolder.accessible}
|
||||||
freeSpace={rootFolder.freeSpace}
|
freeSpace={rootFolder.freeSpace}
|
||||||
unmappedFolders={rootFolder.unmappedFolders}
|
unmappedFolders={rootFolder.unmappedFolders}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -51,6 +51,7 @@ namespace NzbDrone.Core.Datastore
|
||||||
Mapper.Entity<Config>().RegisterModel("Config");
|
Mapper.Entity<Config>().RegisterModel("Config");
|
||||||
|
|
||||||
Mapper.Entity<RootFolder>().RegisterModel("RootFolders")
|
Mapper.Entity<RootFolder>().RegisterModel("RootFolders")
|
||||||
|
.Ignore(r => r.Accessible)
|
||||||
.Ignore(r => r.FreeSpace)
|
.Ignore(r => r.FreeSpace)
|
||||||
.Ignore(r => r.TotalSpace);
|
.Ignore(r => r.TotalSpace);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ namespace NzbDrone.Core.RootFolders
|
||||||
{
|
{
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
|
||||||
|
public bool Accessible { get; set; }
|
||||||
public long? FreeSpace { get; set; }
|
public long? FreeSpace { get; set; }
|
||||||
public long? TotalSpace { get; set; }
|
public long? TotalSpace { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -183,12 +183,12 @@ namespace NzbDrone.Core.RootFolders
|
||||||
{
|
{
|
||||||
if (_diskProvider.FolderExists(rootFolder.Path))
|
if (_diskProvider.FolderExists(rootFolder.Path))
|
||||||
{
|
{
|
||||||
|
rootFolder.Accessible = true;
|
||||||
rootFolder.FreeSpace = _diskProvider.GetAvailableSpace(rootFolder.Path);
|
rootFolder.FreeSpace = _diskProvider.GetAvailableSpace(rootFolder.Path);
|
||||||
rootFolder.TotalSpace = _diskProvider.GetTotalSize(rootFolder.Path);
|
rootFolder.TotalSpace = _diskProvider.GetTotalSize(rootFolder.Path);
|
||||||
rootFolder.UnmappedFolders = GetUnmappedFolders(rootFolder.Path);
|
rootFolder.UnmappedFolders = GetUnmappedFolders(rootFolder.Path);
|
||||||
}
|
}
|
||||||
})
|
}).Wait(5000);
|
||||||
.Wait(5000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ namespace Sonarr.Api.V3.RootFolders
|
||||||
public class RootFolderResource : RestResource
|
public class RootFolderResource : RestResource
|
||||||
{
|
{
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
public bool Accessible { get; set; }
|
||||||
public long? FreeSpace { get; set; }
|
public long? FreeSpace { get; set; }
|
||||||
|
|
||||||
public List<UnmappedFolder> UnmappedFolders { get; set; }
|
public List<UnmappedFolder> UnmappedFolders { get; set; }
|
||||||
|
@ -25,6 +26,7 @@ namespace Sonarr.Api.V3.RootFolders
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
|
|
||||||
Path = model.Path.GetCleanPath(),
|
Path = model.Path.GetCleanPath(),
|
||||||
|
Accessible = model.Accessible,
|
||||||
FreeSpace = model.FreeSpace,
|
FreeSpace = model.FreeSpace,
|
||||||
UnmappedFolders = model.UnmappedFolders
|
UnmappedFolders = model.UnmappedFolders
|
||||||
};
|
};
|
||||||
|
@ -39,6 +41,7 @@ namespace Sonarr.Api.V3.RootFolders
|
||||||
Id = resource.Id,
|
Id = resource.Id,
|
||||||
|
|
||||||
Path = resource.Path
|
Path = resource.Path
|
||||||
|
//Accessible
|
||||||
//FreeSpace
|
//FreeSpace
|
||||||
//UnmappedFolders
|
//UnmappedFolders
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue