Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hierarchical view incorrectly handling files in a subdirectory #2442

Open
dschristianson opened this issue Jun 7, 2024 · 7 comments · May be fixed by #2577
Open

Hierarchical view incorrectly handling files in a subdirectory #2442

dschristianson opened this issue Jun 7, 2024 · 7 comments · May be fixed by #2577
Assignees
Labels
ADC CI-06 UI to handle deposit of big data packages arctic data center bug

Comments

@dschristianson
Copy link

dschristianson commented Jun 7, 2024

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
Copy link
Author

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

@robyngit
Copy link
Member

robyngit commented Jun 7, 2024

Thanks for the detailed report @dschristianson!

@vchendrix
Copy link
Collaborator

=

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

@dschristianson this is actuall the resource map xml.

@dschristianson
Copy link
Author

Thanks for the correction, @vchendrix!

@vchendrix
Copy link
Collaborator

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
Copy link
Collaborator

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"
    ]
}

@rushirajnenuji
Copy link
Member

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! 🙏🏻

vchendrix added a commit to wfsi-data/metacatui that referenced this issue Dec 4, 2024
…created

Previously, the `addFilesAndFolders` function did not correctly handle the
creation of subfolders with the same name. This fix ensures that all
subfolders are created properly by constructing the full path for each
folder and checking against the `pathMap` to avoid duplicates.

- Updated the `addFilesAndFolders` function to construct the full path for each folder.
- Ensured that the `pathMap` is updated with the correct paths for all subfolders.
- Added detailed comments to the `addFilesAndFolders` function for better readability and maintenance.

This resolves the issue where subfolders with the same name were not being created correctly.

Closes NCEAS#2442
vchendrix added a commit to wfsi-data/metacatui that referenced this issue Dec 4, 2024
…created

Previously, the `addFilesAndFolders` function did not correctly handle the
creation of subfolders with the same name. This fix ensures that all
subfolders are created properly by constructing the full path for each
folder and checking against the `pathMap` to avoid duplicates.

- Updated the `addFilesAndFolders` function to construct the full path for each folder.
- Ensured that the `pathMap` is updated with the correct paths for all subfolders.
- Added detailed comments to the `addFilesAndFolders` function for better readability and maintenance.

This resolves the issue where subfolders with the same name were not being created correctly.

Closes NCEAS#2442
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADC CI-06 UI to handle deposit of big data packages arctic data center bug
Development

Successfully merging a pull request may close this issue.

4 participants