@openneuro/app 4.20.4 → 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,11 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
3
|
|
|
4
4
|
const UploadStepCol = ({ active, text }) => {
|
|
5
5
|
const activeClasses = active
|
|
6
|
-
? [
|
|
7
|
-
: [
|
|
8
|
-
return <div className={
|
|
6
|
+
? ["upload-step", "upload-step-active"]
|
|
7
|
+
: ["upload-step"]
|
|
8
|
+
return <div className={"col col-3 " + activeClasses.join(" ")}>{text}</div>
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
UploadStepCol.propTypes = {
|
|
@@ -17,19 +17,19 @@ const UploadStep = ({ location }) => (
|
|
|
17
17
|
<div className="grid">
|
|
18
18
|
<UploadStepCol
|
|
19
19
|
text="Step 1: Select Files"
|
|
20
|
-
active={location.pathname ===
|
|
20
|
+
active={location.pathname === "/upload"}
|
|
21
21
|
/>
|
|
22
22
|
<UploadStepCol
|
|
23
23
|
text="Step 2: Validation"
|
|
24
|
-
active={location.pathname ===
|
|
24
|
+
active={location.pathname === "/upload/issues"}
|
|
25
25
|
/>
|
|
26
26
|
<UploadStepCol
|
|
27
27
|
text="Step 3: Metadata"
|
|
28
|
-
active={location.pathname ===
|
|
28
|
+
active={location.pathname === "/upload/metadata"}
|
|
29
29
|
/>
|
|
30
30
|
<UploadStepCol
|
|
31
31
|
text="Step 4: Accept Terms"
|
|
32
|
-
active={location.pathname ===
|
|
32
|
+
active={location.pathname === "/upload/disclaimer"}
|
|
33
33
|
/>
|
|
34
34
|
</div>
|
|
35
35
|
)
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import { Modal } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import { Modal } from "@openneuro/components/modal"
|
|
4
4
|
|
|
5
5
|
// Show is always {true} because the router unmounts this otherwise
|
|
6
6
|
const UploaderModal = ({ setLocation, location, children, footer }) => (
|
|
7
7
|
<Modal
|
|
8
|
-
isOpen={location.pathname !==
|
|
9
|
-
toggle={() => setLocation(
|
|
10
|
-
closeText={
|
|
11
|
-
className="upload-modal"
|
|
8
|
+
isOpen={location.pathname !== "/hidden" ? true : false}
|
|
9
|
+
toggle={() => setLocation("/hidden")}
|
|
10
|
+
closeText={"close"}
|
|
11
|
+
className="upload-modal"
|
|
12
|
+
>
|
|
12
13
|
<h3>Upload Dataset</h3>
|
|
13
14
|
{children}
|
|
14
15
|
{footer ? footer : null}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import { Route, Routes } from
|
|
4
|
-
import UploaderModal from
|
|
5
|
-
import UploadStep from
|
|
6
|
-
import UploadSelect from
|
|
7
|
-
import UploadIssues from
|
|
8
|
-
import UploadMetadata from
|
|
9
|
-
import UploadDisclaimer from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import { Route, Routes } from "react-router-dom"
|
|
4
|
+
import UploaderModal from "./uploader-modal.jsx"
|
|
5
|
+
import UploadStep from "./upload-step.jsx"
|
|
6
|
+
import UploadSelect from "./upload-select.jsx"
|
|
7
|
+
import UploadIssues from "./upload-issues.jsx"
|
|
8
|
+
import UploadMetadata from "./upload-metadata.jsx"
|
|
9
|
+
import UploadDisclaimer from "./upload-disclaimer.jsx"
|
|
10
10
|
|
|
11
|
-
const UploaderSetupRoutes = props => (
|
|
11
|
+
const UploaderSetupRoutes = (props) => (
|
|
12
12
|
<UploaderModal {...props}>
|
|
13
13
|
<UploadStep location={props.location} />
|
|
14
14
|
<div className="tasks-col fade-in">
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import { Route, Routes } from
|
|
4
|
-
import UploaderModal from
|
|
5
|
-
import UploadStatus from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import { Route, Routes } from "react-router-dom"
|
|
4
|
+
import UploaderModal from "./uploader-modal.jsx"
|
|
5
|
+
import UploadStatus from "./upload-status.jsx"
|
|
6
6
|
|
|
7
|
-
const UploaderStatusRoutes = props => (
|
|
7
|
+
const UploaderStatusRoutes = (props) => (
|
|
8
8
|
<UploaderModal {...props}>
|
|
9
9
|
<div className="tasks-col fade-in">
|
|
10
10
|
<div id="upload-tabs" className="uploader">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import BlockNavigation from
|
|
3
|
-
import UploaderSetupRoutes from
|
|
4
|
-
import UploaderStatusRoutes from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import BlockNavigation from "../common/partials/block-navigation.jsx"
|
|
3
|
+
import UploaderSetupRoutes from "./uploader-setup-routes.jsx"
|
|
4
|
+
import UploaderStatusRoutes from "./uploader-status-routes.jsx"
|
|
5
5
|
|
|
6
6
|
const UploaderView = ({ uploader }) => {
|
|
7
7
|
if (uploader.uploading) {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { apm } from
|
|
2
|
-
import { toast } from
|
|
3
|
-
import ToastContent from
|
|
4
|
-
import React from
|
|
5
|
-
import PropTypes from
|
|
6
|
-
import { ApolloConsumer } from
|
|
7
|
-
import * as gtag from
|
|
8
|
-
import UploaderContext from
|
|
9
|
-
import FileSelect from
|
|
10
|
-
import { locationFactory } from
|
|
11
|
-
import * as mutation from
|
|
12
|
-
import { datasets, uploads } from
|
|
13
|
-
import { useNavigate } from
|
|
14
|
-
import { uploadFiles } from
|
|
15
|
-
import { UploadProgress } from
|
|
16
|
-
import { addPathToFiles } from
|
|
1
|
+
import { apm } from "../apm"
|
|
2
|
+
import { toast } from "react-toastify"
|
|
3
|
+
import ToastContent from "../common/partials/toast-content.jsx"
|
|
4
|
+
import React from "react"
|
|
5
|
+
import PropTypes from "prop-types"
|
|
6
|
+
import { ApolloConsumer } from "@apollo/client"
|
|
7
|
+
import * as gtag from "../utils/gtag"
|
|
8
|
+
import UploaderContext from "./uploader-context.js"
|
|
9
|
+
import FileSelect from "./file-select"
|
|
10
|
+
import { locationFactory } from "./uploader-location.js"
|
|
11
|
+
import * as mutation from "./upload-mutation.js"
|
|
12
|
+
import { datasets, uploads } from "@openneuro/client"
|
|
13
|
+
import { useNavigate } from "react-router-dom"
|
|
14
|
+
import { uploadFiles } from "./file-upload.js"
|
|
15
|
+
import { UploadProgress } from "./upload-progress-class"
|
|
16
|
+
import { addPathToFiles } from "./add-path-to-files.js"
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Stateful uploader workflow and status
|
|
@@ -29,13 +29,13 @@ export class UploadClient extends React.Component {
|
|
|
29
29
|
// An upload is processing
|
|
30
30
|
uploading: false,
|
|
31
31
|
// Which step in the modal
|
|
32
|
-
location: locationFactory(
|
|
32
|
+
location: locationFactory("/hidden"),
|
|
33
33
|
// List of files being uploaded
|
|
34
34
|
files: [],
|
|
35
35
|
// Files selected, regardless of if they will be uploaded
|
|
36
36
|
selectedFiles: {},
|
|
37
37
|
// Relabel dataset during upload
|
|
38
|
-
name:
|
|
38
|
+
name: "",
|
|
39
39
|
// Dataset description - null if it doesn't exist
|
|
40
40
|
description: null,
|
|
41
41
|
progress: 0,
|
|
@@ -79,7 +79,7 @@ export class UploadClient extends React.Component {
|
|
|
79
79
|
*
|
|
80
80
|
* @param {string} path Virtual router path for upload modal
|
|
81
81
|
*/
|
|
82
|
-
setLocation = path => {
|
|
82
|
+
setLocation = (path) => {
|
|
83
83
|
gtag.pageview(path)
|
|
84
84
|
this.setState({ location: locationFactory(path) })
|
|
85
85
|
}
|
|
@@ -145,16 +145,16 @@ export class UploadClient extends React.Component {
|
|
|
145
145
|
*/
|
|
146
146
|
selectFiles = ({ files }) => {
|
|
147
147
|
// First get the name from dataset_description.json
|
|
148
|
-
return new Promise(resolve => {
|
|
148
|
+
return new Promise((resolve) => {
|
|
149
149
|
const descriptionFile = [...files].find(
|
|
150
|
-
f => f.name ===
|
|
150
|
+
(f) => f.name === "dataset_description.json",
|
|
151
151
|
)
|
|
152
152
|
if (!descriptionFile) {
|
|
153
153
|
// Use directory name if no dataset_description
|
|
154
|
-
resolve(files[0].webkitRelativePath.split(
|
|
154
|
+
resolve(files[0].webkitRelativePath.split("/")[0])
|
|
155
155
|
}
|
|
156
156
|
const descriptionReader = new FileReader()
|
|
157
|
-
descriptionReader.onload = event => {
|
|
157
|
+
descriptionReader.onload = (event) => {
|
|
158
158
|
try {
|
|
159
159
|
// Read Name field from dataset_description.json
|
|
160
160
|
const description = JSON.parse(event.target.result.toString())
|
|
@@ -163,25 +163,25 @@ export class UploadClient extends React.Component {
|
|
|
163
163
|
resolve(description.Name)
|
|
164
164
|
} catch (e) {
|
|
165
165
|
// Fallback to directory name if JSON parse failed
|
|
166
|
-
resolve(files[0].webkitRelativePath.split(
|
|
166
|
+
resolve(files[0].webkitRelativePath.split("/")[0])
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
descriptionReader.readAsText(descriptionFile)
|
|
170
|
-
}).then(name => {
|
|
170
|
+
}).then((name) => {
|
|
171
171
|
if (files.length > 0) {
|
|
172
172
|
this.setState({
|
|
173
173
|
files,
|
|
174
174
|
selectedFiles: files,
|
|
175
175
|
name,
|
|
176
176
|
})
|
|
177
|
-
this.setLocation(
|
|
177
|
+
this.setLocation("/upload/issues")
|
|
178
178
|
} else {
|
|
179
|
-
throw new Error(
|
|
179
|
+
throw new Error("No files selected")
|
|
180
180
|
}
|
|
181
181
|
})
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
captureMetadata = metadata => {
|
|
184
|
+
captureMetadata = (metadata) => {
|
|
185
185
|
this.setState({
|
|
186
186
|
metadata,
|
|
187
187
|
})
|
|
@@ -196,15 +196,15 @@ export class UploadClient extends React.Component {
|
|
|
196
196
|
upload = ({ affirmedDefaced, affirmedConsent }) => {
|
|
197
197
|
// Track the start of uploads
|
|
198
198
|
gtag.event({
|
|
199
|
-
category:
|
|
200
|
-
action:
|
|
199
|
+
category: "Upload",
|
|
200
|
+
action: "Started web upload",
|
|
201
201
|
label: this.state.datasetId,
|
|
202
202
|
})
|
|
203
203
|
this.setState({
|
|
204
204
|
uploading: true,
|
|
205
205
|
abortController: new AbortController(),
|
|
206
206
|
})
|
|
207
|
-
this.setLocation(
|
|
207
|
+
this.setLocation("/hidden")
|
|
208
208
|
if (this.state.resume && this.state.datasetId) {
|
|
209
209
|
// Just add files since this is an existing dataset
|
|
210
210
|
this._addFiles()
|
|
@@ -215,14 +215,14 @@ export class UploadClient extends React.Component {
|
|
|
215
215
|
affirmedDefaced,
|
|
216
216
|
affirmedConsent,
|
|
217
217
|
})
|
|
218
|
-
.then(datasetId => {
|
|
218
|
+
.then((datasetId) => {
|
|
219
219
|
// Note chain to this._addFiles
|
|
220
220
|
this.setState({ datasetId }, () => {
|
|
221
221
|
this.uploadMetadata()
|
|
222
222
|
this._addFiles()
|
|
223
223
|
})
|
|
224
224
|
})
|
|
225
|
-
.catch(error => {
|
|
225
|
+
.catch((error) => {
|
|
226
226
|
apm.captureError(error)
|
|
227
227
|
toast.error(
|
|
228
228
|
<ToastContent
|
|
@@ -235,7 +235,7 @@ export class UploadClient extends React.Component {
|
|
|
235
235
|
error,
|
|
236
236
|
uploading: false,
|
|
237
237
|
})
|
|
238
|
-
this.setLocation(
|
|
238
|
+
this.setLocation("/hidden")
|
|
239
239
|
})
|
|
240
240
|
}
|
|
241
241
|
}
|
|
@@ -246,17 +246,17 @@ export class UploadClient extends React.Component {
|
|
|
246
246
|
_includeChanges() {
|
|
247
247
|
const files = [...this.state.files]
|
|
248
248
|
// Determine if the files list has a CHANGES file already
|
|
249
|
-
const hasChanges = files.some(f => f.name ===
|
|
249
|
+
const hasChanges = files.some((f) => f.name === "CHANGES")
|
|
250
250
|
|
|
251
251
|
// Do nothing if the file already exists
|
|
252
252
|
if (hasChanges) return files
|
|
253
253
|
|
|
254
254
|
// Construct the initial CHANGES file and add to the files array
|
|
255
255
|
const initialChangesFile = new Blob([], {
|
|
256
|
-
type:
|
|
256
|
+
type: "text/plain",
|
|
257
257
|
})
|
|
258
|
-
initialChangesFile.name =
|
|
259
|
-
initialChangesFile.webkitRelativePath =
|
|
258
|
+
initialChangesFile.name = "CHANGES"
|
|
259
|
+
initialChangesFile.webkitRelativePath = "/CHANGES"
|
|
260
260
|
files.push(initialChangesFile)
|
|
261
261
|
return files
|
|
262
262
|
}
|
|
@@ -305,9 +305,10 @@ export class UploadClient extends React.Component {
|
|
|
305
305
|
const toastId = toast.error(
|
|
306
306
|
<ToastContent
|
|
307
307
|
title="Dataset upload failed"
|
|
308
|
-
body="Please check your connection"
|
|
308
|
+
body="Please check your connection"
|
|
309
|
+
>
|
|
309
310
|
<FileSelect
|
|
310
|
-
onChange={event => {
|
|
311
|
+
onChange={(event) => {
|
|
311
312
|
toast.dismiss(toastId)
|
|
312
313
|
this.resumeDataset(this.state.datasetId)(event)
|
|
313
314
|
}}
|
|
@@ -320,7 +321,7 @@ export class UploadClient extends React.Component {
|
|
|
320
321
|
error,
|
|
321
322
|
uploading: false,
|
|
322
323
|
})
|
|
323
|
-
this.setLocation(
|
|
324
|
+
this.setLocation("/hidden")
|
|
324
325
|
if (this.state.xhr) {
|
|
325
326
|
try {
|
|
326
327
|
this.state.xhr.abort()
|
|
@@ -334,19 +335,20 @@ export class UploadClient extends React.Component {
|
|
|
334
335
|
uploadCompleteAction = () => {
|
|
335
336
|
// Record upload finished successfully with Google Analytics
|
|
336
337
|
gtag.event({
|
|
337
|
-
category:
|
|
338
|
-
action:
|
|
338
|
+
category: "Upload",
|
|
339
|
+
action: "Finished web upload",
|
|
339
340
|
label: this.state.datasetId,
|
|
340
341
|
})
|
|
341
342
|
const datasetURL = `/datasets/${this.state.datasetId}`
|
|
342
|
-
if (this.state.location.pathname !== locationFactory(
|
|
343
|
+
if (this.state.location.pathname !== locationFactory("/hidden").pathname) {
|
|
343
344
|
this.props.navigate(datasetURL)
|
|
344
|
-
this.setLocation(
|
|
345
|
+
this.setLocation("/hidden")
|
|
345
346
|
} else {
|
|
346
347
|
toast.success(
|
|
347
348
|
<ToastContent
|
|
348
349
|
title="Upload complete"
|
|
349
|
-
body="Dataset successfully uploaded"
|
|
350
|
+
body="Dataset successfully uploaded"
|
|
351
|
+
>
|
|
350
352
|
<a href={datasetURL}>Click here to browse your dataset.</a>
|
|
351
353
|
</ToastContent>,
|
|
352
354
|
{ autoClose: false },
|
|
@@ -354,7 +356,7 @@ export class UploadClient extends React.Component {
|
|
|
354
356
|
}
|
|
355
357
|
}
|
|
356
358
|
|
|
357
|
-
uploadProgress = state => {
|
|
359
|
+
uploadProgress = (state) => {
|
|
358
360
|
this.setState(state)
|
|
359
361
|
}
|
|
360
362
|
|
|
@@ -394,7 +396,7 @@ UploadClient.propTypes = {
|
|
|
394
396
|
|
|
395
397
|
const Uploader = ({ children }) => (
|
|
396
398
|
<ApolloConsumer>
|
|
397
|
-
{client => (
|
|
399
|
+
{(client) => (
|
|
398
400
|
<div className="uploader">
|
|
399
401
|
<UploadClientWithRouter client={client}>
|
|
400
402
|
{children}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import ORCIDiDLogo from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import ORCIDiDLogo from "../../assets/ORCIDiD_iconvector.svg"
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Display component for usernames showing ORCID linking if connected
|
|
@@ -8,7 +8,7 @@ export const Username = ({ user }): JSX.Element => {
|
|
|
8
8
|
if (user.orcid) {
|
|
9
9
|
return (
|
|
10
10
|
<>
|
|
11
|
-
{user.name}{
|
|
11
|
+
{user.name}{" "}
|
|
12
12
|
<a href={`https://orcid.org/${user.orcid}`}>
|
|
13
13
|
<img src={ORCIDiDLogo} width="16" height="16" alt="ORCID logo" />
|
|
14
14
|
</a>
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { convertArrayToCSV } from
|
|
1
|
+
import { convertArrayToCSV } from "../csv"
|
|
2
2
|
|
|
3
|
-
describe(
|
|
4
|
-
it(
|
|
3
|
+
describe("utils/csv", () => {
|
|
4
|
+
it("converts to a valid CSV", () => {
|
|
5
5
|
const obj = [
|
|
6
|
-
{ exampleCol:
|
|
7
|
-
{ exampleCol:
|
|
6
|
+
{ exampleCol: "test", exampleCol2: "test2", __typename: "example" },
|
|
7
|
+
{ exampleCol: "test4", exampleCol2: "test3", __typename: "example" },
|
|
8
8
|
]
|
|
9
9
|
expect(convertArrayToCSV(obj)).toEqual(
|
|
10
10
|
'exampleCol,exampleCol2\n"test","test2"\n"test4","test3"',
|
|
11
11
|
)
|
|
12
12
|
})
|
|
13
|
-
it(
|
|
13
|
+
it("escapes comma values correctly", () => {
|
|
14
14
|
const obj = [
|
|
15
|
-
{ exampleCol:
|
|
16
|
-
{ exampleCol:
|
|
15
|
+
{ exampleCol: "test", modalities: "PET,MRI", __typename: "example" },
|
|
16
|
+
{ exampleCol: "test4", modalities: "MRI", __typename: "example" },
|
|
17
17
|
]
|
|
18
18
|
expect(convertArrayToCSV(obj)).toEqual(
|
|
19
19
|
'exampleCol,modalities\n"test","PET,MRI"\n"test4","MRI"',
|
|
20
20
|
)
|
|
21
21
|
})
|
|
22
|
-
it(
|
|
22
|
+
it("escapes double quotes", () => {
|
|
23
23
|
const obj = [
|
|
24
24
|
{
|
|
25
|
-
exampleCol:
|
|
26
|
-
modalities:
|
|
25
|
+
exampleCol: "test",
|
|
26
|
+
modalities: "PET,MRI",
|
|
27
27
|
name: 'A "Dataset"',
|
|
28
|
-
__typename:
|
|
28
|
+
__typename: "example",
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
exampleCol:
|
|
32
|
-
modalities:
|
|
33
|
-
name:
|
|
34
|
-
__typename:
|
|
31
|
+
exampleCol: "test4",
|
|
32
|
+
modalities: "MRI",
|
|
33
|
+
name: "Another Dataset",
|
|
34
|
+
__typename: "example",
|
|
35
35
|
},
|
|
36
36
|
]
|
|
37
37
|
expect(convertArrayToCSV(obj)).toEqual(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { formatDate } from
|
|
1
|
+
import { formatDate } from "../date.js"
|
|
2
2
|
|
|
3
|
-
describe(
|
|
4
|
-
it(
|
|
3
|
+
describe("utils/date.js", () => {
|
|
4
|
+
it("returns an YYYY-MM-DD date", () => {
|
|
5
5
|
const beginningOfTime = new Date(0)
|
|
6
|
-
expect(formatDate(beginningOfTime)).toBe(
|
|
6
|
+
expect(formatDate(beginningOfTime)).toBe("1970-01-01")
|
|
7
7
|
})
|
|
8
8
|
})
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import schemaGenerator from
|
|
1
|
+
import schemaGenerator from "../json-ld.js"
|
|
2
2
|
|
|
3
|
-
const mockDate = new Date(
|
|
3
|
+
const mockDate = new Date("2020-08-11T20:53:56.110Z")
|
|
4
4
|
const mockSnapshot = {
|
|
5
|
-
id:
|
|
5
|
+
id: "ds000000:1.0.0",
|
|
6
6
|
created: mockDate,
|
|
7
7
|
description: {
|
|
8
|
-
Name:
|
|
9
|
-
Authors: [
|
|
8
|
+
Name: "Fake dataset",
|
|
9
|
+
Authors: ["Jane Doe", "John Doe"],
|
|
10
10
|
},
|
|
11
|
-
readme:
|
|
12
|
-
tag:
|
|
11
|
+
readme: "This is a test dataset",
|
|
12
|
+
tag: "1.0.0",
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
describe(
|
|
16
|
-
it(
|
|
15
|
+
describe("schemaGenerator()", () => {
|
|
16
|
+
it("returns a valid license field", () => {
|
|
17
17
|
const jsonld = JSON.parse(schemaGenerator(mockSnapshot))
|
|
18
18
|
expect(jsonld.license).toMatch(/https:\/\//)
|
|
19
19
|
})
|
|
20
|
-
it(
|
|
20
|
+
it("returns organization for publisher type", () => {
|
|
21
21
|
const jsonld = JSON.parse(schemaGenerator(mockSnapshot))
|
|
22
|
-
expect(jsonld.publisher[
|
|
23
|
-
expect(jsonld.publisher.name).toEqual(
|
|
22
|
+
expect(jsonld.publisher["@type"]).toEqual("Organization")
|
|
23
|
+
expect(jsonld.publisher.name).toEqual("OpenNeuro")
|
|
24
24
|
})
|
|
25
25
|
})
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import assert from
|
|
2
|
-
import newid from
|
|
1
|
+
import assert from "assert"
|
|
2
|
+
import newid from "../newid"
|
|
3
3
|
|
|
4
|
-
describe(
|
|
4
|
+
describe("utils/newid.js", () => {
|
|
5
5
|
it("should iterate a new id every time it's called", () => {
|
|
6
|
-
assert.equal(newid(),
|
|
7
|
-
assert.equal(newid(),
|
|
8
|
-
assert.equal(newid(),
|
|
6
|
+
assert.equal(newid(), "id1")
|
|
7
|
+
assert.equal(newid(), "id2")
|
|
8
|
+
assert.equal(newid(), "id3")
|
|
9
9
|
})
|
|
10
10
|
|
|
11
11
|
it('should accept an id prefix to replace the generic "id"', () => {
|
|
12
|
-
assert.equal(newid(
|
|
13
|
-
assert.equal(newid(
|
|
14
|
-
assert.equal(newid(
|
|
12
|
+
assert.equal(newid("my-prefix-"), "my-prefix-1")
|
|
13
|
+
assert.equal(newid("my-prefix-"), "my-prefix-2")
|
|
14
|
+
assert.equal(newid("my-prefix-"), "my-prefix-3")
|
|
15
15
|
})
|
|
16
16
|
})
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { expiringBanner } from
|
|
2
|
-
import { toast } from
|
|
1
|
+
import { expiringBanner } from "../userNotify.js"
|
|
2
|
+
import { toast } from "react-toastify"
|
|
3
3
|
|
|
4
|
-
vi.mock(
|
|
5
|
-
...vi.importActual(
|
|
4
|
+
vi.mock("react-toastify", () => ({
|
|
5
|
+
...vi.importActual("react-toastify"),
|
|
6
6
|
toast: { warn: vi.fn() },
|
|
7
7
|
}))
|
|
8
8
|
|
|
9
|
-
describe(
|
|
10
|
-
describe(
|
|
9
|
+
describe("userNotify.js", () => {
|
|
10
|
+
describe("expiringBanner", () => {
|
|
11
11
|
afterEach(() => {
|
|
12
12
|
vi.clearAllMocks()
|
|
13
13
|
})
|
|
14
|
-
it(
|
|
14
|
+
it("is displayed before expiration time", () => {
|
|
15
15
|
const future = new Date()
|
|
16
16
|
// Engage the flux capacitor
|
|
17
17
|
future.setSeconds(future.getSeconds() + 30)
|
|
18
|
-
expiringBanner(
|
|
18
|
+
expiringBanner("message", future)
|
|
19
19
|
expect(toast.warn).toHaveBeenCalled()
|
|
20
20
|
})
|
|
21
|
-
it(
|
|
21
|
+
it("is not displayed after expiration", () => {
|
|
22
22
|
const past = new Date()
|
|
23
23
|
// Rewind time 30 seconds
|
|
24
24
|
past.setSeconds(past.getSeconds() - 30)
|
|
25
|
-
expiringBanner(
|
|
25
|
+
expiringBanner("message", past)
|
|
26
26
|
expect(toast.warn).not.toHaveBeenCalled()
|
|
27
27
|
})
|
|
28
28
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { useEffect } from
|
|
2
|
-
import { pageview } from
|
|
3
|
-
import { useLocation } from
|
|
1
|
+
import React, { useEffect } from "react"
|
|
2
|
+
import { pageview } from "../utils/gtag"
|
|
3
|
+
import { useLocation } from "react-router-dom"
|
|
4
4
|
|
|
5
5
|
export const useAnalytics = (): void => {
|
|
6
6
|
const location = useLocation()
|
package/src/scripts/utils/csv.ts
CHANGED
|
@@ -4,22 +4,20 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export function convertArrayToCSV<T>(array: T[]): string {
|
|
6
6
|
if (array.length === 0) {
|
|
7
|
-
return
|
|
7
|
+
return ""
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
const keys = Object.keys(array[0]).filter(key => key !==
|
|
11
|
-
const headerRow = keys.join(
|
|
12
|
-
const dataRows = array.map(obj =>
|
|
10
|
+
const keys = Object.keys(array[0]).filter((key) => key !== "__typename")
|
|
11
|
+
const headerRow = keys.join(",") + "\n"
|
|
12
|
+
const dataRows = array.map((obj) =>
|
|
13
13
|
keys
|
|
14
|
-
.map(key =>
|
|
15
|
-
obj[key]
|
|
16
|
-
? `"${obj[key].toString().replace(/"/g, '""') as string}"`
|
|
17
|
-
: '',
|
|
14
|
+
.map((key) =>
|
|
15
|
+
obj[key] ? `"${obj[key].toString().replace(/"/g, '""') as string}"` : ""
|
|
18
16
|
)
|
|
19
|
-
.join(
|
|
17
|
+
.join(",")
|
|
20
18
|
)
|
|
21
19
|
|
|
22
|
-
return headerRow + dataRows.join(
|
|
20
|
+
return headerRow + dataRows.join("\n")
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
/**
|
|
@@ -27,13 +25,13 @@ export function convertArrayToCSV<T>(array: T[]): string {
|
|
|
27
25
|
*/
|
|
28
26
|
export function makeCsv<T>(rows: T[], filename: string): void {
|
|
29
27
|
const csvContent = convertArrayToCSV(rows)
|
|
30
|
-
const blob = new Blob([csvContent], { type:
|
|
31
|
-
const link = document.createElement(
|
|
28
|
+
const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" })
|
|
29
|
+
const link = document.createElement("a")
|
|
32
30
|
if (link.download !== undefined) {
|
|
33
31
|
const url = URL.createObjectURL(blob)
|
|
34
|
-
link.setAttribute(
|
|
35
|
-
link.setAttribute(
|
|
36
|
-
link.style.visibility =
|
|
32
|
+
link.setAttribute("href", url)
|
|
33
|
+
link.setAttribute("download", filename)
|
|
34
|
+
link.style.visibility = "hidden"
|
|
37
35
|
document.body.appendChild(link)
|
|
38
36
|
link.click()
|
|
39
37
|
document.body.removeChild(link)
|