@openneuro/app 4.20.5 → 4.20.6-alpha.3
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,68 +1,68 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import bytes from
|
|
3
|
-
import { Link } from
|
|
4
|
-
import UpdateFile from
|
|
5
|
-
import DeleteFile from
|
|
6
|
-
import { Media } from
|
|
7
|
-
import RemoveAnnexObject from
|
|
8
|
-
import FlagAnnexObject from
|
|
9
|
-
import { isAdmin } from
|
|
10
|
-
import { getProfile, hasEditPermissions } from
|
|
11
|
-
import { Icon } from
|
|
12
|
-
import { Tooltip } from
|
|
13
|
-
import { useCookies } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import bytes from "bytes"
|
|
3
|
+
import { Link } from "react-router-dom"
|
|
4
|
+
import UpdateFile from "../mutations/update-file.jsx"
|
|
5
|
+
import DeleteFile from "../mutations/delete-file.jsx"
|
|
6
|
+
import { Media } from "../../styles/media"
|
|
7
|
+
import RemoveAnnexObject from "../mutations/remove-annex-object.jsx"
|
|
8
|
+
import FlagAnnexObject from "../mutations/flag-annex-object.jsx"
|
|
9
|
+
import { isAdmin } from "../../authentication/admin-user.jsx"
|
|
10
|
+
import { getProfile, hasEditPermissions } from "../../authentication/profile"
|
|
11
|
+
import { Icon } from "@openneuro/components/icon"
|
|
12
|
+
import { Tooltip } from "@openneuro/components/tooltip"
|
|
13
|
+
import { useCookies } from "react-cookie"
|
|
14
14
|
|
|
15
|
-
const filePath = (path, filename) => `${(path && path +
|
|
15
|
+
const filePath = (path, filename) => `${(path && path + ":") || ""}${filename}`
|
|
16
16
|
|
|
17
17
|
const filetypeIcons = {
|
|
18
18
|
md: {
|
|
19
|
-
icon:
|
|
20
|
-
color:
|
|
19
|
+
icon: "fab fa-markdown",
|
|
20
|
+
color: "deepskyblue",
|
|
21
21
|
},
|
|
22
22
|
json: {
|
|
23
|
-
icon:
|
|
24
|
-
color:
|
|
23
|
+
icon: "fab fa-node-js",
|
|
24
|
+
color: "limegreen",
|
|
25
25
|
},
|
|
26
26
|
tsv: {
|
|
27
|
-
icon:
|
|
28
|
-
color:
|
|
27
|
+
icon: "fas fa-file-excel",
|
|
28
|
+
color: "lightgreen",
|
|
29
29
|
},
|
|
30
30
|
csv: {
|
|
31
|
-
icon:
|
|
32
|
-
color:
|
|
31
|
+
icon: "fas fa-file-csv",
|
|
32
|
+
color: "lightgreen",
|
|
33
33
|
},
|
|
34
34
|
nii: {
|
|
35
|
-
icon:
|
|
36
|
-
color:
|
|
35
|
+
icon: "fas fa-brain",
|
|
36
|
+
color: "mediumpurple",
|
|
37
37
|
},
|
|
38
38
|
bval: {
|
|
39
|
-
icon:
|
|
40
|
-
color:
|
|
39
|
+
icon: "fas fa-file-alt",
|
|
40
|
+
color: "cornflowerblue",
|
|
41
41
|
},
|
|
42
42
|
bvec: {
|
|
43
|
-
icon:
|
|
44
|
-
color:
|
|
43
|
+
icon: "fas fa-file-alt",
|
|
44
|
+
color: "cornflowerblue",
|
|
45
45
|
},
|
|
46
46
|
}
|
|
47
47
|
const specialFileIcons = {
|
|
48
48
|
README: filetypeIcons.md,
|
|
49
49
|
CHANGES: {
|
|
50
|
-
icon:
|
|
51
|
-
color:
|
|
50
|
+
icon: "fas fa-file-alt",
|
|
51
|
+
color: "orange",
|
|
52
52
|
},
|
|
53
53
|
LICENSE: {
|
|
54
|
-
icon:
|
|
55
|
-
color:
|
|
54
|
+
icon: "fas fa-file-alt",
|
|
55
|
+
color: "darkslateblue",
|
|
56
56
|
},
|
|
57
57
|
}
|
|
58
58
|
const defaultFileIcon = {
|
|
59
|
-
icon:
|
|
60
|
-
color:
|
|
59
|
+
icon: "fas fa-file",
|
|
60
|
+
color: "black",
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
const fileExtPattern = /\.([0-9a-z]+)(\.gz)?$/i
|
|
64
64
|
|
|
65
|
-
const getFileIcon = filename => {
|
|
65
|
+
const getFileIcon = (filename) => {
|
|
66
66
|
if (Object.keys(specialFileIcons).includes(filename)) {
|
|
67
67
|
return specialFileIcons[filename]
|
|
68
68
|
}
|
|
@@ -75,7 +75,7 @@ const getFileIcon = filename => {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
export const apiPath = (datasetId, snapshotTag, filePath) => {
|
|
78
|
-
const snapshotPath = snapshotTag ? `/snapshots/${snapshotTag}` :
|
|
78
|
+
const snapshotPath = snapshotTag ? `/snapshots/${snapshotTag}` : ""
|
|
79
79
|
return `/crn/datasets/${datasetId}${snapshotPath}/files/${filePath}`
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -121,12 +121,15 @@ const File = ({
|
|
|
121
121
|
urls,
|
|
122
122
|
}: FileProps): JSX.Element => {
|
|
123
123
|
const { icon, color } = getFileIcon(filename)
|
|
124
|
-
const snapshotVersionPath = snapshotTag ? `/versions/${snapshotTag}` :
|
|
124
|
+
const snapshotVersionPath = snapshotTag ? `/versions/${snapshotTag}` : ""
|
|
125
125
|
// React route to display the file
|
|
126
|
-
const viewerPath =
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
const viewerPath =
|
|
127
|
+
`/datasets/${datasetId}${snapshotVersionPath}/file-display/${
|
|
128
|
+
filePath(
|
|
129
|
+
path,
|
|
130
|
+
filename,
|
|
131
|
+
)
|
|
132
|
+
}`
|
|
130
133
|
const [cookies] = useCookies()
|
|
131
134
|
const user = getProfile(cookies)
|
|
132
135
|
return (
|
|
@@ -137,15 +140,15 @@ const File = ({
|
|
|
137
140
|
<span className="filetree-editfile">
|
|
138
141
|
<Media greaterThanOrEqual="medium">
|
|
139
142
|
<Tooltip
|
|
140
|
-
tooltip={`Download: ${bytes.format(Number(size)) as string}`}
|
|
143
|
+
tooltip={`Download: ${bytes.format(Number(size)) as string}`}
|
|
144
|
+
>
|
|
141
145
|
<span className="edit-file download-file">
|
|
142
146
|
<a
|
|
143
|
-
href={
|
|
144
|
-
|
|
145
|
-
apiPath(datasetId, snapshotTag, filePath(path, filename))
|
|
146
|
-
}
|
|
147
|
+
href={urls?.[0] ||
|
|
148
|
+
apiPath(datasetId, snapshotTag, filePath(path, filename))}
|
|
147
149
|
download
|
|
148
|
-
aria-label="download file"
|
|
150
|
+
aria-label="download file"
|
|
151
|
+
>
|
|
149
152
|
<i className="fa fa-download" />
|
|
150
153
|
</a>
|
|
151
154
|
</span>
|
|
@@ -167,7 +170,7 @@ const File = ({
|
|
|
167
170
|
</Tooltip>
|
|
168
171
|
</Media>
|
|
169
172
|
)}
|
|
170
|
-
{editMode && filename !==
|
|
173
|
+
{editMode && filename !== "dataset_description.json" && (
|
|
171
174
|
<>
|
|
172
175
|
<Media greaterThanOrEqual="medium">
|
|
173
176
|
<Tooltip tooltip="Delete">
|
|
@@ -180,24 +183,22 @@ const File = ({
|
|
|
180
183
|
</Media>
|
|
181
184
|
<Media greaterThanOrEqual="medium">
|
|
182
185
|
<Tooltip
|
|
183
|
-
tooltip={
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}>
|
|
186
|
+
tooltip={isFileToBeDeleted(id)
|
|
187
|
+
? "Added to Bulk Delete"
|
|
188
|
+
: "Add to Bulk Delete"}
|
|
189
|
+
>
|
|
188
190
|
<div
|
|
189
|
-
className={
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}>
|
|
191
|
+
className={isFileToBeDeleted(id)
|
|
192
|
+
? "added-to-bd bulk-delete-checkbox-group delete-file"
|
|
193
|
+
: "bulk-delete-checkbox-group delete-file"}
|
|
194
|
+
>
|
|
194
195
|
<input
|
|
195
|
-
id={
|
|
196
|
+
id={"cb-" + filename}
|
|
196
197
|
type="checkbox"
|
|
197
198
|
checked={isFileToBeDeleted(id)}
|
|
198
199
|
onChange={() => toggleFileToDelete({ id, path, filename })}
|
|
199
200
|
/>
|
|
200
|
-
<label htmlFor={
|
|
201
|
+
<label htmlFor={"cb-" + filename}>
|
|
201
202
|
<Icon icon="fas fa-dumpster" />
|
|
202
203
|
{isFileToBeDeleted(id) && (
|
|
203
204
|
<span className="added-to-bulk">Added</span>
|
|
@@ -211,26 +212,30 @@ const File = ({
|
|
|
211
212
|
|
|
212
213
|
{!isMobile &&
|
|
213
214
|
annexed &&
|
|
214
|
-
(isAdmin()
|
|
215
|
-
|
|
216
|
-
<
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
215
|
+
(isAdmin()
|
|
216
|
+
? (
|
|
217
|
+
<Media greaterThanOrEqual="medium">
|
|
218
|
+
<RemoveAnnexObject
|
|
219
|
+
datasetId={datasetId}
|
|
220
|
+
snapshot={snapshotTag}
|
|
221
|
+
annexKey={annexKey}
|
|
222
|
+
path={path}
|
|
223
|
+
filename={filename}
|
|
224
|
+
/>
|
|
225
|
+
</Media>
|
|
226
|
+
)
|
|
227
|
+
: hasEditPermissions(datasetPermissions, user && user.sub)
|
|
228
|
+
? (
|
|
229
|
+
<Media greaterThanOrEqual="medium">
|
|
230
|
+
<FlagAnnexObject
|
|
231
|
+
datasetId={datasetId}
|
|
232
|
+
snapshot={snapshotTag}
|
|
233
|
+
filepath={filePath(path, filename)}
|
|
234
|
+
annexKey={annexKey}
|
|
235
|
+
/>
|
|
236
|
+
</Media>
|
|
237
|
+
)
|
|
238
|
+
: null)}
|
|
234
239
|
</span>
|
|
235
240
|
</>
|
|
236
241
|
)
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import FileTree from
|
|
4
|
-
import { Media } from
|
|
5
|
-
import {
|
|
6
|
-
import { WarnButton } from
|
|
7
|
-
import { AccordionWrap } from
|
|
8
|
-
import styled from
|
|
9
|
-
import { Tooltip } from
|
|
10
|
-
import { DatasetFile } from
|
|
11
|
-
import bytes from
|
|
1
|
+
import React, { useState } from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import FileTree from "./file-tree"
|
|
4
|
+
import { Media } from "../../styles/media"
|
|
5
|
+
import { gql, useMutation } from "@apollo/client"
|
|
6
|
+
import { WarnButton } from "@openneuro/components/warn-button"
|
|
7
|
+
import { AccordionWrap } from "@openneuro/components/accordion"
|
|
8
|
+
import styled from "@emotion/styled"
|
|
9
|
+
import { Tooltip } from "@openneuro/components/tooltip"
|
|
10
|
+
import { DatasetFile } from "../../types/dataset-file"
|
|
11
|
+
import bytes from "bytes"
|
|
12
12
|
|
|
13
13
|
const FileTreeMeta = styled.span`
|
|
14
14
|
position: absolute;
|
|
@@ -59,7 +59,7 @@ const Files = ({
|
|
|
59
59
|
const isFileToBeDeleted = (id: string): boolean => id in filesToDelete
|
|
60
60
|
|
|
61
61
|
const toggleFileToDelete = ({ id, path, filename }): void =>
|
|
62
|
-
setFilesToDelete(prevFilesToDelete => {
|
|
62
|
+
setFilesToDelete((prevFilesToDelete) => {
|
|
63
63
|
if (isFileToBeDeleted(id)) {
|
|
64
64
|
delete prevFilesToDelete[id]
|
|
65
65
|
return { ...prevFilesToDelete }
|
|
@@ -84,30 +84,31 @@ const Files = ({
|
|
|
84
84
|
|
|
85
85
|
const disableBtn = Object.values(filesToDelete).length ? null : true
|
|
86
86
|
const filesCount = Object.values(filesToDelete).length
|
|
87
|
-
const bulkDeleteButton =
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
87
|
+
const bulkDeleteButton = editMode &&
|
|
88
|
+
(isDeleting
|
|
89
|
+
? <span>Deleting...</span>
|
|
90
|
+
: (
|
|
91
|
+
<span className="delete-file bulk-delete">
|
|
92
|
+
<span className="bulk-delete-count">
|
|
93
|
+
{disableBtn
|
|
94
|
+
? (
|
|
95
|
+
<Tooltip tooltip="Click the dumpster icon to add files to Bulk Delete">
|
|
96
|
+
<b>Bulk Delete (0)</b>
|
|
97
|
+
</Tooltip>
|
|
98
|
+
)
|
|
99
|
+
: (
|
|
100
|
+
<WarnButton
|
|
101
|
+
message={`Bulk Delete (${filesCount})`}
|
|
102
|
+
icon="fas fa-dumpster"
|
|
103
|
+
iconOnly={true}
|
|
104
|
+
className="edit-file"
|
|
105
|
+
tooltip={`Delete ${filesCount}`}
|
|
106
|
+
onConfirmedClick={bulkDelete}
|
|
107
|
+
/>
|
|
108
|
+
)}
|
|
109
|
+
</span>
|
|
108
110
|
</span>
|
|
109
|
-
|
|
110
|
-
))
|
|
111
|
+
))
|
|
111
112
|
return (
|
|
112
113
|
<StyleWrapper>
|
|
113
114
|
<AccordionWrap className="filetree-wrapper">
|
|
@@ -116,7 +117,7 @@ const Files = ({
|
|
|
116
117
|
<FileTree
|
|
117
118
|
datasetId={datasetId}
|
|
118
119
|
snapshotTag={snapshotTag}
|
|
119
|
-
path={
|
|
120
|
+
path={""}
|
|
120
121
|
files={files}
|
|
121
122
|
name={datasetName}
|
|
122
123
|
editMode={editMode}
|
|
@@ -132,16 +133,16 @@ const Files = ({
|
|
|
132
133
|
<div className="filetree-item">
|
|
133
134
|
{summary && (
|
|
134
135
|
<FileTreeMeta>
|
|
135
|
-
<FileTreeMetaLabel>Files:</FileTreeMetaLabel>{
|
|
136
|
-
{summary.totalFiles}{
|
|
137
|
-
<FileTreeMetaLabel>Size:</FileTreeMetaLabel>{
|
|
136
|
+
<FileTreeMetaLabel>Files:</FileTreeMetaLabel>{" "}
|
|
137
|
+
{summary.totalFiles}{" "}
|
|
138
|
+
<FileTreeMetaLabel>Size:</FileTreeMetaLabel>{" "}
|
|
138
139
|
{bytes(summary.size)}
|
|
139
140
|
</FileTreeMeta>
|
|
140
141
|
)}
|
|
141
142
|
<FileTree
|
|
142
143
|
datasetId={datasetId}
|
|
143
144
|
snapshotTag={snapshotTag}
|
|
144
|
-
path={
|
|
145
|
+
path={""}
|
|
145
146
|
files={files}
|
|
146
147
|
name={datasetName}
|
|
147
148
|
editMode={editMode}
|
package/src/scripts/dataset/files/viewers/__tests__/__snapshots__/file-viewer-json.spec.jsx.snap
CHANGED
|
@@ -1,29 +1,5 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`File Viewer - JSON > renders with invalid JSON 1`] = `
|
|
4
|
-
<DocumentFragment>
|
|
5
|
-
<h3>
|
|
6
|
-
Tree
|
|
7
|
-
</h3>
|
|
8
|
-
<hr />
|
|
9
|
-
<p>
|
|
10
|
-
JSON failed to parse
|
|
11
|
-
</p>
|
|
12
|
-
<pre>
|
|
13
|
-
Unexpected token ; in JSON at position 4
|
|
14
|
-
</pre>
|
|
15
|
-
<h3>
|
|
16
|
-
Raw
|
|
17
|
-
</h3>
|
|
18
|
-
<hr />
|
|
19
|
-
<pre
|
|
20
|
-
class="css-ffm88e"
|
|
21
|
-
>
|
|
22
|
-
1234;
|
|
23
|
-
</pre>
|
|
24
|
-
</DocumentFragment>
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
3
|
exports[`File Viewer - JSON > renders with valid JSON 1`] = `
|
|
28
4
|
<DocumentFragment>
|
|
29
5
|
<h3>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render } from
|
|
3
|
-
import { FileViewerJsonRaw } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { render, screen } from "@testing-library/react"
|
|
3
|
+
import { FileViewerJsonRaw } from "../file-viewer-json.jsx"
|
|
4
4
|
|
|
5
|
-
describe(
|
|
6
|
-
it(
|
|
7
|
-
const validJson = JSON.stringify({ thing: 1, name:
|
|
5
|
+
describe("File Viewer - JSON", () => {
|
|
6
|
+
it("renders with valid JSON", () => {
|
|
7
|
+
const validJson = JSON.stringify({ thing: 1, name: "string" })
|
|
8
8
|
const { asFragment } = render(<FileViewerJsonRaw jsonRaw={validJson} />)
|
|
9
9
|
expect(asFragment()).toMatchSnapshot()
|
|
10
10
|
})
|
|
11
|
-
it(
|
|
12
|
-
|
|
13
|
-
expect(
|
|
11
|
+
it("renders with invalid JSON", () => {
|
|
12
|
+
render(<FileViewerJsonRaw jsonRaw="1234;" />)
|
|
13
|
+
expect(screen.getByText("JSON failed to parse")).toBeInTheDocument()
|
|
14
14
|
})
|
|
15
15
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import parseTabular from
|
|
1
|
+
import parseTabular from "../parse-tabular.js"
|
|
2
2
|
|
|
3
3
|
const demoCsv = `participant_id,age,sex
|
|
4
4
|
sub-01,M,28
|
|
@@ -11,14 +11,14 @@ sub-01 M 28
|
|
|
11
11
|
sub-02 F 30
|
|
12
12
|
`
|
|
13
13
|
|
|
14
|
-
describe(
|
|
15
|
-
it(
|
|
16
|
-
expect(Array.isArray(parseTabular(demoCsv,
|
|
14
|
+
describe("parseTabular()", () => {
|
|
15
|
+
it("returns an array", () => {
|
|
16
|
+
expect(Array.isArray(parseTabular(demoCsv, ","))).toBe(true)
|
|
17
17
|
})
|
|
18
|
-
it(
|
|
19
|
-
expect(parseTabular(demoCsv,
|
|
18
|
+
it("returns the expected number of data rows", () => {
|
|
19
|
+
expect(parseTabular(demoCsv, ",")).toHaveLength(3)
|
|
20
20
|
})
|
|
21
|
-
it(
|
|
22
|
-
expect(parseTabular(demoTsv,
|
|
21
|
+
it("works with tab separators", () => {
|
|
22
|
+
expect(parseTabular(demoTsv, "\t")).toHaveLength(2)
|
|
23
23
|
})
|
|
24
24
|
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import parseTabular from
|
|
4
|
-
import FileViewerTable from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import parseTabular from "./parse-tabular.js"
|
|
4
|
+
import FileViewerTable from "./file-viewer-table"
|
|
5
5
|
|
|
6
6
|
const FileViewerCsv = ({ data }) => {
|
|
7
7
|
const decoder = new TextDecoder()
|
|
8
|
-
const tableData = parseTabular(decoder.decode(data),
|
|
8
|
+
const tableData = parseTabular(decoder.decode(data), ",")
|
|
9
9
|
return <FileViewerTable tableData={tableData} />
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import styled from
|
|
4
|
-
import { RecursiveProperty } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import styled from "@emotion/styled"
|
|
4
|
+
import { RecursiveProperty } from "@openneuro/components/json-tree"
|
|
5
5
|
|
|
6
6
|
const WrappedPre = styled.pre`
|
|
7
7
|
white-space: pre-wrap;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import { Niivue } from
|
|
1
|
+
import React, { useEffect, useRef } from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import { Niivue } from "@niivue/niivue"
|
|
4
4
|
|
|
5
5
|
const FileViewerNifti = ({
|
|
6
6
|
imageUrl,
|
|
@@ -12,7 +12,7 @@ const FileViewerNifti = ({
|
|
|
12
12
|
const volumeList = [
|
|
13
13
|
{
|
|
14
14
|
url: imageUrl,
|
|
15
|
-
colorMap:
|
|
15
|
+
colorMap: "gray",
|
|
16
16
|
opacity: 1,
|
|
17
17
|
visible: true,
|
|
18
18
|
limitFrames4D: 5,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { DataTable } from
|
|
3
|
-
import styled from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { DataTable } from "../../../components/data-table"
|
|
3
|
+
import styled from "@emotion/styled"
|
|
4
4
|
|
|
5
5
|
const TableOverlow = styled.div`
|
|
6
6
|
overflow-x: scroll;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import parseTabular from
|
|
4
|
-
import FileViewerTable from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import parseTabular from "./parse-tabular.js"
|
|
4
|
+
import FileViewerTable from "./file-viewer-table"
|
|
5
5
|
|
|
6
6
|
const FileViewerTsv = ({ data }) => {
|
|
7
7
|
const decoder = new TextDecoder()
|
|
8
|
-
const tableData = parseTabular(decoder.decode(data),
|
|
8
|
+
const tableData = parseTabular(decoder.decode(data), "\t")
|
|
9
9
|
return <FileViewerTable tableData={tableData} />
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
const parseTabular = (data, separator) => {
|
|
2
|
-
const rows = data.split(
|
|
2
|
+
const rows = data.split("\n")
|
|
3
3
|
// Remove any whitespace rows (usually trailing)
|
|
4
|
-
const trimmedRows = rows.filter(row => !/^\s*$/.test(row))
|
|
4
|
+
const trimmedRows = rows.filter((row) => !/^\s*$/.test(row))
|
|
5
5
|
// remove header from rows
|
|
6
6
|
const header = trimmedRows.shift().split(separator)
|
|
7
7
|
|
|
8
|
-
return trimmedRows.map(row =>
|
|
8
|
+
return trimmedRows.map((row) =>
|
|
9
9
|
row
|
|
10
10
|
.split(separator)
|
|
11
11
|
.reduce(
|
|
12
12
|
(rowObj, col, colIndex) => ((rowObj[header[colIndex]] = col), rowObj),
|
|
13
13
|
{},
|
|
14
|
-
)
|
|
14
|
+
)
|
|
15
15
|
)
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render } from
|
|
3
|
-
import { CancelButton } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { render } from "@testing-library/react"
|
|
3
|
+
import { CancelButton } from "../cancel-button"
|
|
4
4
|
|
|
5
|
-
describe(
|
|
6
|
-
it(
|
|
5
|
+
describe("CancelButton component", () => {
|
|
6
|
+
it("renders with default props", () => {
|
|
7
7
|
const { asFragment } = render(<CancelButton action={() => {}} />)
|
|
8
8
|
expect(asFragment()).toMatchSnapshot()
|
|
9
9
|
})
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render, screen } from
|
|
3
|
-
import { MemoryRouter } from
|
|
4
|
-
import { DatasetAlertDraft } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { render, screen } from "@testing-library/react"
|
|
3
|
+
import { MemoryRouter } from "react-router-dom"
|
|
4
|
+
import { DatasetAlertDraft } from "../dataset-alert-draft"
|
|
5
5
|
|
|
6
|
-
describe(
|
|
7
|
-
it(
|
|
6
|
+
describe("DatasetAlertDraft component", () => {
|
|
7
|
+
it("renders the correct text for private drafts with changes", () => {
|
|
8
8
|
render(
|
|
9
9
|
<DatasetAlertDraft
|
|
10
10
|
isPrivate
|
|
@@ -19,7 +19,7 @@ describe('DatasetAlertDraft component', () => {
|
|
|
19
19
|
screen.queryByText(/there have been changes to the draft/i),
|
|
20
20
|
).toBeInTheDocument()
|
|
21
21
|
})
|
|
22
|
-
it(
|
|
22
|
+
it("renders the correct text for private drafts with no snapshots", () => {
|
|
23
23
|
render(
|
|
24
24
|
<DatasetAlertDraft
|
|
25
25
|
isPrivate
|
|
@@ -34,7 +34,7 @@ describe('DatasetAlertDraft component', () => {
|
|
|
34
34
|
screen.queryByText(/before it can be published/i),
|
|
35
35
|
).toBeInTheDocument()
|
|
36
36
|
})
|
|
37
|
-
it(
|
|
37
|
+
it("renders the correct text for public drafts with changes", () => {
|
|
38
38
|
render(
|
|
39
39
|
<DatasetAlertDraft
|
|
40
40
|
hasDraftChanges
|
|
@@ -51,7 +51,7 @@ describe('DatasetAlertDraft component', () => {
|
|
|
51
51
|
screen.queryByText(/there are currently unsaved changes to this draft/i),
|
|
52
52
|
).toBeInTheDocument()
|
|
53
53
|
})
|
|
54
|
-
it(
|
|
54
|
+
it("renders the correct text for public drafts without changes", () => {
|
|
55
55
|
render(
|
|
56
56
|
<DatasetAlertDraft
|
|
57
57
|
hasDraftChanges={false}
|