metacatui icon indicating copy to clipboard operation
metacatui copied to clipboard

Hierarchical view incorrectly handling files in a subdirectory

Open dschristianson opened this issue 1 year ago • 4 comments

Describe the bug Dataset has hierarchical directory structure with multiple subdirectories. One particular subdirectory is not being displayed properly. It contains 35 files.

Upon loading the dataset, the individual files are displayed but not in the correct subdirectory. When the next directory up is closed and then reopened, the files are no longer viewable.

The following screenshot shows the initial view. Note: the full path is /supplementary_data/visualizations/locations/. The locations subdirectory is missing. hierarchical_data-exmple-initial_view

This next screenshot shows the view after the /supplementary_data/visualizations subdirectory is closed and then opened again. Note: the Burn<#>_Plot.html files are no longer shown. hierarchical_data-example-view2

Desktop:

  • OS: Mac OS 14.5
  • Browser: FireFox 126.0.1
  • Version 2.28.0

Additional context The downloaded dataset zip package has the correct directory structure.

I will attach the corresponding eml file in the following comment. The files are not sorted by directory, which @vchendrix and I believe should not matter.

dschristianson avatar Jun 07 '24 18:06 dschristianson

eml file content: hierarchical-data-example-eml.txt

dschristianson avatar Jun 07 '24 19:06 dschristianson

Thanks for the detailed report @dschristianson!

robyngit avatar Jun 07 '24 19:06 robyngit

=

eml file content: hierarchical-data-example-eml.txt

@dschristianson this is actuall the resource map xml.

vchendrix avatar Jun 07 '24 20:06 vchendrix

Thanks for the correction, @vchendrix!

dschristianson avatar Jun 07 '24 23:06 dschristianson

Further details on this issue. It seems that there are subdirectories that have the same name those directories are omiited from the view.

Consider Consider the following hierarchy where there are several sub directories named metadata

./Test-A
./Test-A/test-data-1mb.dat
./Test-A/metadata
./Test-A/metadata/flmd.csv
./README.md
./Test-C
./Test-C/test-data-1mb.dat
./Test-C/metadata
./Test-C/metadata/flmd.csv
./Test-B
./Test-B/test-data-1mb.dat
./Test-B/metadata
./Test-B/metadata/flmd.csv

Screenshot Given this test dataset https://portal-demo.wfsi-data.org/view/doi%3A10.5072%2FFK29P37540 note that the metadata directory is missing from the view. Screenshot 2024-12-04 at 2 33 59 PM

vchendrix avatar Dec 04 '24 22:12 vchendrix

This issue is in DataPackageView.addFilesAndFolders

The algorithm in DataPackageView.addFilesAndFolders is keys the passed in arg, sortedFilePathObj by individual folder names which means that there only ever one parent for the sub directory metadata.

sortedFilePathObj this is passed into the js function

{
    "": [
        "wfsi-20241204T142642168641-4c9650328b48892",
        "wfsi-20241204T223444303-a9c8d0a6a346c4f"
    ],
    "Test-A": [
        "wfsi-20241204T142643228234-971fef2a6dc9e72"
    ],
    "Test-A/metadata": [
        "wfsi-20241204T142642719179-874351c7deb64ab"
    ],
    "Test-B": [
        "wfsi-20241204T142644624152-cd7a2bcbabfe93b"
    ],
    "Test-B/metadata": [
        "wfsi-20241204T142644133339-403af611f1b4d7a"
    ],
    "Test-C": [
        "wfsi-20241204T142646035912-5df1d36d972959c"
    ],
    "Test-C/metadata": [
        "wfsi-20241204T142645512543-fbddfce261c91a1"
    ]
}

vchendrix avatar Dec 04 '24 23:12 vchendrix

HI @vchendrix - thanks for the additional details. Yes, that seems like a logic error in the addFilesAndFolders, I'll work with Robyn to get this fix in for the upcoming release. Thank you! 🙏🏻

rushirajnenuji avatar Dec 04 '24 23:12 rushirajnenuji