mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Displaying child count for directories in FileBrowser size column.
This commit is contained in:
parent
cc9c508f06
commit
6f67fc38b2
2 changed files with 6 additions and 2 deletions
|
|
@ -41,7 +41,7 @@ function Folder({folder, onFolderClick, sortData, selectedPath, onFileClick, onS
|
|||
<Icon name='folder'/>
|
||||
{name}
|
||||
</TableCell>
|
||||
<TableCell/>
|
||||
<TableCell>({folder['child_count']})</TableCell>
|
||||
</TableRow>;
|
||||
if (children && !_.isEmpty(children)) {
|
||||
// Folder has children, recursively display them.
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ def _get_directory_dict(directory: pathlib.Path, directories: List[pathlib.Path]
|
|||
media_directory = get_media_directory()
|
||||
d = dict(
|
||||
path=f'{directory.relative_to(media_directory)}/',
|
||||
child_count=len(list(directory.iterdir())),
|
||||
)
|
||||
if directory in directories:
|
||||
children = dict()
|
||||
|
|
@ -80,7 +81,10 @@ def _get_directory_dict(directory: pathlib.Path, directories: List[pathlib.Path]
|
|||
if path.is_dir() and path in directories:
|
||||
children[f'{path.name}/'] = _get_directory_dict(path, directories)
|
||||
elif path.is_dir():
|
||||
children[f'{path.name}/'] = dict(path=f'{path.relative_to(media_directory)}/')
|
||||
children[f'{path.name}/'] = dict(
|
||||
path=f'{path.relative_to(media_directory)}/',
|
||||
child_count=len(list(path.iterdir())),
|
||||
)
|
||||
else:
|
||||
children[path.name] = _get_file_dict(path)
|
||||
d['children'] = children
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue