@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
|
@@ -2,10 +2,10 @@ export const config = {
|
|
|
2
2
|
/**
|
|
3
3
|
* CRN
|
|
4
4
|
*/
|
|
5
|
-
url:
|
|
5
|
+
url: "localhost:9876/crn/",
|
|
6
6
|
|
|
7
7
|
graphql: {
|
|
8
|
-
uri:
|
|
8
|
+
uri: "http://server:8111",
|
|
9
9
|
},
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -13,17 +13,17 @@ export const config = {
|
|
|
13
13
|
*/
|
|
14
14
|
auth: {
|
|
15
15
|
google: {
|
|
16
|
-
clientID:
|
|
16
|
+
clientID: "google-client-id",
|
|
17
17
|
},
|
|
18
18
|
orcid: {
|
|
19
|
-
clientID:
|
|
19
|
+
clientID: "orcid-client-id",
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
|
|
23
23
|
sentry: {
|
|
24
|
-
environment:
|
|
24
|
+
environment: "unit-tests",
|
|
25
25
|
},
|
|
26
26
|
support: {
|
|
27
|
-
url:
|
|
27
|
+
url: "https://example.com/test-suite",
|
|
28
28
|
},
|
|
29
29
|
}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { MemoryRouter } from
|
|
3
|
-
import { MockedProvider } from
|
|
4
|
-
import { SearchParamsCtx } from
|
|
5
|
-
import { UserModalOpenCtx } from
|
|
6
|
-
import initialSearchParams from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { MemoryRouter } from "react-router-dom"
|
|
3
|
+
import { MockedProvider } from "@apollo/client/testing"
|
|
4
|
+
import { SearchParamsCtx } from "../search/search-params-ctx"
|
|
5
|
+
import { UserModalOpenCtx } from "../utils/user-login-modal-ctx"
|
|
6
|
+
import initialSearchParams from "../search/initial-search-params"
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Reusable shell component that provides any context required by major component trees
|
|
10
10
|
*/
|
|
11
|
-
export const MockAppShell = ({ children, route =
|
|
11
|
+
export const MockAppShell = ({ children, route = "/" }) => (
|
|
12
12
|
<MockedProvider>
|
|
13
13
|
<SearchParamsCtx.Provider
|
|
14
14
|
value={{
|
|
15
15
|
searchParams: initialSearchParams,
|
|
16
|
-
}}
|
|
16
|
+
}}
|
|
17
|
+
>
|
|
17
18
|
<UserModalOpenCtx.Provider value={false}>
|
|
18
19
|
<MemoryRouter initialEntries={[route]}>{children}</MemoryRouter>
|
|
19
20
|
</UserModalOpenCtx.Provider>
|
package/src/scripts/apm.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { init as initApm } from
|
|
2
|
-
import { config } from
|
|
3
|
-
import { version } from
|
|
1
|
+
import { init as initApm } from "@elastic/apm-rum"
|
|
2
|
+
import { config } from "./config"
|
|
3
|
+
import { version } from "../lerna.json"
|
|
4
4
|
|
|
5
5
|
export let apm
|
|
6
6
|
|
|
7
7
|
export function setupApm() {
|
|
8
8
|
if (
|
|
9
|
-
config.sentry.environment ===
|
|
10
|
-
config.sentry.environment ===
|
|
9
|
+
config.sentry.environment === "production" ||
|
|
10
|
+
config.sentry.environment === "staging"
|
|
11
11
|
) {
|
|
12
12
|
apm = initApm({
|
|
13
13
|
serverUrl: config.ELASTIC_APM_SERVER_URL,
|
|
14
|
-
serviceName:
|
|
14
|
+
serviceName: "openneuro-app",
|
|
15
15
|
serviceVersion: version,
|
|
16
16
|
environment: config.sentry.environment,
|
|
17
17
|
})
|
package/src/scripts/app.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { FC, ReactNode } from
|
|
2
|
-
import Helmet from
|
|
3
|
-
import { frontPage } from
|
|
4
|
-
import {
|
|
5
|
-
import { ToastContainer } from
|
|
6
|
-
import
|
|
7
|
-
import { MediaContextProvider } from
|
|
1
|
+
import React, { FC, ReactNode } from "react"
|
|
2
|
+
import Helmet from "react-helmet"
|
|
3
|
+
import { frontPage } from "./pages/front-page/front-page-content"
|
|
4
|
+
import { Cookies, CookiesProvider } from "react-cookie"
|
|
5
|
+
import { ToastContainer } from "react-toastify"
|
|
6
|
+
import "react-toastify/dist/ReactToastify.css"
|
|
7
|
+
import { MediaContextProvider } from "./styles/media"
|
|
8
8
|
|
|
9
9
|
interface AppProps {
|
|
10
10
|
children: ReactNode
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { parseJwt } from
|
|
1
|
+
import { parseJwt } from "../profile"
|
|
2
2
|
|
|
3
3
|
const asciiToken =
|
|
4
|
-
|
|
4
|
+
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
|
|
5
5
|
const utf8Token =
|
|
6
|
-
|
|
6
|
+
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Iuelnue1jOenkeWtpuiAhSIsImlhdCI6MTUxNjIzOTAyMn0.pUw2ARoXv4LkJXB1ZR3Th6xG83URT6mn1TftC7ac_O8"
|
|
7
7
|
|
|
8
|
-
describe(
|
|
9
|
-
it(
|
|
8
|
+
describe("authentication/profile", () => {
|
|
9
|
+
it("decodes a JWT to Javascript object", () => {
|
|
10
10
|
expect(parseJwt(asciiToken)).toEqual({
|
|
11
|
-
sub:
|
|
12
|
-
name:
|
|
11
|
+
sub: "1234567890",
|
|
12
|
+
name: "John Doe",
|
|
13
13
|
iat: 1516239022,
|
|
14
14
|
})
|
|
15
15
|
})
|
|
16
|
-
it(
|
|
16
|
+
it("decodes a JWT with Unicode strings", () => {
|
|
17
17
|
expect(parseJwt(utf8Token)).toEqual({
|
|
18
|
-
sub:
|
|
19
|
-
name:
|
|
18
|
+
sub: "1234567890",
|
|
19
|
+
name: "神経科学者",
|
|
20
20
|
iat: 1516239022,
|
|
21
21
|
})
|
|
22
22
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getProfile, guardExpired } from
|
|
1
|
+
import { getProfile, guardExpired } from "./profile"
|
|
2
2
|
|
|
3
3
|
// Expects a universal cookie
|
|
4
|
-
export const loginCheck = cookies => guardExpired(getProfile(cookies))
|
|
4
|
+
export const loginCheck = (cookies) => guardExpired(getProfile(cookies))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import jwtDecode from
|
|
1
|
+
import jwtDecode from "jwt-decode"
|
|
2
2
|
|
|
3
3
|
interface OpenNeuroTokenProfile {
|
|
4
4
|
sub: string
|
|
@@ -20,7 +20,7 @@ export const parseJwt = jwtDecode
|
|
|
20
20
|
* Retrieve the user profile from JWT cookie
|
|
21
21
|
*/
|
|
22
22
|
export function getProfile(cookies): OpenNeuroTokenProfile {
|
|
23
|
-
const accessToken = cookies[
|
|
23
|
+
const accessToken = cookies["accessToken"]
|
|
24
24
|
return accessToken ? parseJwt(accessToken) : null
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@ export function getProfile(cookies): OpenNeuroTokenProfile {
|
|
|
28
28
|
* Return profile if token is not expired.
|
|
29
29
|
* @param {*} cookies
|
|
30
30
|
*/
|
|
31
|
-
export const getUnexpiredProfile = cookies => {
|
|
31
|
+
export const getUnexpiredProfile = (cookies) => {
|
|
32
32
|
const profile = getProfile(cookies)
|
|
33
33
|
if (guardExpired(profile)) return profile
|
|
34
34
|
}
|
|
@@ -51,10 +51,10 @@ export const guardExpired = (profile: OpenNeuroTokenProfile): boolean => {
|
|
|
51
51
|
* Returns true if active user has at least one of the permissions in expectedLevels
|
|
52
52
|
* @param {string[]} expectedLevels
|
|
53
53
|
*/
|
|
54
|
-
const hasDatasetPermissions = expectedLevels => (permissions, userId) => {
|
|
54
|
+
const hasDatasetPermissions = (expectedLevels) => (permissions, userId) => {
|
|
55
55
|
if (userId) {
|
|
56
56
|
const permission = permissions.userPermissions.find(
|
|
57
|
-
perm => perm.user.id === userId,
|
|
57
|
+
(perm) => perm.user.id === userId,
|
|
58
58
|
)
|
|
59
59
|
return (permission && expectedLevels.includes(permission.level)) || false
|
|
60
60
|
}
|
|
@@ -62,7 +62,7 @@ const hasDatasetPermissions = expectedLevels => (permissions, userId) => {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
// Return true if the active user has write permission
|
|
65
|
-
export const hasEditPermissions = hasDatasetPermissions([
|
|
65
|
+
export const hasEditPermissions = hasDatasetPermissions(["admin", "rw"])
|
|
66
66
|
|
|
67
67
|
//
|
|
68
|
-
export const hasDatasetAdminPermissions = hasDatasetPermissions([
|
|
68
|
+
export const hasDatasetAdminPermissions = hasDatasetPermissions(["admin"])
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { useCookies } from
|
|
3
|
-
import { getProfile } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { useCookies } from "react-cookie"
|
|
3
|
+
import { getProfile } from "./profile"
|
|
4
4
|
|
|
5
5
|
interface RegularUserProps {
|
|
6
6
|
children?: React.ReactNode
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import React from
|
|
3
|
-
import { useCookies } from
|
|
4
|
-
import { getProfile, guardExpired } from
|
|
2
|
+
import React from "react"
|
|
3
|
+
import { useCookies } from "react-cookie"
|
|
4
|
+
import { getProfile, guardExpired } from "./profile"
|
|
5
5
|
|
|
6
|
-
const withProfile = WrappedComponent => {
|
|
7
|
-
return props => {
|
|
8
|
-
const [cookies] = useCookies([
|
|
6
|
+
const withProfile = (WrappedComponent) => {
|
|
7
|
+
return (props) => {
|
|
8
|
+
const [cookies] = useCookies(["accessToken"])
|
|
9
9
|
const profile = getProfile(cookies)
|
|
10
10
|
// If we have a profile and it is unexpired
|
|
11
11
|
if (profile && guardExpired(profile)) {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
3
|
|
|
4
4
|
class BlockNavigation extends React.Component {
|
|
5
5
|
componentDidMount() {
|
|
6
6
|
// Attempt to set a message even though browsers do not display it
|
|
7
|
-
window.onbeforeunload = () =>
|
|
8
|
-
this.props.message ? this.props.message : true
|
|
7
|
+
window.onbeforeunload = () => this.props.message ? this.props.message : true
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
componentWillUnmount() {
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { vi } from
|
|
2
|
-
import React from
|
|
3
|
-
import { MockAppShell } from
|
|
4
|
-
import { render, screen,
|
|
5
|
-
import { HeaderContainer } from
|
|
1
|
+
import { vi } from "vitest"
|
|
2
|
+
import React from "react"
|
|
3
|
+
import { MockAppShell } from "../../../__utils__/mock-app-shell"
|
|
4
|
+
import { fireEvent, render, screen, waitFor } from "@testing-library/react"
|
|
5
|
+
import { HeaderContainer } from "../header"
|
|
6
6
|
|
|
7
7
|
const navigate = vi.fn()
|
|
8
|
-
vi.mock(
|
|
9
|
-
vi.mock(
|
|
10
|
-
default: () =>
|
|
8
|
+
vi.mock("../../../config.ts")
|
|
9
|
+
vi.mock("../../../uploader/uploader-view.jsx", () => ({
|
|
10
|
+
default: () => "mocked UploaderView",
|
|
11
11
|
}))
|
|
12
|
-
vi.mock(
|
|
12
|
+
vi.mock("react-router-dom", async () => ({
|
|
13
13
|
// @ts-ignore-check
|
|
14
|
-
...(await vi.importActual(
|
|
14
|
+
...(await vi.importActual("react-router-dom")),
|
|
15
15
|
useNavigate: () => navigate,
|
|
16
16
|
}))
|
|
17
17
|
|
|
18
|
-
describe(
|
|
19
|
-
it(
|
|
18
|
+
describe("HeaderContainer component", () => {
|
|
19
|
+
it("navigates prepopulated search when you use the home page search box", async () => {
|
|
20
20
|
render(<HeaderContainer />, { wrapper: MockAppShell })
|
|
21
|
-
const searchbox = screen.getByRole(
|
|
22
|
-
const button = screen.getByLabelText(
|
|
23
|
-
await fireEvent.change(searchbox, { target: { value:
|
|
21
|
+
const searchbox = screen.getByRole("textbox")
|
|
22
|
+
const button = screen.getByLabelText("Search")
|
|
23
|
+
await fireEvent.change(searchbox, { target: { value: "test argument" } })
|
|
24
24
|
await fireEvent.click(button)
|
|
25
25
|
await waitFor(() =>
|
|
26
26
|
expect(navigate).toHaveBeenCalledWith(
|
|
27
27
|
'/search?query={"keywords":["test argument"]}',
|
|
28
|
-
)
|
|
28
|
+
)
|
|
29
29
|
)
|
|
30
30
|
})
|
|
31
31
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { FC } from
|
|
2
|
-
import { Footer } from
|
|
3
|
-
import { version as openneuroVersion } from
|
|
1
|
+
import React, { FC } from "react"
|
|
2
|
+
import { Footer } from "@openneuro/components/footer"
|
|
3
|
+
import { version as openneuroVersion } from "../../../lerna.json"
|
|
4
4
|
|
|
5
5
|
const FooterContainer: FC = () => {
|
|
6
6
|
return (
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import React, { FC, useContext } from
|
|
2
|
-
import useState from
|
|
3
|
-
import UploaderContext from
|
|
4
|
-
import UploadProgress from
|
|
5
|
-
import { Header, LandingExpandedHeader } from
|
|
6
|
-
import { Input } from
|
|
7
|
-
import ModalitySelect from
|
|
8
|
-
import { UserModalOpenCtx } from
|
|
9
|
-
import { useLocation, useNavigate } from
|
|
10
|
-
import { useCookies } from
|
|
11
|
-
import signOut from
|
|
12
|
-
import { getUnexpiredProfile } from
|
|
13
|
-
import FreshdeskWidget from
|
|
14
|
-
import AggregateCountsContainer from
|
|
15
|
-
import loginUrls from
|
|
16
|
-
import UploaderView from
|
|
17
|
-
import UploadButton from
|
|
18
|
-
import UploadProgressButton from
|
|
1
|
+
import React, { FC, useContext } from "react"
|
|
2
|
+
import useState from "react-usestateref"
|
|
3
|
+
import UploaderContext from "../../uploader/uploader-context.js"
|
|
4
|
+
import UploadProgress from "../../uploader/upload-progress.jsx"
|
|
5
|
+
import { Header, LandingExpandedHeader } from "@openneuro/components/header"
|
|
6
|
+
import { Input } from "@openneuro/components/input"
|
|
7
|
+
import ModalitySelect from "../../search/inputs/modality-select"
|
|
8
|
+
import { UserModalOpenCtx } from "../../utils/user-login-modal-ctx"
|
|
9
|
+
import { useLocation, useNavigate } from "react-router-dom"
|
|
10
|
+
import { useCookies } from "react-cookie"
|
|
11
|
+
import signOut from "../../authentication/signOut"
|
|
12
|
+
import { getUnexpiredProfile } from "../../authentication/profile"
|
|
13
|
+
import FreshdeskWidget from "../partials/freshdesk-widget"
|
|
14
|
+
import AggregateCountsContainer from "../../pages/front-page/aggregate-queries/aggregate-counts-container"
|
|
15
|
+
import loginUrls from "../../authentication/loginUrls"
|
|
16
|
+
import UploaderView from "../../uploader/uploader-view.jsx"
|
|
17
|
+
import UploadButton from "../../uploader/upload-button.jsx"
|
|
18
|
+
import UploadProgressButton from "../../uploader/upload-progress-button.jsx"
|
|
19
19
|
|
|
20
20
|
export const HeaderContainer: FC = () => {
|
|
21
21
|
const navigate = useNavigate()
|
|
22
22
|
|
|
23
23
|
const { pathname: currentPath } = useLocation()
|
|
24
|
-
const expanded = currentPath ===
|
|
24
|
+
const expanded = currentPath === "/"
|
|
25
25
|
|
|
26
26
|
const [cookies] = useCookies()
|
|
27
27
|
const profile = getUnexpiredProfile(cookies)
|
|
28
28
|
|
|
29
29
|
const { userModalOpen, setUserModalOpen } = useContext(UserModalOpenCtx)
|
|
30
30
|
|
|
31
|
-
const [newKeyword, setNewKeyword, newKeywordRef] = useState(
|
|
31
|
+
const [newKeyword, setNewKeyword, newKeywordRef] = useState("")
|
|
32
32
|
|
|
33
33
|
const handleSubmit = () => {
|
|
34
34
|
const query = JSON.stringify({
|
|
35
35
|
keywords: newKeywordRef.current ? [newKeywordRef.current] : [],
|
|
36
36
|
})
|
|
37
|
-
setNewKeyword(
|
|
37
|
+
setNewKeyword("")
|
|
38
38
|
navigate(`/search?query=${query}`)
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
const toggleLoginModal = (): void => {
|
|
42
|
-
setUserModalOpen(prevState => ({
|
|
42
|
+
setUserModalOpen((prevState) => ({
|
|
43
43
|
...prevState,
|
|
44
44
|
userModalOpen: !prevState.userModalOpen,
|
|
45
45
|
}))
|
|
@@ -47,19 +47,19 @@ export const HeaderContainer: FC = () => {
|
|
|
47
47
|
|
|
48
48
|
const signOutAndRedirect = () => {
|
|
49
49
|
signOut()
|
|
50
|
-
const homepage =
|
|
50
|
+
const homepage = "/"
|
|
51
51
|
if (window.location.pathname === homepage) window.location.reload()
|
|
52
52
|
else window.location.pathname = homepage
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
const [isOpenSupport, setSupportIsOpen] = React.useState(false)
|
|
56
56
|
|
|
57
|
-
const toggleSupport = () => setSupportIsOpen(prevIsOpen => !prevIsOpen)
|
|
57
|
+
const toggleSupport = () => setSupportIsOpen((prevIsOpen) => !prevIsOpen)
|
|
58
58
|
|
|
59
59
|
return (
|
|
60
60
|
<>
|
|
61
61
|
<UploaderContext.Consumer>
|
|
62
|
-
{uploader => {
|
|
62
|
+
{(uploader) => {
|
|
63
63
|
if (uploader?.uploading) {
|
|
64
64
|
return (
|
|
65
65
|
<span className="header-progress-wrap">
|
|
@@ -81,13 +81,13 @@ export const HeaderContainer: FC = () => {
|
|
|
81
81
|
navigateToNewSearch={handleSubmit}
|
|
82
82
|
renderUploader={() => (
|
|
83
83
|
<UploaderContext.Consumer>
|
|
84
|
-
{uploader => {
|
|
84
|
+
{(uploader) => {
|
|
85
85
|
if (uploader?.uploading) {
|
|
86
86
|
return <UploadProgressButton />
|
|
87
87
|
} else {
|
|
88
88
|
return (
|
|
89
89
|
<UploadButton
|
|
90
|
-
onClick={() => uploader.setLocation(
|
|
90
|
+
onClick={() => uploader.setLocation("/upload")}
|
|
91
91
|
/>
|
|
92
92
|
)
|
|
93
93
|
}
|
|
@@ -95,7 +95,7 @@ export const HeaderContainer: FC = () => {
|
|
|
95
95
|
</UploaderContext.Consumer>
|
|
96
96
|
)}
|
|
97
97
|
renderOnFreshDeskWidget={() => <FreshdeskWidget />}
|
|
98
|
-
renderOnExpanded={profile => (
|
|
98
|
+
renderOnExpanded={(profile) => (
|
|
99
99
|
<LandingExpandedHeader
|
|
100
100
|
user={profile}
|
|
101
101
|
loginUrls={loginUrls}
|
|
@@ -118,7 +118,7 @@ export const HeaderContainer: FC = () => {
|
|
|
118
118
|
labelStyle="default"
|
|
119
119
|
value={newKeyword}
|
|
120
120
|
setValue={setNewKeyword}
|
|
121
|
-
onKeyDown={e => {
|
|
121
|
+
onKeyDown={(e) => {
|
|
122
122
|
if (e.keyCode === 13) {
|
|
123
123
|
handleSubmit()
|
|
124
124
|
}
|
|
@@ -132,7 +132,7 @@ export const HeaderContainer: FC = () => {
|
|
|
132
132
|
)}
|
|
133
133
|
/>
|
|
134
134
|
<UploaderContext.Consumer>
|
|
135
|
-
{uploader => <UploaderView uploader={uploader} />}
|
|
135
|
+
{(uploader) => <UploaderView uploader={uploader} />}
|
|
136
136
|
</UploaderContext.Consumer>
|
|
137
137
|
</>
|
|
138
138
|
)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render } from
|
|
3
|
-
import WarnButton from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { render } from "@testing-library/react"
|
|
3
|
+
import WarnButton from "../warn-button"
|
|
4
4
|
|
|
5
|
-
describe(
|
|
6
|
-
it(
|
|
5
|
+
describe("common/forms/WarnButton", () => {
|
|
6
|
+
it("renders successfully", () => {
|
|
7
7
|
const { asFragment } = render(<WarnButton message="A Button!" />)
|
|
8
8
|
expect(asFragment()).toMatchSnapshot()
|
|
9
9
|
})
|
|
10
|
-
it(
|
|
10
|
+
it("renders with warnings disable", () => {
|
|
11
11
|
const { asFragment } = render(
|
|
12
12
|
<WarnButton message="A Button!" warn={false} />,
|
|
13
13
|
)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// dependencies -------------------------------------------------------
|
|
2
2
|
|
|
3
|
-
import React from
|
|
4
|
-
import PropTypes from
|
|
5
|
-
import { Tooltip } from
|
|
6
|
-
import { toast } from
|
|
7
|
-
import ToastContent from
|
|
3
|
+
import React from "react"
|
|
4
|
+
import PropTypes from "prop-types"
|
|
5
|
+
import { Tooltip } from "@openneuro/components/tooltip"
|
|
6
|
+
import { toast } from "react-toastify"
|
|
7
|
+
import ToastContent from "../partials/toast-content.jsx"
|
|
8
8
|
|
|
9
9
|
class WarnButton extends React.Component {
|
|
10
10
|
constructor(props) {
|
|
@@ -49,7 +49,8 @@ class WarnButton extends React.Component {
|
|
|
49
49
|
<a
|
|
50
50
|
className="btn-warn-component success"
|
|
51
51
|
onClick={this.toggle.bind(this, this.props.action)}
|
|
52
|
-
href={this.state.link}
|
|
52
|
+
href={this.state.link}
|
|
53
|
+
>
|
|
53
54
|
{confirm}
|
|
54
55
|
</a>
|
|
55
56
|
)
|
|
@@ -57,8 +58,9 @@ class WarnButton extends React.Component {
|
|
|
57
58
|
|
|
58
59
|
const confirmBtn = (
|
|
59
60
|
<button
|
|
60
|
-
className={
|
|
61
|
-
onClick={this.toggle.bind(this, this.props.action)}
|
|
61
|
+
className={"btn-warn-component success"}
|
|
62
|
+
onClick={this.toggle.bind(this, this.props.action)}
|
|
63
|
+
>
|
|
62
64
|
{confirm}
|
|
63
65
|
</button>
|
|
64
66
|
)
|
|
@@ -67,7 +69,8 @@ class WarnButton extends React.Component {
|
|
|
67
69
|
<span className="btn-group slide-in-right-fast" role="group">
|
|
68
70
|
<button
|
|
69
71
|
className="btn-warn-component cancel"
|
|
70
|
-
onClick={this.toggle.bind(this)}
|
|
72
|
+
onClick={this.toggle.bind(this)}
|
|
73
|
+
>
|
|
71
74
|
{cancel}
|
|
72
75
|
</button>
|
|
73
76
|
{link ? link : confirmBtn}
|
|
@@ -75,12 +78,13 @@ class WarnButton extends React.Component {
|
|
|
75
78
|
)
|
|
76
79
|
|
|
77
80
|
const hideAction = (
|
|
78
|
-
<span className={disabled ?
|
|
81
|
+
<span className={disabled ? " disabled" : ""}>
|
|
79
82
|
<button
|
|
80
83
|
className="btn-warn-component warning"
|
|
81
84
|
onClick={this.toggle.bind(this, this.props.action)}
|
|
82
|
-
disabled={this.props.lock}
|
|
83
|
-
|
|
85
|
+
disabled={this.props.lock}
|
|
86
|
+
>
|
|
87
|
+
<i className={"fa " + this.props.icon} /> {message}
|
|
84
88
|
</button>
|
|
85
89
|
</span>
|
|
86
90
|
)
|
|
@@ -130,7 +134,7 @@ class WarnButton extends React.Component {
|
|
|
130
134
|
// generate download links
|
|
131
135
|
if (this.props.prepDownload) {
|
|
132
136
|
this.setState({ loading: true })
|
|
133
|
-
this.props.prepDownload(link => {
|
|
137
|
+
this.props.prepDownload((link) => {
|
|
134
138
|
this.setState({ displayOptions: true, link: link, loading: false })
|
|
135
139
|
})
|
|
136
140
|
return
|
|
@@ -154,9 +158,9 @@ class WarnButton extends React.Component {
|
|
|
154
158
|
}
|
|
155
159
|
}
|
|
156
160
|
|
|
157
|
-
if (typeof action ===
|
|
161
|
+
if (typeof action === "function") {
|
|
158
162
|
this.setState({ loading: true })
|
|
159
|
-
action(e => {
|
|
163
|
+
action((e) => {
|
|
160
164
|
if (e && e.error) {
|
|
161
165
|
toast.error(<ToastContent title="Error" body={e.error} />)
|
|
162
166
|
}
|
|
@@ -190,10 +194,10 @@ WarnButton.propTypes = {
|
|
|
190
194
|
}
|
|
191
195
|
|
|
192
196
|
WarnButton.defaultProps = {
|
|
193
|
-
message:
|
|
197
|
+
message: "",
|
|
194
198
|
cancel: <i className="fa fa-times" />,
|
|
195
199
|
confirm: <i className="fa fa-check" />,
|
|
196
|
-
icon:
|
|
200
|
+
icon: "fa-trash-o",
|
|
197
201
|
warn: true,
|
|
198
202
|
tooltip: null,
|
|
199
203
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
3
|
|
|
4
4
|
class BlockNavigation extends React.Component {
|
|
5
5
|
componentDidMount() {
|
|
6
6
|
// Attempt to set a message even though browsers do not display it
|
|
7
|
-
window.onbeforeunload = () =>
|
|
8
|
-
this.props.message ? this.props.message : true
|
|
7
|
+
window.onbeforeunload = () => this.props.message ? this.props.message : true
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
componentWillUnmount() {
|