@openneuro/app 4.20.5 → 4.20.6-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mocks__/fileMock.js +1 -1
- package/package.json +5 -5
- package/pluralize-esm.js +204 -211
- package/src/@types/custom.d.ts +3 -3
- package/src/@types/react.d.ts +3 -4
- package/src/client.jsx +17 -16
- package/src/scripts/__mocks__/config.ts +6 -6
- package/src/scripts/__utils__/mock-app-shell.tsx +9 -8
- package/src/scripts/apm.js +6 -6
- package/src/scripts/app.tsx +7 -7
- package/src/scripts/authentication/__tests__/profile.spec.js +10 -10
- package/src/scripts/authentication/admin-user.jsx +2 -2
- package/src/scripts/authentication/logged-in.jsx +2 -2
- package/src/scripts/authentication/logged-out.jsx +2 -2
- package/src/scripts/authentication/loginCheck.js +2 -2
- package/src/scripts/authentication/loginUrls.ts +1 -1
- package/src/scripts/authentication/profile.ts +7 -7
- package/src/scripts/authentication/regular-user.tsx +3 -3
- package/src/scripts/authentication/signOut.ts +2 -2
- package/src/scripts/authentication/withProfile.jsx +6 -6
- package/src/scripts/common/block-navigation.jsx +3 -4
- package/src/scripts/common/containers/__tests__/header.spec.tsx +16 -16
- package/src/scripts/common/containers/footer.tsx +3 -3
- package/src/scripts/common/containers/header.tsx +30 -30
- package/src/scripts/common/forms/__tests__/warn-button.spec.jsx +6 -6
- package/src/scripts/common/forms/warn-button.jsx +21 -17
- package/src/scripts/common/partials/block-navigation.jsx +3 -4
- package/src/scripts/common/partials/freshdesk-widget.jsx +17 -20
- package/src/scripts/common/partials/toast-content.jsx +2 -2
- package/src/scripts/components/__tests__/data-table.spec.tsx +7 -7
- package/src/scripts/components/data-table.tsx +23 -22
- package/src/scripts/config.ts +2 -2
- package/src/scripts/datalad/dataset/comments-fragments.js +1 -1
- package/src/scripts/datalad/dataset/dataset-context.js +1 -1
- package/src/scripts/datalad/dataset/dataset-query-context.js +1 -1
- package/src/scripts/datalad/dataset/dataset-query-fragments.js +1 -1
- package/src/scripts/datalad/mutations/cache-clear.jsx +7 -6
- package/src/scripts/datalad/mutations/cache-id.js +2 -2
- package/src/scripts/datalad/mutations/delete-comment.jsx +13 -11
- package/src/scripts/datalad/mutations/delete.jsx +10 -9
- package/src/scripts/datalad/mutations/follow.jsx +12 -11
- package/src/scripts/datalad/mutations/publish.jsx +13 -12
- package/src/scripts/datalad/mutations/remove-permissions.jsx +8 -8
- package/src/scripts/datalad/mutations/revalidate.jsx +7 -6
- package/src/scripts/datalad/mutations/snapshot.tsx +7 -7
- package/src/scripts/datalad/mutations/star.jsx +12 -11
- package/src/scripts/datalad/mutations/submit-metadata.jsx +14 -12
- package/src/scripts/datalad/mutations/update-permissions.jsx +14 -13
- package/src/scripts/datalad/mutations/update-ref.jsx +7 -6
- package/src/scripts/datalad/routes/dataset-redirect.tsx +49 -49
- package/src/scripts/datalad/subscriptions/__tests__/files-subscription.spec.jsx +32 -32
- package/src/scripts/datalad/subscriptions/files-subscription.jsx +16 -16
- package/src/scripts/datalad/subscriptions/useDatasetDeletedSubscription.jsx +4 -4
- package/src/scripts/datalad/subscriptions/useDraftSubscription.js +4 -4
- package/src/scripts/datalad/subscriptions/usePermissionsSubscription.js +4 -4
- package/src/scripts/datalad/subscriptions/useSnapshotsUpdatedSubscriptions.js +3 -3
- package/src/scripts/dataset/__tests__/__snapshots__/snapshot-container.spec.tsx.snap +2 -2
- package/src/scripts/dataset/__tests__/snapshot-container.spec.tsx +12 -12
- package/src/scripts/dataset/comments/__tests__/comment.spec.jsx +21 -21
- package/src/scripts/dataset/comments/__tests__/comments.spec.jsx +10 -10
- package/src/scripts/dataset/comments/block-style-controls.jsx +15 -15
- package/src/scripts/dataset/comments/comment-editor.jsx +31 -31
- package/src/scripts/dataset/comments/comment.jsx +50 -50
- package/src/scripts/dataset/comments/comments.jsx +24 -22
- package/src/scripts/dataset/comments/inline-style-controls.jsx +9 -9
- package/src/scripts/dataset/comments/style-button.jsx +8 -9
- package/src/scripts/dataset/common/follow-toggles.tsx +3 -3
- package/src/scripts/dataset/dataset-query-context.js +1 -1
- package/src/scripts/dataset/dataset-query.jsx +34 -31
- package/src/scripts/dataset/dataset-routes.jsx +5 -5
- package/src/scripts/dataset/download/__tests__/download-command-line.spec.jsx +13 -13
- package/src/scripts/dataset/download/__tests__/download-link.spec.jsx +10 -10
- package/src/scripts/dataset/download/__tests__/download-native.spec.js +7 -7
- package/src/scripts/dataset/download/__tests__/shell-example.spec.jsx +5 -5
- package/src/scripts/dataset/download/download-command-line.jsx +9 -7
- package/src/scripts/dataset/download/download-datalad.jsx +22 -20
- package/src/scripts/dataset/download/download-derivative-datalad.tsx +2 -2
- package/src/scripts/dataset/download/download-derivative-s3.tsx +2 -2
- package/src/scripts/dataset/download/download-link.jsx +6 -6
- package/src/scripts/dataset/download/download-native.js +20 -19
- package/src/scripts/dataset/download/download-query.js +2 -3
- package/src/scripts/dataset/download/download-s3.jsx +8 -8
- package/src/scripts/dataset/download/download-script.tsx +23 -20
- package/src/scripts/dataset/download/native-file-toast.jsx +13 -11
- package/src/scripts/dataset/download/shell-example.jsx +1 -1
- package/src/scripts/dataset/download/track-download.js +5 -5
- package/src/scripts/dataset/draft-container.tsx +104 -102
- package/src/scripts/dataset/draft-snapshot-routes.tsx +3 -3
- package/src/scripts/dataset/files/__tests__/file-tree-unloaded-directory.spec.jsx +23 -23
- package/src/scripts/dataset/files/__tests__/file-tree.spec.jsx +57 -58
- package/src/scripts/dataset/files/__tests__/file-viewer-type.spec.jsx +6 -6
- package/src/scripts/dataset/files/__tests__/file.spec.jsx +15 -15
- package/src/scripts/dataset/files/file-display.jsx +11 -11
- package/src/scripts/dataset/files/file-tree-unloaded-directory.jsx +10 -10
- package/src/scripts/dataset/files/file-tree.tsx +27 -27
- package/src/scripts/dataset/files/file-view.jsx +4 -4
- package/src/scripts/dataset/files/file-viewer-type.jsx +21 -21
- package/src/scripts/dataset/files/file.tsx +85 -80
- package/src/scripts/dataset/files/files.tsx +41 -40
- package/src/scripts/dataset/files/index.tsx +2 -2
- package/src/scripts/dataset/files/viewers/__tests__/__snapshots__/file-viewer-json.spec.jsx.snap +0 -24
- package/src/scripts/dataset/files/viewers/__tests__/file-viewer-json.spec.jsx +9 -9
- package/src/scripts/dataset/files/viewers/__tests__/parse-tabular.spec.js +8 -8
- package/src/scripts/dataset/files/viewers/file-viewer-csv.jsx +5 -5
- package/src/scripts/dataset/files/viewers/file-viewer-html.jsx +3 -3
- package/src/scripts/dataset/files/viewers/file-viewer-json.jsx +4 -4
- package/src/scripts/dataset/files/viewers/file-viewer-nifti.tsx +4 -4
- package/src/scripts/dataset/files/viewers/file-viewer-table.tsx +3 -3
- package/src/scripts/dataset/files/viewers/file-viewer-text.jsx +3 -3
- package/src/scripts/dataset/files/viewers/file-viewer-tsv.jsx +5 -5
- package/src/scripts/dataset/files/viewers/parse-tabular.js +4 -4
- package/src/scripts/dataset/fragments/__tests__/cancel-button.spec.tsx +5 -5
- package/src/scripts/dataset/fragments/__tests__/dataset-alert-draft.spec.tsx +9 -9
- package/src/scripts/dataset/fragments/__tests__/dataset-citation.spec.jsx +10 -10
- package/src/scripts/dataset/fragments/__tests__/doi-link.spec.tsx +29 -29
- package/src/scripts/dataset/fragments/__tests__/edit-button.spec.tsx +5 -5
- package/src/scripts/dataset/fragments/__tests__/edit-list.spec.jsx +13 -13
- package/src/scripts/dataset/fragments/__tests__/save-button.spec.tsx +5 -5
- package/src/scripts/dataset/fragments/__tests__/select-input.spec.tsx +26 -26
- package/src/scripts/dataset/fragments/cancel-button.tsx +2 -2
- package/src/scripts/dataset/fragments/comments-fragments.js +1 -1
- package/src/scripts/dataset/fragments/copyable-tooltip.jsx +14 -13
- package/src/scripts/dataset/fragments/dataset-alert-draft.tsx +17 -13
- package/src/scripts/dataset/fragments/dataset-alert-version.tsx +5 -4
- package/src/scripts/dataset/fragments/dataset-citation.jsx +23 -21
- package/src/scripts/dataset/fragments/dataset-history.jsx +12 -12
- package/src/scripts/dataset/fragments/dataset-reviewers.ts +1 -1
- package/src/scripts/dataset/fragments/doi-link.tsx +6 -6
- package/src/scripts/dataset/fragments/edit-button.tsx +2 -2
- package/src/scripts/dataset/fragments/edit-description-field.jsx +23 -21
- package/src/scripts/dataset/fragments/edit-description-list.jsx +8 -8
- package/src/scripts/dataset/fragments/edit-list.jsx +8 -8
- package/src/scripts/dataset/fragments/number-input.tsx +36 -35
- package/src/scripts/dataset/fragments/save-button.tsx +2 -2
- package/src/scripts/dataset/fragments/select-input.tsx +87 -86
- package/src/scripts/dataset/fragments/text-array-input.tsx +38 -37
- package/src/scripts/dataset/fragments/text-input.tsx +79 -78
- package/src/scripts/dataset/mutations/__tests__/cache-id.spec.js +5 -5
- package/src/scripts/dataset/mutations/__tests__/delete-file.spec.jsx +85 -83
- package/src/scripts/dataset/mutations/__tests__/delete.spec.jsx +8 -8
- package/src/scripts/dataset/mutations/__tests__/deprecate-snapshot.spec.tsx +17 -17
- package/src/scripts/dataset/mutations/__tests__/deprecate-version.spec.tsx +19 -19
- package/src/scripts/dataset/mutations/__tests__/description.spec.jsx +51 -51
- package/src/scripts/dataset/mutations/__tests__/remove-permissions.spec.tsx +9 -9
- package/src/scripts/dataset/mutations/__tests__/update-permissions.spec.jsx +7 -7
- package/src/scripts/dataset/mutations/admin-exports.jsx +13 -12
- package/src/scripts/dataset/mutations/cache-clear.jsx +6 -6
- package/src/scripts/dataset/mutations/cache-id.js +2 -2
- package/src/scripts/dataset/mutations/comment.jsx +25 -23
- package/src/scripts/dataset/mutations/create-anonymous-reviewer.tsx +36 -30
- package/src/scripts/dataset/mutations/dataset-relations.tsx +28 -29
- package/src/scripts/dataset/mutations/delete-anonymous-reviewer.tsx +7 -8
- package/src/scripts/dataset/mutations/delete-comment.jsx +14 -12
- package/src/scripts/dataset/mutations/delete-dataset-form.jsx +20 -22
- package/src/scripts/dataset/mutations/delete-file.jsx +8 -8
- package/src/scripts/dataset/mutations/delete.jsx +10 -9
- package/src/scripts/dataset/mutations/deprecate-version.tsx +5 -6
- package/src/scripts/dataset/mutations/description.jsx +21 -20
- package/src/scripts/dataset/mutations/flag-annex-object.jsx +10 -9
- package/src/scripts/dataset/mutations/follow.tsx +15 -14
- package/src/scripts/dataset/mutations/import-dataset.tsx +5 -5
- package/src/scripts/dataset/mutations/metadata-form.jsx +94 -97
- package/src/scripts/dataset/mutations/publish.jsx +13 -13
- package/src/scripts/dataset/mutations/readme.jsx +12 -11
- package/src/scripts/dataset/mutations/remove-annex-object.jsx +10 -9
- package/src/scripts/dataset/mutations/remove-permissions.tsx +5 -6
- package/src/scripts/dataset/mutations/revalidate.jsx +7 -7
- package/src/scripts/dataset/mutations/snapshot.tsx +8 -8
- package/src/scripts/dataset/mutations/star.tsx +14 -13
- package/src/scripts/dataset/mutations/submit-metadata.jsx +12 -11
- package/src/scripts/dataset/mutations/undo-deprecate-version.tsx +5 -6
- package/src/scripts/dataset/mutations/update-file.jsx +6 -6
- package/src/scripts/dataset/mutations/update-permissions.tsx +9 -9
- package/src/scripts/dataset/mutations/update-ref.jsx +7 -7
- package/src/scripts/dataset/routes/__tests__/deprecate-snapshot-page.spec.tsx +5 -5
- package/src/scripts/dataset/routes/add-metadata.jsx +19 -20
- package/src/scripts/dataset/routes/admin-datalad.jsx +7 -7
- package/src/scripts/dataset/routes/dataset-default.tsx +12 -10
- package/src/scripts/dataset/routes/delete-page.tsx +12 -12
- package/src/scripts/dataset/routes/deprecate-snapshot-page.tsx +8 -8
- package/src/scripts/dataset/routes/derivatives.tsx +10 -10
- package/src/scripts/dataset/routes/download-dataset.tsx +20 -20
- package/src/scripts/dataset/routes/manage-anonymous-reviewers.tsx +37 -35
- package/src/scripts/dataset/routes/manage-permissions.jsx +22 -22
- package/src/scripts/dataset/routes/publish.jsx +32 -30
- package/src/scripts/dataset/routes/snapshot-default.tsx +7 -7
- package/src/scripts/dataset/routes/snapshot.tsx +44 -43
- package/src/scripts/dataset/routes/styles/dataset-page-border.tsx +3 -3
- package/src/scripts/dataset/routes/styles/dataset-page-tab-container.tsx +3 -3
- package/src/scripts/dataset/routes/styles/header-row.tsx +3 -3
- package/src/scripts/dataset/routes/tab-routes-draft.tsx +12 -12
- package/src/scripts/dataset/routes/tab-routes-snapshot.tsx +8 -8
- package/src/scripts/dataset/snapshot-container.tsx +78 -86
- package/src/scripts/errors/403page.tsx +11 -11
- package/src/scripts/errors/404page.tsx +12 -12
- package/src/scripts/errors/errorBoundary.jsx +13 -12
- package/src/scripts/errors/errorRoute.jsx +6 -6
- package/src/scripts/errors/freshdesk-widget.jsx +17 -20
- package/src/scripts/errors/freshdeskInterface.jsx +9 -9
- package/src/scripts/errors/orcid/email.jsx +3 -3
- package/src/scripts/errors/orcid/family.jsx +4 -4
- package/src/scripts/errors/orcid/general.jsx +1 -1
- package/src/scripts/errors/orcid/given.jsx +4 -4
- package/src/scripts/fixtures/dataset-query.ts +119 -119
- package/src/scripts/fixtures/mock-app-wrapper.tsx +4 -4
- package/src/scripts/index.tsx +9 -9
- package/src/scripts/pages/admin/admin.jsx +5 -5
- package/src/scripts/pages/admin/flagged-files.jsx +33 -31
- package/src/scripts/pages/admin/user-fragment.ts +1 -1
- package/src/scripts/pages/admin/user-tools.tsx +13 -11
- package/src/scripts/pages/admin/users.jsx +38 -39
- package/src/scripts/pages/api.jsx +20 -19
- package/src/scripts/pages/citation-page.tsx +4 -4
- package/src/scripts/pages/faq/faq.tsx +2 -2
- package/src/scripts/pages/front-page/aggregate-queries/aggregate-counts-container.tsx +6 -5
- package/src/scripts/pages/front-page/aggregate-queries/use-participant-count.ts +2 -2
- package/src/scripts/pages/front-page/aggregate-queries/use-publicDatasets-count.ts +2 -2
- package/src/scripts/pages/front-page/front-page-content.ts +42 -42
- package/src/scripts/pages/front-page/front-page.tsx +18 -14
- package/src/scripts/pages/front-page-comp.tsx +3 -3
- package/src/scripts/pages/import-dataset.tsx +10 -10
- package/src/scripts/pages/metadata/dataset-metadata.tsx +15 -14
- package/src/scripts/pages/pet-redirect.tsx +2 -2
- package/src/scripts/queries/dataset.ts +3 -3
- package/src/scripts/resources/__tests__/kibana.spec.js +9 -9
- package/src/scripts/resources/kibana.js +3 -3
- package/src/scripts/resources/strings.js +2 -2
- package/src/scripts/routes.tsx +14 -14
- package/src/scripts/search/__helpers__/search-render.tsx +3 -3
- package/src/scripts/search/__tests__/search-container.spec.tsx +22 -22
- package/src/scripts/search/__tests__/search-params-ctx.spec.tsx +20 -20
- package/src/scripts/search/es-query-builders.ts +21 -5
- package/src/scripts/search/filters-block-container.tsx +14 -16
- package/src/scripts/search/initial-search-params.tsx +45 -45
- package/src/scripts/search/inputs/__tests__/sort-by-select.spec.tsx +23 -23
- package/src/scripts/search/inputs/admin-allDatasets-toggle.tsx +12 -12
- package/src/scripts/search/inputs/age-range-input.tsx +9 -8
- package/src/scripts/search/inputs/author-input.tsx +14 -11
- package/src/scripts/search/inputs/date-radios.tsx +8 -7
- package/src/scripts/search/inputs/diagnosis-select.tsx +6 -6
- package/src/scripts/search/inputs/index.ts +33 -33
- package/src/scripts/search/inputs/keyword-input.tsx +13 -13
- package/src/scripts/search/inputs/modality-select.tsx +33 -30
- package/src/scripts/search/inputs/pet/bodyParts_input.tsx +18 -16
- package/src/scripts/search/inputs/pet/scannerManufacturersModelNames_input.tsx +18 -16
- package/src/scripts/search/inputs/pet/scannerManufacturers_input.tsx +18 -16
- package/src/scripts/search/inputs/pet/tracerNames_input.tsx +16 -15
- package/src/scripts/search/inputs/pet/tracerRadionuclides_input.tsx +18 -16
- package/src/scripts/search/inputs/section-select.tsx +6 -6
- package/src/scripts/search/inputs/sex-radios.tsx +6 -6
- package/src/scripts/search/inputs/show-datasets-radios.tsx +31 -29
- package/src/scripts/search/inputs/sort-by-select.tsx +10 -11
- package/src/scripts/search/inputs/species-select.tsx +6 -6
- package/src/scripts/search/inputs/study-domain-input.tsx +18 -16
- package/src/scripts/search/inputs/subject-count-range-input.tsx +8 -7
- package/src/scripts/search/inputs/task-input.tsx +18 -16
- package/src/scripts/search/search-container.tsx +83 -85
- package/src/scripts/search/search-params-ctx.tsx +40 -38
- package/src/scripts/search/search-routes.tsx +4 -4
- package/src/scripts/search/use-search-results.tsx +125 -99
- package/src/scripts/styles/media.tsx +3 -3
- package/src/scripts/styles/support-modal.jsx +2 -2
- package/src/scripts/sw.ts +12 -11
- package/src/scripts/test-utils.js +4 -4
- package/src/scripts/uploader/add-path-to-files.js +7 -7
- package/src/scripts/uploader/file-select.tsx +3 -3
- package/src/scripts/uploader/file-upload.js +13 -12
- package/src/scripts/uploader/input.jsx +8 -7
- package/src/scripts/uploader/upload-button.jsx +3 -3
- package/src/scripts/uploader/upload-disclaimer-input.tsx +66 -66
- package/src/scripts/uploader/upload-disclaimer.jsx +6 -5
- package/src/scripts/uploader/upload-file-status.jsx +4 -4
- package/src/scripts/uploader/upload-issues.jsx +32 -29
- package/src/scripts/uploader/upload-metadata.jsx +18 -17
- package/src/scripts/uploader/upload-mutation.js +17 -20
- package/src/scripts/uploader/upload-progress-button.jsx +5 -4
- package/src/scripts/uploader/upload-progress.jsx +3 -3
- package/src/scripts/uploader/upload-rename.jsx +6 -5
- package/src/scripts/uploader/upload-resume.jsx +26 -24
- package/src/scripts/uploader/upload-select.jsx +10 -9
- package/src/scripts/uploader/upload-status.jsx +5 -5
- package/src/scripts/uploader/upload-step.jsx +9 -9
- package/src/scripts/uploader/uploader-context.js +1 -1
- package/src/scripts/uploader/uploader-location.js +1 -1
- package/src/scripts/uploader/uploader-modal.jsx +8 -7
- package/src/scripts/uploader/uploader-setup-routes.jsx +10 -10
- package/src/scripts/uploader/uploader-status-routes.jsx +6 -6
- package/src/scripts/uploader/uploader-view.jsx +4 -4
- package/src/scripts/uploader/uploader.jsx +50 -48
- package/src/scripts/users/username.tsx +3 -3
- package/src/scripts/utils/__tests__/csv.spec.ts +16 -16
- package/src/scripts/utils/__tests__/date.spec.js +4 -4
- package/src/scripts/utils/__tests__/json-ld.spec.js +12 -12
- package/src/scripts/utils/__tests__/newid.spec.js +9 -9
- package/src/scripts/utils/__tests__/userNotify.spec.js +10 -10
- package/src/scripts/utils/analytics.tsx +3 -3
- package/src/scripts/utils/cookies.js +1 -1
- package/src/scripts/utils/csv.ts +13 -15
- package/src/scripts/utils/datalad.js +1 -1
- package/src/scripts/utils/dataset-url.js +2 -2
- package/src/scripts/utils/date.js +2 -2
- package/src/scripts/utils/global-polyfill.ts +2 -2
- package/src/scripts/utils/gtag.js +6 -6
- package/src/scripts/utils/json-ld.js +13 -13
- package/src/scripts/utils/newid.js +1 -1
- package/src/scripts/utils/user-login-modal-ctx.tsx +4 -4
- package/src/scripts/utils/userNotify.js +2 -2
- package/src/scripts/validation/validation-panel.jsx +3 -3
- package/src/scripts/validation/validation-results.issues.issue.jsx +9 -9
- package/src/scripts/validation/validation-results.issues.jsx +19 -17
- package/src/scripts/validation/validation-results.jsx +10 -10
- package/src/scripts/validation/validation-status.jsx +19 -17
- package/src/scripts/validation/validation.jsx +5 -5
- package/src/scripts/workers/schema.ts +2 -2
- package/src/scripts/workers/schema.worker.ts +4 -4
- package/src/scripts/workers/validate.ts +2 -2
- package/src/scripts/workers/validate.worker.ts +7 -5
- package/vite.config.js +17 -17
- package/src/dist/assets/activity-icon.9ab0c828.png +0 -0
- package/src/dist/assets/bids.da8810b3.jpg +0 -0
- package/src/dist/assets/brand_mark.28e7645d.png +0 -0
- package/src/dist/assets/close-button.21e700a6.png +0 -0
- package/src/dist/assets/cube-get.39ed5636.png +0 -0
- package/src/dist/assets/cube-share.9b558c29.png +0 -0
- package/src/dist/assets/cube-use.ccf2ddc5.png +0 -0
- package/src/dist/assets/datalad.a35b15b8.jpg +0 -0
- package/src/dist/assets/eeg.1dc1dc54.jpg +0 -0
- package/src/dist/assets/email-header.1cb8bf76.png +0 -0
- package/src/dist/assets/ieeg.f91deb0a.jpg +0 -0
- package/src/dist/assets/index.3db805fb.js +0 -23127
- package/src/dist/assets/index.3db805fb.js.map +0 -1
- package/src/dist/assets/index.5eb79d2c.css +0 -1
- package/src/dist/assets/ljaf.567e9566.png +0 -0
- package/src/dist/assets/logo_app.8c986cf9.png +0 -0
- package/src/dist/assets/logo_cube.5224b745.png +0 -0
- package/src/dist/assets/logo_data.3e1d5743.png +0 -0
- package/src/dist/assets/logo_users.a84a265a.png +0 -0
- package/src/dist/assets/meg.1e1928f8.jpg +0 -0
- package/src/dist/assets/mri.b01e4f42.jpg +0 -0
- package/src/dist/assets/nih-bi-logo.80d76e1d.png +0 -0
- package/src/dist/assets/nih-stanford.2a7c496e.jpg +0 -0
- package/src/dist/assets/nih.78a64d38.png +0 -0
- package/src/dist/assets/nimh.0ec775d8.png +0 -0
- package/src/dist/assets/nru-logo.f3097dc5.png +0 -0
- package/src/dist/assets/nsf.eee1d3f7.png +0 -0
- package/src/dist/assets/nsf.f87e96e7.png +0 -0
- package/src/dist/assets/on-dark-horz.e1f213d0.svg +0 -1
- package/src/dist/assets/on-dark.12f4e2ce.svg +0 -1
- package/src/dist/assets/on-light-horz.23ff22c3.svg +0 -1
- package/src/dist/assets/on-light.50592f7f.svg +0 -1
- package/src/dist/assets/pet-scan.21d98a3d.jpg +0 -0
- package/src/dist/assets/revicons.4ca02b8a.ttf +0 -0
- package/src/dist/assets/revicons.9e4d4c68.eot +0 -0
- package/src/dist/assets/revicons.f7b9c306.woff +0 -0
- package/src/dist/assets/sqm-logo.9cd0cca5.png +0 -0
- package/src/dist/assets/squishymedia.fa3c5919.png +0 -0
- package/src/dist/assets/stanford.5f245936.png +0 -0
- package/src/dist/index.html +0 -25
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render, screen
|
|
3
|
-
import { MockedProvider } from
|
|
4
|
-
import FileTree, {
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { fireEvent, render, screen } from "@testing-library/react"
|
|
3
|
+
import { MockedProvider } from "@apollo/client/testing"
|
|
4
|
+
import FileTree, { fileTreeLevels, unescapePath } from "../file-tree"
|
|
5
5
|
|
|
6
6
|
// official Jest workaround for mocking methods not implemented in JSDOM
|
|
7
|
-
window.matchMedia =
|
|
8
|
-
window.matchMedia ||
|
|
7
|
+
window.matchMedia = window.matchMedia ||
|
|
9
8
|
function () {
|
|
10
9
|
return {
|
|
11
10
|
matches: false,
|
|
@@ -16,33 +15,33 @@ window.matchMedia =
|
|
|
16
15
|
|
|
17
16
|
const datasetFiles = [
|
|
18
17
|
{
|
|
19
|
-
id:
|
|
20
|
-
key:
|
|
21
|
-
filename:
|
|
18
|
+
id: "b42624c6aea63fc5e3f6f3e712d9e44adc4dbfdc",
|
|
19
|
+
key: "834b88a80109f1b38e0ab85999090170889469ce",
|
|
20
|
+
filename: "CHANGES",
|
|
22
21
|
size: 59,
|
|
23
22
|
directory: false,
|
|
24
23
|
annexed: false,
|
|
25
24
|
},
|
|
26
25
|
{
|
|
27
|
-
id:
|
|
28
|
-
key:
|
|
29
|
-
filename:
|
|
26
|
+
id: "63888a199a5ce37377b1cd708cda59577dad218f",
|
|
27
|
+
key: "fa84e5f958ec72d42b3e196e592f6db9f7104b19",
|
|
28
|
+
filename: "README",
|
|
30
29
|
size: 709,
|
|
31
30
|
directory: false,
|
|
32
31
|
annexed: false,
|
|
33
32
|
},
|
|
34
33
|
{
|
|
35
|
-
id:
|
|
36
|
-
key:
|
|
37
|
-
filename:
|
|
34
|
+
id: "a2922b427c5c997e77ce058e0ce57ffd17123a7f",
|
|
35
|
+
key: "0b1856b91c11f67098ce60114417a62dd55730a5",
|
|
36
|
+
filename: "dataset_description.json",
|
|
38
37
|
size: 172,
|
|
39
38
|
directory: false,
|
|
40
39
|
annexed: false,
|
|
41
40
|
},
|
|
42
41
|
{
|
|
43
|
-
id:
|
|
42
|
+
id: "a6378eea201d9cad639e0bee328e03132d30489d",
|
|
44
43
|
key: null,
|
|
45
|
-
filename:
|
|
44
|
+
filename: "sub-01",
|
|
46
45
|
size: 0,
|
|
47
46
|
directory: true,
|
|
48
47
|
annexed: false,
|
|
@@ -50,113 +49,113 @@ const datasetFiles = [
|
|
|
50
49
|
]
|
|
51
50
|
|
|
52
51
|
const anatDir = {
|
|
53
|
-
id:
|
|
52
|
+
id: "9703f3f6b4137c2b86a3a712eb34d78bdec9fd72",
|
|
54
53
|
key: null,
|
|
55
|
-
filename:
|
|
54
|
+
filename: "sub-01:anat",
|
|
56
55
|
size: 0,
|
|
57
56
|
directory: true,
|
|
58
57
|
annexed: false,
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
const niftiFile = {
|
|
62
|
-
id:
|
|
63
|
-
key:
|
|
64
|
-
filename:
|
|
61
|
+
id: "69fd3617b27125c433ea5f8e0e2052c31828c253",
|
|
62
|
+
key: "MD5E-s311112--bc8bbbacfd2ff823c2047ead1afec9b3.nii.gz",
|
|
63
|
+
filename: "sub-01:anat:sub-01_T1w.nii.gz",
|
|
65
64
|
size: 311112,
|
|
66
65
|
directory: false,
|
|
67
66
|
annexed: true,
|
|
68
67
|
}
|
|
69
68
|
|
|
70
|
-
describe(
|
|
71
|
-
it(
|
|
72
|
-
const { childFiles, currentFiles } = fileTreeLevels(
|
|
69
|
+
describe("fileTreeLevels()", () => {
|
|
70
|
+
it("handles top level files correctly", () => {
|
|
71
|
+
const { childFiles, currentFiles } = fileTreeLevels("", datasetFiles)
|
|
73
72
|
expect(currentFiles).toEqual(
|
|
74
73
|
expect.arrayContaining([
|
|
75
74
|
currentFiles.find(
|
|
76
|
-
f => f.id ===
|
|
75
|
+
(f) => f.id === "a2922b427c5c997e77ce058e0ce57ffd17123a7f",
|
|
77
76
|
),
|
|
78
77
|
]),
|
|
79
78
|
)
|
|
80
79
|
expect(childFiles).toEqual({})
|
|
81
80
|
})
|
|
82
|
-
it(
|
|
81
|
+
it("passes childFiles to the next level", () => {
|
|
83
82
|
const levelOneFiles = [...datasetFiles, anatDir]
|
|
84
|
-
const { childFiles, currentFiles } = fileTreeLevels(
|
|
83
|
+
const { childFiles, currentFiles } = fileTreeLevels("", levelOneFiles)
|
|
85
84
|
expect(currentFiles).toEqual(
|
|
86
85
|
expect.arrayContaining([
|
|
87
86
|
currentFiles.find(
|
|
88
|
-
f => f.id ===
|
|
87
|
+
(f) => f.id === "a2922b427c5c997e77ce058e0ce57ffd17123a7f",
|
|
89
88
|
),
|
|
90
89
|
]),
|
|
91
90
|
)
|
|
92
|
-
expect(childFiles[
|
|
91
|
+
expect(childFiles["sub-01"]).toEqual(expect.arrayContaining([anatDir]))
|
|
93
92
|
})
|
|
94
|
-
it(
|
|
93
|
+
it("passes two level deep childFiles to the next level", () => {
|
|
95
94
|
const levelTwoFiles = [...datasetFiles, anatDir, niftiFile]
|
|
96
|
-
const { childFiles, currentFiles } = fileTreeLevels(
|
|
95
|
+
const { childFiles, currentFiles } = fileTreeLevels("", levelTwoFiles)
|
|
97
96
|
expect(currentFiles).toEqual(
|
|
98
97
|
expect.arrayContaining([
|
|
99
98
|
currentFiles.find(
|
|
100
|
-
f => f.id ===
|
|
99
|
+
(f) => f.id === "a2922b427c5c997e77ce058e0ce57ffd17123a7f",
|
|
101
100
|
),
|
|
102
101
|
]),
|
|
103
102
|
)
|
|
104
|
-
expect(childFiles[
|
|
103
|
+
expect(childFiles["sub-01"]).toEqual(expect.arrayContaining([niftiFile]))
|
|
105
104
|
})
|
|
106
|
-
it(
|
|
105
|
+
it("passes two level deep childFiles to the next level", () => {
|
|
107
106
|
const levelTwoFiles = [anatDir, niftiFile]
|
|
108
|
-
const { childFiles, currentFiles } = fileTreeLevels(
|
|
107
|
+
const { childFiles, currentFiles } = fileTreeLevels("sub-01", levelTwoFiles)
|
|
109
108
|
expect(currentFiles).toEqual(
|
|
110
109
|
expect.arrayContaining([
|
|
111
110
|
currentFiles.find(
|
|
112
|
-
f => f.id ===
|
|
111
|
+
(f) => f.id === "9703f3f6b4137c2b86a3a712eb34d78bdec9fd72",
|
|
113
112
|
),
|
|
114
113
|
]),
|
|
115
114
|
)
|
|
116
|
-
expect(childFiles[
|
|
115
|
+
expect(childFiles["sub-01:anat"]).toEqual(
|
|
117
116
|
expect.arrayContaining([niftiFile]),
|
|
118
117
|
)
|
|
119
118
|
})
|
|
120
119
|
})
|
|
121
120
|
|
|
122
|
-
describe(
|
|
123
|
-
it(
|
|
121
|
+
describe("FileTree component", () => {
|
|
122
|
+
it("renders with default props", () => {
|
|
124
123
|
const { asFragment } = render(<FileTree />)
|
|
125
124
|
expect(asFragment()).toMatchSnapshot()
|
|
126
125
|
})
|
|
127
|
-
it(
|
|
126
|
+
it("expands and closes when clicked", () => {
|
|
128
127
|
render(
|
|
129
128
|
<MockedProvider>
|
|
130
129
|
<FileTree name="Top Level" />
|
|
131
130
|
</MockedProvider>,
|
|
132
131
|
)
|
|
133
132
|
// Test the folder icon is closed
|
|
134
|
-
expect(screen.getByLabelText(
|
|
135
|
-
|
|
133
|
+
expect(screen.getByLabelText("Top Level").firstChild).toHaveClass(
|
|
134
|
+
"fa-folder",
|
|
136
135
|
)
|
|
137
|
-
expect(screen.getByLabelText(
|
|
138
|
-
|
|
136
|
+
expect(screen.getByLabelText("Top Level").firstChild).not.toHaveClass(
|
|
137
|
+
"fa-folder-open",
|
|
139
138
|
)
|
|
140
139
|
// Click it
|
|
141
|
-
fireEvent.click(screen.getByLabelText(
|
|
140
|
+
fireEvent.click(screen.getByLabelText("Top Level"))
|
|
142
141
|
// Test that it is now open
|
|
143
|
-
expect(screen.getByLabelText(
|
|
144
|
-
|
|
142
|
+
expect(screen.getByLabelText("Top Level").firstChild).toHaveClass(
|
|
143
|
+
"fa-folder-open",
|
|
145
144
|
)
|
|
146
|
-
expect(screen.getByLabelText(
|
|
147
|
-
|
|
145
|
+
expect(screen.getByLabelText("Top Level").firstChild).not.toHaveClass(
|
|
146
|
+
"fa-folder",
|
|
148
147
|
)
|
|
149
148
|
})
|
|
150
|
-
describe(
|
|
151
|
-
it(
|
|
152
|
-
expect(unescapePath(
|
|
149
|
+
describe("unescapePath()", () => {
|
|
150
|
+
it("does not alter an already escaped path", () => {
|
|
151
|
+
expect(unescapePath("sub-01/anat")).toBe("sub-01/anat")
|
|
153
152
|
})
|
|
154
|
-
it(
|
|
155
|
-
expect(unescapePath(
|
|
153
|
+
it("does unescapes any : characters", () => {
|
|
154
|
+
expect(unescapePath("sub-01:anat")).toBe("sub-01/anat")
|
|
156
155
|
})
|
|
157
|
-
it(
|
|
158
|
-
expect(unescapePath(
|
|
159
|
-
|
|
156
|
+
it("unescapes multiple : characters", () => {
|
|
157
|
+
expect(unescapePath("sub-01:anat:image.nii.gz")).toBe(
|
|
158
|
+
"sub-01/anat/image.nii.gz",
|
|
160
159
|
)
|
|
161
160
|
})
|
|
162
161
|
})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render, screen } from
|
|
3
|
-
import FileViewerType from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { render, screen } from "@testing-library/react"
|
|
3
|
+
import FileViewerType from "../file-viewer-type.jsx"
|
|
4
4
|
|
|
5
|
-
describe(
|
|
6
|
-
it(
|
|
5
|
+
describe("FileViewerType component", () => {
|
|
6
|
+
it("displays a fallback when an unknown file is specified", () => {
|
|
7
7
|
const component = render(
|
|
8
8
|
<FileViewerType
|
|
9
9
|
path="unknown-file-extension.xyz"
|
|
@@ -12,6 +12,6 @@ describe('FileViewerType component', () => {
|
|
|
12
12
|
)
|
|
13
13
|
expect(
|
|
14
14
|
screen.getByText(/this file must be downloaded to view it/i),
|
|
15
|
-
).toHaveClass(
|
|
15
|
+
).toHaveClass("file-viewer-fallback")
|
|
16
16
|
})
|
|
17
17
|
})
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render, screen } from
|
|
3
|
-
import { MemoryRouter } from
|
|
4
|
-
import File from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { render, screen } from "@testing-library/react"
|
|
3
|
+
import { MemoryRouter } from "react-router-dom"
|
|
4
|
+
import File from "../file"
|
|
5
5
|
|
|
6
|
-
describe(
|
|
7
|
-
it(
|
|
6
|
+
describe("File component", () => {
|
|
7
|
+
it("renders with common props", () => {
|
|
8
8
|
const { asFragment } = render(
|
|
9
9
|
<File datasetId="ds001" path="" filename="README" size={500} />,
|
|
10
10
|
{ wrapper: MemoryRouter },
|
|
11
11
|
)
|
|
12
12
|
expect(asFragment()).toMatchSnapshot()
|
|
13
13
|
})
|
|
14
|
-
it(
|
|
14
|
+
it("renders for dataset snapshots", () => {
|
|
15
15
|
const { asFragment } = render(
|
|
16
16
|
<File
|
|
17
17
|
datasetId="ds001"
|
|
@@ -24,16 +24,16 @@ describe('File component', () => {
|
|
|
24
24
|
)
|
|
25
25
|
expect(asFragment()).toMatchSnapshot()
|
|
26
26
|
})
|
|
27
|
-
it(
|
|
27
|
+
it("generates correct download links for top level files", () => {
|
|
28
28
|
render(<File datasetId="ds001" path="" filename="README" size={500} />, {
|
|
29
29
|
wrapper: MemoryRouter,
|
|
30
30
|
})
|
|
31
|
-
expect(screen.getByRole(
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
expect(screen.getByRole("link", { name: "download file" })).toHaveAttribute(
|
|
32
|
+
"href",
|
|
33
|
+
"/crn/datasets/ds001/files/README",
|
|
34
34
|
)
|
|
35
35
|
})
|
|
36
|
-
it(
|
|
36
|
+
it("generates correct download links for nested files", () => {
|
|
37
37
|
render(
|
|
38
38
|
<File
|
|
39
39
|
datasetId="ds001"
|
|
@@ -43,9 +43,9 @@ describe('File component', () => {
|
|
|
43
43
|
/>,
|
|
44
44
|
{ wrapper: MemoryRouter },
|
|
45
45
|
)
|
|
46
|
-
expect(screen.getByRole(
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
expect(screen.getByRole("link", { name: "download file" })).toHaveAttribute(
|
|
47
|
+
"href",
|
|
48
|
+
"/crn/datasets/ds001/files/sub-01:anat:sub-01_T1w.nii.gz",
|
|
49
49
|
)
|
|
50
50
|
})
|
|
51
51
|
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import { useParams } from
|
|
4
|
-
import FileView from
|
|
5
|
-
import { apiPath } from
|
|
6
|
-
import styled from
|
|
7
|
-
import { Media } from
|
|
8
|
-
import { DatasetPageBorder } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import { useParams } from "react-router-dom"
|
|
4
|
+
import FileView from "./file-view.jsx"
|
|
5
|
+
import { apiPath } from "./file"
|
|
6
|
+
import styled from "@emotion/styled"
|
|
7
|
+
import { Media } from "../../styles/media"
|
|
8
|
+
import { DatasetPageBorder } from "../routes/styles/dataset-page-border"
|
|
9
9
|
|
|
10
10
|
const PathBreadcrumb = styled.div`
|
|
11
11
|
font-size: 14px;
|
|
@@ -24,21 +24,21 @@ const PathBreadcrumb = styled.div`
|
|
|
24
24
|
* Create dataset -> dir -> filename breadcrumbs
|
|
25
25
|
*/
|
|
26
26
|
export const FileDisplayBreadcrumb = ({ filePath }) => {
|
|
27
|
-
const tokens = filePath.split(
|
|
27
|
+
const tokens = filePath.split(":")
|
|
28
28
|
return (
|
|
29
29
|
<>
|
|
30
30
|
{tokens.map((token, index) => {
|
|
31
31
|
if (token === tokens.slice(-1)[0]) {
|
|
32
32
|
return (
|
|
33
33
|
<span className="display-file" key={index}>
|
|
34
|
-
{
|
|
34
|
+
{" "}
|
|
35
35
|
<i className="fa fa-file-o" /> {token}
|
|
36
36
|
</span>
|
|
37
37
|
)
|
|
38
38
|
} else {
|
|
39
39
|
return (
|
|
40
40
|
<span className="display-file" key={index}>
|
|
41
|
-
{
|
|
41
|
+
{" "}
|
|
42
42
|
<i className="fa fa-folder-open-o" /> {token}
|
|
43
43
|
</span>
|
|
44
44
|
)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import DatasetQueryContext from
|
|
4
|
-
import { gql } from
|
|
5
|
-
import { AccordionTab } from
|
|
1
|
+
import React, { useContext, useEffect, useState } from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import DatasetQueryContext from "../../datalad/dataset/dataset-query-context.js"
|
|
4
|
+
import { gql } from "@apollo/client"
|
|
5
|
+
import { AccordionTab } from "@openneuro/components/accordion"
|
|
6
6
|
|
|
7
7
|
export const DRAFT_FILES_QUERY = gql`
|
|
8
8
|
query dataset($datasetId: ID!, $tree: String!) {
|
|
@@ -41,7 +41,7 @@ export const SNAPSHOT_FILES_QUERY = gql`
|
|
|
41
41
|
/**
|
|
42
42
|
* Prepend paths to the tree object returned to get absolute filenames
|
|
43
43
|
*/
|
|
44
|
-
export const nestFiles = path => file => ({
|
|
44
|
+
export const nestFiles = (path) => (file) => ({
|
|
45
45
|
...file,
|
|
46
46
|
filename: `${path}:${file.filename}`,
|
|
47
47
|
})
|
|
@@ -50,8 +50,7 @@ export const nestFiles = path => file => ({
|
|
|
50
50
|
* Merge cached dataset files with newly received data
|
|
51
51
|
*/
|
|
52
52
|
export const mergeNewFiles =
|
|
53
|
-
(directory, snapshotTag) =>
|
|
54
|
-
(past, { fetchMoreResult }) => {
|
|
53
|
+
(directory, snapshotTag) => (past, { fetchMoreResult }) => {
|
|
55
54
|
// Deep clone the old dataset object
|
|
56
55
|
const path = directory.filename
|
|
57
56
|
const newDatasetObj = JSON.parse(JSON.stringify(past))
|
|
@@ -81,12 +80,13 @@ const FileTreeUnloadedDirectory = ({ datasetId, snapshotTag, directory }) => {
|
|
|
81
80
|
const { fetchMore } = useContext(DatasetQueryContext)
|
|
82
81
|
return (
|
|
83
82
|
<AccordionTab
|
|
84
|
-
label={directory.filename.split(
|
|
83
|
+
label={directory.filename.split(":").pop()}
|
|
85
84
|
accordionStyle="file-tree"
|
|
86
85
|
onClick={() => {
|
|
87
86
|
fetchMoreDirectory(fetchMore, datasetId, snapshotTag, directory)
|
|
88
87
|
// No need to clear since this component is unmounted immediately
|
|
89
|
-
}}
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
90
|
<div>Loading...</div>
|
|
91
91
|
</AccordionTab>
|
|
92
92
|
)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import File from
|
|
3
|
-
import UpdateFile from
|
|
4
|
-
import DeleteFile from
|
|
5
|
-
import FileTreeUnloadedDirectory from
|
|
6
|
-
import { Media } from
|
|
7
|
-
import { AccordionTab } from
|
|
8
|
-
import { DatasetFile } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import File from "./file"
|
|
3
|
+
import UpdateFile from "../mutations/update-file.jsx"
|
|
4
|
+
import DeleteFile from "../mutations/delete-file.jsx"
|
|
5
|
+
import FileTreeUnloadedDirectory from "./file-tree-unloaded-directory.jsx"
|
|
6
|
+
import { Media } from "../../styles/media"
|
|
7
|
+
import { AccordionTab } from "@openneuro/components/accordion"
|
|
8
|
+
import { DatasetFile } from "../../types/dataset-file"
|
|
9
9
|
|
|
10
|
-
export const unescapePath = (path: string): string => path.replace(/:/g,
|
|
10
|
+
export const unescapePath = (path: string): string => path.replace(/:/g, "/")
|
|
11
11
|
|
|
12
12
|
interface FileTreeProps {
|
|
13
13
|
datasetId: string
|
|
@@ -34,14 +34,13 @@ export function fileTreeLevels(
|
|
|
34
34
|
for (const f of files) {
|
|
35
35
|
// Any paths in this filename below the current path value
|
|
36
36
|
const lowerPath = f.filename.substring(`${path}:`.length)
|
|
37
|
-
if (path ===
|
|
37
|
+
if (path === "" ? f.filename.includes(":") : lowerPath.includes(":")) {
|
|
38
38
|
// At the top level, use the directory component (first segment)
|
|
39
39
|
// Below that, use all paths before the filename (sub-01:anat) for (sub-01:anat:sub-01_T1w.nii.gz)
|
|
40
|
-
const components = f.filename.split(
|
|
41
|
-
const childPath =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
: components.slice(0, path.split(':').length + 1).join(':')
|
|
40
|
+
const components = f.filename.split(":")
|
|
41
|
+
const childPath = path === ""
|
|
42
|
+
? components[0]
|
|
43
|
+
: components.slice(0, path.split(":").length + 1).join(":")
|
|
45
44
|
if (childFiles.hasOwnProperty(childPath)) {
|
|
46
45
|
childFiles[childPath].push(f)
|
|
47
46
|
} else {
|
|
@@ -57,8 +56,8 @@ export function fileTreeLevels(
|
|
|
57
56
|
const FileTree = ({
|
|
58
57
|
datasetId,
|
|
59
58
|
snapshotTag = null,
|
|
60
|
-
path =
|
|
61
|
-
name =
|
|
59
|
+
path = "",
|
|
60
|
+
name = "",
|
|
62
61
|
files = [],
|
|
63
62
|
editMode = false,
|
|
64
63
|
defaultExpanded = false,
|
|
@@ -73,7 +72,8 @@ const FileTree = ({
|
|
|
73
72
|
className=""
|
|
74
73
|
label={name}
|
|
75
74
|
accordionStyle="file-tree"
|
|
76
|
-
startOpen={defaultExpanded}
|
|
75
|
+
startOpen={defaultExpanded}
|
|
76
|
+
>
|
|
77
77
|
{editMode && (
|
|
78
78
|
<Media className="filetree-dir-tools" greaterThanOrEqual="medium">
|
|
79
79
|
<span className="filetree-dir">
|
|
@@ -81,21 +81,21 @@ const FileTree = ({
|
|
|
81
81
|
datasetId={datasetId}
|
|
82
82
|
path={unescapePath(path)}
|
|
83
83
|
tooltip={`Choose one or more files to be added to ${name}.`}
|
|
84
|
-
multiple
|
|
84
|
+
multiple
|
|
85
|
+
>
|
|
85
86
|
<i className="fa fa-plus" /> Add Files
|
|
86
87
|
</UpdateFile>
|
|
87
88
|
<UpdateFile
|
|
88
89
|
datasetId={datasetId}
|
|
89
90
|
path={unescapePath(path)}
|
|
90
91
|
tooltip={`Choose a folder to be added to ${name}. Adding a folder with an existing name will overwrite that folder.`}
|
|
91
|
-
directory
|
|
92
|
+
directory
|
|
93
|
+
>
|
|
92
94
|
<i className="fa fa-plus" /> Add Directory
|
|
93
95
|
</UpdateFile>
|
|
94
|
-
{path ===
|
|
95
|
-
bulkDeleteButton
|
|
96
|
-
|
|
97
|
-
<DeleteFile datasetId={datasetId} path={path} />
|
|
98
|
-
)}
|
|
96
|
+
{path === ""
|
|
97
|
+
? bulkDeleteButton
|
|
98
|
+
: <DeleteFile datasetId={datasetId} path={path} />}
|
|
99
99
|
</span>
|
|
100
100
|
</Media>
|
|
101
101
|
)}
|
|
@@ -115,7 +115,7 @@ const FileTree = ({
|
|
|
115
115
|
isFileToBeDeleted={isFileToBeDeleted}
|
|
116
116
|
files={childFiles[file.filename]}
|
|
117
117
|
path={file.filename}
|
|
118
|
-
name={file.filename.split(
|
|
118
|
+
name={file.filename.split(":").pop()}
|
|
119
119
|
bulkDeleteButton={bulkDeleteButton}
|
|
120
120
|
/>
|
|
121
121
|
</li>
|
|
@@ -144,7 +144,7 @@ const FileTree = ({
|
|
|
144
144
|
editMode={editMode}
|
|
145
145
|
toggleFileToDelete={toggleFileToDelete}
|
|
146
146
|
isFileToBeDeleted={isFileToBeDeleted}
|
|
147
|
-
filename={file.filename.split(
|
|
147
|
+
filename={file.filename.split(":").pop()}
|
|
148
148
|
annexKey={file.key}
|
|
149
149
|
datasetPermissions={datasetPermissions}
|
|
150
150
|
annexed={file.annexed}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { Loading } from
|
|
3
|
-
import { apiPath } from
|
|
4
|
-
import FileViewerType from
|
|
1
|
+
import React, { useEffect, useState } from "react"
|
|
2
|
+
import { Loading } from "@openneuro/components/loading"
|
|
3
|
+
import { apiPath } from "./file"
|
|
4
|
+
import FileViewerType from "./file-viewer-type.jsx"
|
|
5
5
|
|
|
6
6
|
const FileView = ({ datasetId, snapshotTag, path }) => {
|
|
7
7
|
const url = apiPath(datasetId, snapshotTag, path)
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import FileViewerText from
|
|
4
|
-
import FileViewerNifti from
|
|
5
|
-
import FileViewerJson from
|
|
6
|
-
import FileViewerTsv from
|
|
7
|
-
import FileViewerCsv from
|
|
8
|
-
import FileViewerHtml from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import FileViewerText from "./viewers/file-viewer-text.jsx"
|
|
4
|
+
import FileViewerNifti from "./viewers/file-viewer-nifti"
|
|
5
|
+
import FileViewerJson from "./viewers/file-viewer-json.jsx"
|
|
6
|
+
import FileViewerTsv from "./viewers/file-viewer-tsv.jsx"
|
|
7
|
+
import FileViewerCsv from "./viewers/file-viewer-csv.jsx"
|
|
8
|
+
import FileViewerHtml from "./viewers/file-viewer-html.jsx"
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Choose the right viewer for each file type
|
|
12
12
|
*/
|
|
13
13
|
const FileViewerType = ({ path, url, data }) => {
|
|
14
14
|
if (
|
|
15
|
-
path.endsWith(
|
|
16
|
-
path.endsWith(
|
|
17
|
-
path.endsWith(
|
|
18
|
-
path.endsWith(
|
|
19
|
-
path.endsWith(
|
|
15
|
+
path.endsWith("README") ||
|
|
16
|
+
path.endsWith("CHANGES") ||
|
|
17
|
+
path.endsWith(".bidsignore") ||
|
|
18
|
+
path.endsWith(".gitignore") ||
|
|
19
|
+
path.endsWith(".txt")
|
|
20
20
|
) {
|
|
21
21
|
return <FileViewerText data={data} />
|
|
22
22
|
} else if (
|
|
23
|
-
path.endsWith(
|
|
24
|
-
path.endsWith(
|
|
25
|
-
path.endsWith(
|
|
26
|
-
path.endsWith(
|
|
23
|
+
path.endsWith(".nii.gz") ||
|
|
24
|
+
path.endsWith(".nii") ||
|
|
25
|
+
path.endsWith(".mgh") ||
|
|
26
|
+
path.endsWith(".mgz")
|
|
27
27
|
) {
|
|
28
28
|
return <FileViewerNifti imageUrl={url} />
|
|
29
|
-
} else if (path.endsWith(
|
|
29
|
+
} else if (path.endsWith(".json")) {
|
|
30
30
|
return <FileViewerJson data={data} />
|
|
31
|
-
} else if (path.endsWith(
|
|
31
|
+
} else if (path.endsWith(".tsv")) {
|
|
32
32
|
return <FileViewerTsv data={data} />
|
|
33
|
-
} else if (path.endsWith(
|
|
33
|
+
} else if (path.endsWith(".csv")) {
|
|
34
34
|
return <FileViewerCsv data={data} />
|
|
35
|
-
} else if (path.endsWith(
|
|
35
|
+
} else if (path.endsWith(".html")) {
|
|
36
36
|
return <FileViewerHtml data={data} />
|
|
37
37
|
} else {
|
|
38
38
|
return (
|