@openneuro/app 4.20.5 → 4.20.6-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mocks__/fileMock.js +1 -1
- package/package.json +5 -5
- package/pluralize-esm.js +204 -211
- package/src/@types/custom.d.ts +3 -3
- package/src/@types/react.d.ts +3 -4
- package/src/client.jsx +17 -16
- package/src/scripts/__mocks__/config.ts +6 -6
- package/src/scripts/__utils__/mock-app-shell.tsx +9 -8
- package/src/scripts/apm.js +6 -6
- package/src/scripts/app.tsx +7 -7
- package/src/scripts/authentication/__tests__/profile.spec.js +10 -10
- package/src/scripts/authentication/admin-user.jsx +2 -2
- package/src/scripts/authentication/logged-in.jsx +2 -2
- package/src/scripts/authentication/logged-out.jsx +2 -2
- package/src/scripts/authentication/loginCheck.js +2 -2
- package/src/scripts/authentication/loginUrls.ts +1 -1
- package/src/scripts/authentication/profile.ts +7 -7
- package/src/scripts/authentication/regular-user.tsx +3 -3
- package/src/scripts/authentication/signOut.ts +2 -2
- package/src/scripts/authentication/withProfile.jsx +6 -6
- package/src/scripts/common/block-navigation.jsx +3 -4
- package/src/scripts/common/containers/__tests__/header.spec.tsx +16 -16
- package/src/scripts/common/containers/footer.tsx +3 -3
- package/src/scripts/common/containers/header.tsx +30 -30
- package/src/scripts/common/forms/__tests__/warn-button.spec.jsx +6 -6
- package/src/scripts/common/forms/warn-button.jsx +21 -17
- package/src/scripts/common/partials/block-navigation.jsx +3 -4
- package/src/scripts/common/partials/freshdesk-widget.jsx +17 -20
- package/src/scripts/common/partials/toast-content.jsx +2 -2
- package/src/scripts/components/__tests__/data-table.spec.tsx +7 -7
- package/src/scripts/components/data-table.tsx +23 -22
- package/src/scripts/config.ts +2 -2
- package/src/scripts/datalad/dataset/comments-fragments.js +1 -1
- package/src/scripts/datalad/dataset/dataset-context.js +1 -1
- package/src/scripts/datalad/dataset/dataset-query-context.js +1 -1
- package/src/scripts/datalad/dataset/dataset-query-fragments.js +1 -1
- package/src/scripts/datalad/mutations/cache-clear.jsx +7 -6
- package/src/scripts/datalad/mutations/cache-id.js +2 -2
- package/src/scripts/datalad/mutations/delete-comment.jsx +13 -11
- package/src/scripts/datalad/mutations/delete.jsx +10 -9
- package/src/scripts/datalad/mutations/follow.jsx +12 -11
- package/src/scripts/datalad/mutations/publish.jsx +13 -12
- package/src/scripts/datalad/mutations/remove-permissions.jsx +8 -8
- package/src/scripts/datalad/mutations/revalidate.jsx +7 -6
- package/src/scripts/datalad/mutations/snapshot.tsx +7 -7
- package/src/scripts/datalad/mutations/star.jsx +12 -11
- package/src/scripts/datalad/mutations/submit-metadata.jsx +14 -12
- package/src/scripts/datalad/mutations/update-permissions.jsx +14 -13
- package/src/scripts/datalad/mutations/update-ref.jsx +7 -6
- package/src/scripts/datalad/routes/dataset-redirect.tsx +49 -49
- package/src/scripts/datalad/subscriptions/__tests__/files-subscription.spec.jsx +32 -32
- package/src/scripts/datalad/subscriptions/files-subscription.jsx +16 -16
- package/src/scripts/datalad/subscriptions/useDatasetDeletedSubscription.jsx +4 -4
- package/src/scripts/datalad/subscriptions/useDraftSubscription.js +4 -4
- package/src/scripts/datalad/subscriptions/usePermissionsSubscription.js +4 -4
- package/src/scripts/datalad/subscriptions/useSnapshotsUpdatedSubscriptions.js +3 -3
- package/src/scripts/dataset/__tests__/__snapshots__/snapshot-container.spec.tsx.snap +2 -2
- package/src/scripts/dataset/__tests__/snapshot-container.spec.tsx +12 -12
- package/src/scripts/dataset/comments/__tests__/comment.spec.jsx +21 -21
- package/src/scripts/dataset/comments/__tests__/comments.spec.jsx +10 -10
- package/src/scripts/dataset/comments/block-style-controls.jsx +15 -15
- package/src/scripts/dataset/comments/comment-editor.jsx +31 -31
- package/src/scripts/dataset/comments/comment.jsx +50 -50
- package/src/scripts/dataset/comments/comments.jsx +24 -22
- package/src/scripts/dataset/comments/inline-style-controls.jsx +9 -9
- package/src/scripts/dataset/comments/style-button.jsx +8 -9
- package/src/scripts/dataset/common/follow-toggles.tsx +3 -3
- package/src/scripts/dataset/dataset-query-context.js +1 -1
- package/src/scripts/dataset/dataset-query.jsx +34 -31
- package/src/scripts/dataset/dataset-routes.jsx +5 -5
- package/src/scripts/dataset/download/__tests__/download-command-line.spec.jsx +13 -13
- package/src/scripts/dataset/download/__tests__/download-link.spec.jsx +10 -10
- package/src/scripts/dataset/download/__tests__/download-native.spec.js +7 -7
- package/src/scripts/dataset/download/__tests__/shell-example.spec.jsx +5 -5
- package/src/scripts/dataset/download/download-command-line.jsx +9 -7
- package/src/scripts/dataset/download/download-datalad.jsx +22 -20
- package/src/scripts/dataset/download/download-derivative-datalad.tsx +2 -2
- package/src/scripts/dataset/download/download-derivative-s3.tsx +2 -2
- package/src/scripts/dataset/download/download-link.jsx +6 -6
- package/src/scripts/dataset/download/download-native.js +20 -19
- package/src/scripts/dataset/download/download-query.js +2 -3
- package/src/scripts/dataset/download/download-s3.jsx +8 -8
- package/src/scripts/dataset/download/download-script.tsx +23 -20
- package/src/scripts/dataset/download/native-file-toast.jsx +13 -11
- package/src/scripts/dataset/download/shell-example.jsx +1 -1
- package/src/scripts/dataset/download/track-download.js +5 -5
- package/src/scripts/dataset/draft-container.tsx +104 -102
- package/src/scripts/dataset/draft-snapshot-routes.tsx +3 -3
- package/src/scripts/dataset/files/__tests__/file-tree-unloaded-directory.spec.jsx +23 -23
- package/src/scripts/dataset/files/__tests__/file-tree.spec.jsx +57 -58
- package/src/scripts/dataset/files/__tests__/file-viewer-type.spec.jsx +6 -6
- package/src/scripts/dataset/files/__tests__/file.spec.jsx +15 -15
- package/src/scripts/dataset/files/file-display.jsx +11 -11
- package/src/scripts/dataset/files/file-tree-unloaded-directory.jsx +10 -10
- package/src/scripts/dataset/files/file-tree.tsx +27 -27
- package/src/scripts/dataset/files/file-view.jsx +4 -4
- package/src/scripts/dataset/files/file-viewer-type.jsx +21 -21
- package/src/scripts/dataset/files/file.tsx +85 -80
- package/src/scripts/dataset/files/files.tsx +41 -40
- package/src/scripts/dataset/files/index.tsx +2 -2
- package/src/scripts/dataset/files/viewers/__tests__/__snapshots__/file-viewer-json.spec.jsx.snap +0 -24
- package/src/scripts/dataset/files/viewers/__tests__/file-viewer-json.spec.jsx +9 -9
- package/src/scripts/dataset/files/viewers/__tests__/parse-tabular.spec.js +8 -8
- package/src/scripts/dataset/files/viewers/file-viewer-csv.jsx +5 -5
- package/src/scripts/dataset/files/viewers/file-viewer-html.jsx +3 -3
- package/src/scripts/dataset/files/viewers/file-viewer-json.jsx +4 -4
- package/src/scripts/dataset/files/viewers/file-viewer-nifti.tsx +4 -4
- package/src/scripts/dataset/files/viewers/file-viewer-table.tsx +3 -3
- package/src/scripts/dataset/files/viewers/file-viewer-text.jsx +3 -3
- package/src/scripts/dataset/files/viewers/file-viewer-tsv.jsx +5 -5
- package/src/scripts/dataset/files/viewers/parse-tabular.js +4 -4
- package/src/scripts/dataset/fragments/__tests__/cancel-button.spec.tsx +5 -5
- package/src/scripts/dataset/fragments/__tests__/dataset-alert-draft.spec.tsx +9 -9
- package/src/scripts/dataset/fragments/__tests__/dataset-citation.spec.jsx +10 -10
- package/src/scripts/dataset/fragments/__tests__/doi-link.spec.tsx +29 -29
- package/src/scripts/dataset/fragments/__tests__/edit-button.spec.tsx +5 -5
- package/src/scripts/dataset/fragments/__tests__/edit-list.spec.jsx +13 -13
- package/src/scripts/dataset/fragments/__tests__/save-button.spec.tsx +5 -5
- package/src/scripts/dataset/fragments/__tests__/select-input.spec.tsx +26 -26
- package/src/scripts/dataset/fragments/cancel-button.tsx +2 -2
- package/src/scripts/dataset/fragments/comments-fragments.js +1 -1
- package/src/scripts/dataset/fragments/copyable-tooltip.jsx +14 -13
- package/src/scripts/dataset/fragments/dataset-alert-draft.tsx +17 -13
- package/src/scripts/dataset/fragments/dataset-alert-version.tsx +5 -4
- package/src/scripts/dataset/fragments/dataset-citation.jsx +23 -21
- package/src/scripts/dataset/fragments/dataset-history.jsx +12 -12
- package/src/scripts/dataset/fragments/dataset-reviewers.ts +1 -1
- package/src/scripts/dataset/fragments/doi-link.tsx +6 -6
- package/src/scripts/dataset/fragments/edit-button.tsx +2 -2
- package/src/scripts/dataset/fragments/edit-description-field.jsx +23 -21
- package/src/scripts/dataset/fragments/edit-description-list.jsx +8 -8
- package/src/scripts/dataset/fragments/edit-list.jsx +8 -8
- package/src/scripts/dataset/fragments/number-input.tsx +36 -35
- package/src/scripts/dataset/fragments/save-button.tsx +2 -2
- package/src/scripts/dataset/fragments/select-input.tsx +87 -86
- package/src/scripts/dataset/fragments/text-array-input.tsx +38 -37
- package/src/scripts/dataset/fragments/text-input.tsx +79 -78
- package/src/scripts/dataset/mutations/__tests__/cache-id.spec.js +5 -5
- package/src/scripts/dataset/mutations/__tests__/delete-file.spec.jsx +85 -83
- package/src/scripts/dataset/mutations/__tests__/delete.spec.jsx +8 -8
- package/src/scripts/dataset/mutations/__tests__/deprecate-snapshot.spec.tsx +17 -17
- package/src/scripts/dataset/mutations/__tests__/deprecate-version.spec.tsx +19 -19
- package/src/scripts/dataset/mutations/__tests__/description.spec.jsx +51 -51
- package/src/scripts/dataset/mutations/__tests__/remove-permissions.spec.tsx +9 -9
- package/src/scripts/dataset/mutations/__tests__/update-permissions.spec.jsx +7 -7
- package/src/scripts/dataset/mutations/admin-exports.jsx +13 -12
- package/src/scripts/dataset/mutations/cache-clear.jsx +6 -6
- package/src/scripts/dataset/mutations/cache-id.js +2 -2
- package/src/scripts/dataset/mutations/comment.jsx +25 -23
- package/src/scripts/dataset/mutations/create-anonymous-reviewer.tsx +36 -30
- package/src/scripts/dataset/mutations/dataset-relations.tsx +28 -29
- package/src/scripts/dataset/mutations/delete-anonymous-reviewer.tsx +7 -8
- package/src/scripts/dataset/mutations/delete-comment.jsx +14 -12
- package/src/scripts/dataset/mutations/delete-dataset-form.jsx +20 -22
- package/src/scripts/dataset/mutations/delete-file.jsx +8 -8
- package/src/scripts/dataset/mutations/delete.jsx +10 -9
- package/src/scripts/dataset/mutations/deprecate-version.tsx +5 -6
- package/src/scripts/dataset/mutations/description.jsx +21 -20
- package/src/scripts/dataset/mutations/flag-annex-object.jsx +10 -9
- package/src/scripts/dataset/mutations/follow.tsx +15 -14
- package/src/scripts/dataset/mutations/import-dataset.tsx +5 -5
- package/src/scripts/dataset/mutations/metadata-form.jsx +94 -97
- package/src/scripts/dataset/mutations/publish.jsx +13 -13
- package/src/scripts/dataset/mutations/readme.jsx +12 -11
- package/src/scripts/dataset/mutations/remove-annex-object.jsx +10 -9
- package/src/scripts/dataset/mutations/remove-permissions.tsx +5 -6
- package/src/scripts/dataset/mutations/revalidate.jsx +7 -7
- package/src/scripts/dataset/mutations/snapshot.tsx +8 -8
- package/src/scripts/dataset/mutations/star.tsx +14 -13
- package/src/scripts/dataset/mutations/submit-metadata.jsx +12 -11
- package/src/scripts/dataset/mutations/undo-deprecate-version.tsx +5 -6
- package/src/scripts/dataset/mutations/update-file.jsx +6 -6
- package/src/scripts/dataset/mutations/update-permissions.tsx +9 -9
- package/src/scripts/dataset/mutations/update-ref.jsx +7 -7
- package/src/scripts/dataset/routes/__tests__/deprecate-snapshot-page.spec.tsx +5 -5
- package/src/scripts/dataset/routes/add-metadata.jsx +19 -20
- package/src/scripts/dataset/routes/admin-datalad.jsx +7 -7
- package/src/scripts/dataset/routes/dataset-default.tsx +12 -10
- package/src/scripts/dataset/routes/delete-page.tsx +12 -12
- package/src/scripts/dataset/routes/deprecate-snapshot-page.tsx +8 -8
- package/src/scripts/dataset/routes/derivatives.tsx +10 -10
- package/src/scripts/dataset/routes/download-dataset.tsx +20 -20
- package/src/scripts/dataset/routes/manage-anonymous-reviewers.tsx +37 -35
- package/src/scripts/dataset/routes/manage-permissions.jsx +22 -22
- package/src/scripts/dataset/routes/publish.jsx +32 -30
- package/src/scripts/dataset/routes/snapshot-default.tsx +7 -7
- package/src/scripts/dataset/routes/snapshot.tsx +44 -43
- package/src/scripts/dataset/routes/styles/dataset-page-border.tsx +3 -3
- package/src/scripts/dataset/routes/styles/dataset-page-tab-container.tsx +3 -3
- package/src/scripts/dataset/routes/styles/header-row.tsx +3 -3
- package/src/scripts/dataset/routes/tab-routes-draft.tsx +12 -12
- package/src/scripts/dataset/routes/tab-routes-snapshot.tsx +8 -8
- package/src/scripts/dataset/snapshot-container.tsx +78 -86
- package/src/scripts/errors/403page.tsx +11 -11
- package/src/scripts/errors/404page.tsx +12 -12
- package/src/scripts/errors/errorBoundary.jsx +13 -12
- package/src/scripts/errors/errorRoute.jsx +6 -6
- package/src/scripts/errors/freshdesk-widget.jsx +17 -20
- package/src/scripts/errors/freshdeskInterface.jsx +9 -9
- package/src/scripts/errors/orcid/email.jsx +3 -3
- package/src/scripts/errors/orcid/family.jsx +4 -4
- package/src/scripts/errors/orcid/general.jsx +1 -1
- package/src/scripts/errors/orcid/given.jsx +4 -4
- package/src/scripts/fixtures/dataset-query.ts +119 -119
- package/src/scripts/fixtures/mock-app-wrapper.tsx +4 -4
- package/src/scripts/index.tsx +9 -9
- package/src/scripts/pages/admin/admin.jsx +5 -5
- package/src/scripts/pages/admin/flagged-files.jsx +33 -31
- package/src/scripts/pages/admin/user-fragment.ts +1 -1
- package/src/scripts/pages/admin/user-tools.tsx +13 -11
- package/src/scripts/pages/admin/users.jsx +38 -39
- package/src/scripts/pages/api.jsx +20 -19
- package/src/scripts/pages/citation-page.tsx +4 -4
- package/src/scripts/pages/faq/faq.tsx +2 -2
- package/src/scripts/pages/front-page/aggregate-queries/aggregate-counts-container.tsx +6 -5
- package/src/scripts/pages/front-page/aggregate-queries/use-participant-count.ts +2 -2
- package/src/scripts/pages/front-page/aggregate-queries/use-publicDatasets-count.ts +2 -2
- package/src/scripts/pages/front-page/front-page-content.ts +42 -42
- package/src/scripts/pages/front-page/front-page.tsx +18 -14
- package/src/scripts/pages/front-page-comp.tsx +3 -3
- package/src/scripts/pages/import-dataset.tsx +10 -10
- package/src/scripts/pages/metadata/dataset-metadata.tsx +15 -14
- package/src/scripts/pages/pet-redirect.tsx +2 -2
- package/src/scripts/queries/dataset.ts +3 -3
- package/src/scripts/resources/__tests__/kibana.spec.js +9 -9
- package/src/scripts/resources/kibana.js +3 -3
- package/src/scripts/resources/strings.js +2 -2
- package/src/scripts/routes.tsx +14 -14
- package/src/scripts/search/__helpers__/search-render.tsx +3 -3
- package/src/scripts/search/__tests__/search-container.spec.tsx +22 -22
- package/src/scripts/search/__tests__/search-params-ctx.spec.tsx +20 -20
- package/src/scripts/search/es-query-builders.ts +21 -5
- package/src/scripts/search/filters-block-container.tsx +14 -16
- package/src/scripts/search/initial-search-params.tsx +45 -45
- package/src/scripts/search/inputs/__tests__/sort-by-select.spec.tsx +23 -23
- package/src/scripts/search/inputs/admin-allDatasets-toggle.tsx +12 -12
- package/src/scripts/search/inputs/age-range-input.tsx +9 -8
- package/src/scripts/search/inputs/author-input.tsx +14 -11
- package/src/scripts/search/inputs/date-radios.tsx +8 -7
- package/src/scripts/search/inputs/diagnosis-select.tsx +6 -6
- package/src/scripts/search/inputs/index.ts +33 -33
- package/src/scripts/search/inputs/keyword-input.tsx +13 -13
- package/src/scripts/search/inputs/modality-select.tsx +33 -30
- package/src/scripts/search/inputs/pet/bodyParts_input.tsx +18 -16
- package/src/scripts/search/inputs/pet/scannerManufacturersModelNames_input.tsx +18 -16
- package/src/scripts/search/inputs/pet/scannerManufacturers_input.tsx +18 -16
- package/src/scripts/search/inputs/pet/tracerNames_input.tsx +16 -15
- package/src/scripts/search/inputs/pet/tracerRadionuclides_input.tsx +18 -16
- package/src/scripts/search/inputs/section-select.tsx +6 -6
- package/src/scripts/search/inputs/sex-radios.tsx +6 -6
- package/src/scripts/search/inputs/show-datasets-radios.tsx +31 -29
- package/src/scripts/search/inputs/sort-by-select.tsx +10 -11
- package/src/scripts/search/inputs/species-select.tsx +6 -6
- package/src/scripts/search/inputs/study-domain-input.tsx +18 -16
- package/src/scripts/search/inputs/subject-count-range-input.tsx +8 -7
- package/src/scripts/search/inputs/task-input.tsx +18 -16
- package/src/scripts/search/search-container.tsx +83 -85
- package/src/scripts/search/search-params-ctx.tsx +40 -38
- package/src/scripts/search/search-routes.tsx +4 -4
- package/src/scripts/search/use-search-results.tsx +125 -99
- package/src/scripts/styles/media.tsx +3 -3
- package/src/scripts/styles/support-modal.jsx +2 -2
- package/src/scripts/sw.ts +12 -11
- package/src/scripts/test-utils.js +4 -4
- package/src/scripts/uploader/add-path-to-files.js +7 -7
- package/src/scripts/uploader/file-select.tsx +3 -3
- package/src/scripts/uploader/file-upload.js +13 -12
- package/src/scripts/uploader/input.jsx +8 -7
- package/src/scripts/uploader/upload-button.jsx +3 -3
- package/src/scripts/uploader/upload-disclaimer-input.tsx +66 -66
- package/src/scripts/uploader/upload-disclaimer.jsx +6 -5
- package/src/scripts/uploader/upload-file-status.jsx +4 -4
- package/src/scripts/uploader/upload-issues.jsx +32 -29
- package/src/scripts/uploader/upload-metadata.jsx +18 -17
- package/src/scripts/uploader/upload-mutation.js +17 -20
- package/src/scripts/uploader/upload-progress-button.jsx +5 -4
- package/src/scripts/uploader/upload-progress.jsx +3 -3
- package/src/scripts/uploader/upload-rename.jsx +6 -5
- package/src/scripts/uploader/upload-resume.jsx +26 -24
- package/src/scripts/uploader/upload-select.jsx +10 -9
- package/src/scripts/uploader/upload-status.jsx +5 -5
- package/src/scripts/uploader/upload-step.jsx +9 -9
- package/src/scripts/uploader/uploader-context.js +1 -1
- package/src/scripts/uploader/uploader-location.js +1 -1
- package/src/scripts/uploader/uploader-modal.jsx +8 -7
- package/src/scripts/uploader/uploader-setup-routes.jsx +10 -10
- package/src/scripts/uploader/uploader-status-routes.jsx +6 -6
- package/src/scripts/uploader/uploader-view.jsx +4 -4
- package/src/scripts/uploader/uploader.jsx +50 -48
- package/src/scripts/users/username.tsx +3 -3
- package/src/scripts/utils/__tests__/csv.spec.ts +16 -16
- package/src/scripts/utils/__tests__/date.spec.js +4 -4
- package/src/scripts/utils/__tests__/json-ld.spec.js +12 -12
- package/src/scripts/utils/__tests__/newid.spec.js +9 -9
- package/src/scripts/utils/__tests__/userNotify.spec.js +10 -10
- package/src/scripts/utils/analytics.tsx +3 -3
- package/src/scripts/utils/cookies.js +1 -1
- package/src/scripts/utils/csv.ts +13 -15
- package/src/scripts/utils/datalad.js +1 -1
- package/src/scripts/utils/dataset-url.js +2 -2
- package/src/scripts/utils/date.js +2 -2
- package/src/scripts/utils/global-polyfill.ts +2 -2
- package/src/scripts/utils/gtag.js +6 -6
- package/src/scripts/utils/json-ld.js +13 -13
- package/src/scripts/utils/newid.js +1 -1
- package/src/scripts/utils/user-login-modal-ctx.tsx +4 -4
- package/src/scripts/utils/userNotify.js +2 -2
- package/src/scripts/validation/validation-panel.jsx +3 -3
- package/src/scripts/validation/validation-results.issues.issue.jsx +9 -9
- package/src/scripts/validation/validation-results.issues.jsx +19 -17
- package/src/scripts/validation/validation-results.jsx +10 -10
- package/src/scripts/validation/validation-status.jsx +19 -17
- package/src/scripts/validation/validation.jsx +5 -5
- package/src/scripts/workers/schema.ts +2 -2
- package/src/scripts/workers/schema.worker.ts +4 -4
- package/src/scripts/workers/validate.ts +2 -2
- package/src/scripts/workers/validate.worker.ts +7 -5
- package/vite.config.js +17 -17
- package/src/dist/assets/activity-icon.9ab0c828.png +0 -0
- package/src/dist/assets/bids.da8810b3.jpg +0 -0
- package/src/dist/assets/brand_mark.28e7645d.png +0 -0
- package/src/dist/assets/close-button.21e700a6.png +0 -0
- package/src/dist/assets/cube-get.39ed5636.png +0 -0
- package/src/dist/assets/cube-share.9b558c29.png +0 -0
- package/src/dist/assets/cube-use.ccf2ddc5.png +0 -0
- package/src/dist/assets/datalad.a35b15b8.jpg +0 -0
- package/src/dist/assets/eeg.1dc1dc54.jpg +0 -0
- package/src/dist/assets/email-header.1cb8bf76.png +0 -0
- package/src/dist/assets/ieeg.f91deb0a.jpg +0 -0
- package/src/dist/assets/index.3db805fb.js +0 -23127
- package/src/dist/assets/index.3db805fb.js.map +0 -1
- package/src/dist/assets/index.5eb79d2c.css +0 -1
- package/src/dist/assets/ljaf.567e9566.png +0 -0
- package/src/dist/assets/logo_app.8c986cf9.png +0 -0
- package/src/dist/assets/logo_cube.5224b745.png +0 -0
- package/src/dist/assets/logo_data.3e1d5743.png +0 -0
- package/src/dist/assets/logo_users.a84a265a.png +0 -0
- package/src/dist/assets/meg.1e1928f8.jpg +0 -0
- package/src/dist/assets/mri.b01e4f42.jpg +0 -0
- package/src/dist/assets/nih-bi-logo.80d76e1d.png +0 -0
- package/src/dist/assets/nih-stanford.2a7c496e.jpg +0 -0
- package/src/dist/assets/nih.78a64d38.png +0 -0
- package/src/dist/assets/nimh.0ec775d8.png +0 -0
- package/src/dist/assets/nru-logo.f3097dc5.png +0 -0
- package/src/dist/assets/nsf.eee1d3f7.png +0 -0
- package/src/dist/assets/nsf.f87e96e7.png +0 -0
- package/src/dist/assets/on-dark-horz.e1f213d0.svg +0 -1
- package/src/dist/assets/on-dark.12f4e2ce.svg +0 -1
- package/src/dist/assets/on-light-horz.23ff22c3.svg +0 -1
- package/src/dist/assets/on-light.50592f7f.svg +0 -1
- package/src/dist/assets/pet-scan.21d98a3d.jpg +0 -0
- package/src/dist/assets/revicons.4ca02b8a.ttf +0 -0
- package/src/dist/assets/revicons.9e4d4c68.eot +0 -0
- package/src/dist/assets/revicons.f7b9c306.woff +0 -0
- package/src/dist/assets/sqm-logo.9cd0cca5.png +0 -0
- package/src/dist/assets/squishymedia.fa3c5919.png +0 -0
- package/src/dist/assets/stanford.5f245936.png +0 -0
- package/src/dist/index.html +0 -25
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render } from
|
|
3
|
-
import Comments from
|
|
4
|
-
import { vi } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { render } from "@testing-library/react"
|
|
3
|
+
import Comments from "../comments.jsx"
|
|
4
|
+
import { vi } from "vitest"
|
|
5
5
|
|
|
6
|
-
vi.mock(
|
|
6
|
+
vi.mock("../../../config.ts")
|
|
7
7
|
|
|
8
8
|
const emptyState =
|
|
9
9
|
'{"blocks":[{"key":"3sm42","text":"","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}'
|
|
10
10
|
const exampleComment = {
|
|
11
|
-
id:
|
|
11
|
+
id: "xyz",
|
|
12
12
|
text: emptyState,
|
|
13
|
-
user: { id:
|
|
13
|
+
user: { id: "1234", email: "example@example.com" },
|
|
14
14
|
replies: [],
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
describe(
|
|
18
|
-
it(
|
|
17
|
+
describe("Comments component", () => {
|
|
18
|
+
it("renders one top level comment", () => {
|
|
19
19
|
const { asFragment } = render(
|
|
20
20
|
<Comments datasetId="ds000001" comments={[exampleComment]} />,
|
|
21
21
|
)
|
|
22
22
|
expect(asFragment()).toMatchSnapshot()
|
|
23
23
|
})
|
|
24
|
-
it(
|
|
24
|
+
it("recursively renders a tree of comments", () => {
|
|
25
25
|
const comments = [{ ...exampleComment, replies: [exampleComment] }]
|
|
26
26
|
const { asFragment } = render(
|
|
27
27
|
<Comments datasetId="ds000001" comments={comments} />,
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import StyleButton from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import StyleButton from "./style-button.jsx"
|
|
4
4
|
|
|
5
5
|
const BLOCK_TYPES = [
|
|
6
|
-
{ label:
|
|
7
|
-
{ label:
|
|
8
|
-
{ label:
|
|
9
|
-
{ label:
|
|
10
|
-
{ label:
|
|
11
|
-
{ label:
|
|
12
|
-
{ label:
|
|
13
|
-
{ label:
|
|
14
|
-
{ label:
|
|
15
|
-
{ label:
|
|
6
|
+
{ label: "H1", style: "header-one" },
|
|
7
|
+
{ label: "H2", style: "header-two" },
|
|
8
|
+
{ label: "H3", style: "header-three" },
|
|
9
|
+
{ label: "H4", style: "header-four" },
|
|
10
|
+
{ label: "H5", style: "header-five" },
|
|
11
|
+
{ label: "H6", style: "header-six" },
|
|
12
|
+
{ label: "Blockquote", style: "blockquote" },
|
|
13
|
+
{ label: "UL", style: "unordered-list-item" },
|
|
14
|
+
{ label: "OL", style: "ordered-list-item" },
|
|
15
|
+
{ label: "Code Block", style: "code-block" },
|
|
16
16
|
]
|
|
17
17
|
|
|
18
|
-
const BlockStyleControls = props => {
|
|
18
|
+
const BlockStyleControls = (props) => {
|
|
19
19
|
const { editorState } = props
|
|
20
20
|
const selection = editorState.getSelection()
|
|
21
21
|
const blockType = editorState
|
|
@@ -25,7 +25,7 @@ const BlockStyleControls = props => {
|
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
27
|
<div className="RichEditor-controls">
|
|
28
|
-
{BLOCK_TYPES.map(type => (
|
|
28
|
+
{BLOCK_TYPES.map((type) => (
|
|
29
29
|
<StyleButton
|
|
30
30
|
key={type.label}
|
|
31
31
|
active={type.style === blockType}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import { Editor, EditorState, RichUtils } from
|
|
4
|
-
import CommentMutation from
|
|
5
|
-
import BlockStyleControls from
|
|
6
|
-
import InlineStyleControls from
|
|
1
|
+
import React, { useState } from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import { Editor, EditorState, RichUtils } from "draft-js"
|
|
4
|
+
import CommentMutation from "../mutations/comment.jsx"
|
|
5
|
+
import BlockStyleControls from "./block-style-controls.jsx"
|
|
6
|
+
import InlineStyleControls from "./inline-style-controls.jsx"
|
|
7
7
|
|
|
8
|
-
const getBlockStyle = block =>
|
|
9
|
-
block.getType() ===
|
|
8
|
+
const getBlockStyle = (block) =>
|
|
9
|
+
block.getType() === "blockquote" ? "RichEditor-blockquote" : null
|
|
10
10
|
|
|
11
11
|
const CommentEditor = ({
|
|
12
12
|
datasetId,
|
|
@@ -27,15 +27,13 @@ const CommentEditor = ({
|
|
|
27
27
|
<div className="RichEditor-root">
|
|
28
28
|
<BlockStyleControls
|
|
29
29
|
editorState={editorState}
|
|
30
|
-
onToggle={blockType =>
|
|
31
|
-
setEditorState(RichUtils.toggleBlockType(editorState, blockType))
|
|
32
|
-
}
|
|
30
|
+
onToggle={(blockType) =>
|
|
31
|
+
setEditorState(RichUtils.toggleBlockType(editorState, blockType))}
|
|
33
32
|
/>
|
|
34
33
|
<InlineStyleControls
|
|
35
34
|
editorState={editorState}
|
|
36
|
-
onToggle={inlineStyle =>
|
|
37
|
-
setEditorState(RichUtils.toggleInlineStyle(editorState, inlineStyle))
|
|
38
|
-
}
|
|
35
|
+
onToggle={(inlineStyle) =>
|
|
36
|
+
setEditorState(RichUtils.toggleInlineStyle(editorState, inlineStyle))}
|
|
39
37
|
/>
|
|
40
38
|
<div className="RichEditor-editor">
|
|
41
39
|
<Editor
|
|
@@ -46,23 +44,25 @@ const CommentEditor = ({
|
|
|
46
44
|
placeholder=""
|
|
47
45
|
spellCheck
|
|
48
46
|
/>
|
|
49
|
-
{commentId
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
47
|
+
{commentId
|
|
48
|
+
? (
|
|
49
|
+
<CommentMutation
|
|
50
|
+
datasetId={datasetId}
|
|
51
|
+
commentId={commentId}
|
|
52
|
+
comment={editorState.getCurrentContent()}
|
|
53
|
+
disabled={disabled}
|
|
54
|
+
done={doAfterSubmit}
|
|
55
|
+
/>
|
|
56
|
+
)
|
|
57
|
+
: (
|
|
58
|
+
<CommentMutation
|
|
59
|
+
datasetId={datasetId}
|
|
60
|
+
parentId={parentId}
|
|
61
|
+
comment={editorState.getCurrentContent()}
|
|
62
|
+
disabled={disabled}
|
|
63
|
+
done={doAfterSubmit}
|
|
64
|
+
/>
|
|
65
|
+
)}
|
|
66
66
|
</div>
|
|
67
67
|
</div>
|
|
68
68
|
)
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { Editor, EditorState
|
|
3
|
-
import PropTypes from
|
|
4
|
-
import parseISO from
|
|
5
|
-
import formatDistanceToNow from
|
|
1
|
+
import React, { useState } from "react"
|
|
2
|
+
import { convertFromRaw, Editor, EditorState } from "draft-js"
|
|
3
|
+
import PropTypes from "prop-types"
|
|
4
|
+
import parseISO from "date-fns/parseISO"
|
|
5
|
+
import formatDistanceToNow from "date-fns/formatDistanceToNow"
|
|
6
6
|
|
|
7
|
-
import CommentEditor from
|
|
8
|
-
import DeleteComment from
|
|
9
|
-
import AdminUser from
|
|
10
|
-
import LoggedIn from
|
|
11
|
-
import { toast } from
|
|
12
|
-
import ToastContent from
|
|
13
|
-
import { Icon } from
|
|
14
|
-
import { Username } from
|
|
7
|
+
import CommentEditor from "./comment-editor.jsx"
|
|
8
|
+
import DeleteComment from "../mutations/delete-comment.jsx"
|
|
9
|
+
import AdminUser from "../../authentication/admin-user.jsx"
|
|
10
|
+
import LoggedIn from "../../authentication/logged-in.jsx"
|
|
11
|
+
import { toast } from "react-toastify"
|
|
12
|
+
import ToastContent from "../../common/partials/toast-content"
|
|
13
|
+
import { Icon } from "@openneuro/components/icon"
|
|
14
|
+
import { Username } from "../../users/username"
|
|
15
15
|
|
|
16
16
|
const Comment = ({ datasetId, data, children }) => {
|
|
17
17
|
const [replyMode, setReplyMode] = useState(false)
|
|
@@ -26,45 +26,43 @@ const Comment = ({ datasetId, data, children }) => {
|
|
|
26
26
|
{` - ${formatDistanceToNow(parseISO(data.createDate))} ago`}
|
|
27
27
|
</div>
|
|
28
28
|
<div className="row comment-body">
|
|
29
|
-
{editMode
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
29
|
+
{editMode
|
|
30
|
+
? (
|
|
31
|
+
<CommentEditor
|
|
32
|
+
datasetId={datasetId}
|
|
33
|
+
commentId={data.id}
|
|
34
|
+
state={editorState}
|
|
35
|
+
done={() => setEditMode(false)}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
: (
|
|
39
|
+
<Editor
|
|
40
|
+
editorKey={data.id}
|
|
41
|
+
editorState={editorState}
|
|
42
|
+
readOnly={true}
|
|
43
|
+
onChange={() => {
|
|
44
|
+
/* Not editable, this shouldn't fire */
|
|
45
|
+
}}
|
|
46
|
+
/>
|
|
47
|
+
)}
|
|
46
48
|
</div>
|
|
47
49
|
<LoggedIn>
|
|
48
50
|
<div className="row comment-controls grid grid-start">
|
|
49
51
|
{editMode ? null : (
|
|
50
52
|
<div className="col col-fixed">
|
|
51
53
|
<a className="reply" onClick={() => setReplyMode(!replyMode)}>
|
|
52
|
-
{replyMode
|
|
53
|
-
<Icon icon="fa fa-times" label="Close" />
|
|
54
|
-
|
|
55
|
-
<Icon icon="fa fa-comment" label="Reply" />
|
|
56
|
-
)}
|
|
54
|
+
{replyMode
|
|
55
|
+
? <Icon icon="fa fa-times" label="Close" />
|
|
56
|
+
: <Icon icon="fa fa-comment" label="Reply" />}
|
|
57
57
|
</a>
|
|
58
58
|
</div>
|
|
59
59
|
)}
|
|
60
60
|
{replyMode ? null : (
|
|
61
61
|
<div className="col col-fixed">
|
|
62
62
|
<a className="edit" onClick={() => setEditMode(!editMode)}>
|
|
63
|
-
{editMode
|
|
64
|
-
<Icon icon="fa fa-times" label="Close" />
|
|
65
|
-
|
|
66
|
-
<Icon icon="fa fa-edit" label="Edit" />
|
|
67
|
-
)}
|
|
63
|
+
{editMode
|
|
64
|
+
? <Icon icon="fa fa-times" label="Close" />
|
|
65
|
+
: <Icon icon="fa fa-edit" label="Edit" />}
|
|
68
66
|
</a>
|
|
69
67
|
</div>
|
|
70
68
|
)}
|
|
@@ -76,16 +74,18 @@ const Comment = ({ datasetId, data, children }) => {
|
|
|
76
74
|
</div>
|
|
77
75
|
<div className="row replies">
|
|
78
76
|
<div className="comment-reply">
|
|
79
|
-
{replyMode
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
77
|
+
{replyMode
|
|
78
|
+
? (
|
|
79
|
+
<CommentEditor
|
|
80
|
+
datasetId={datasetId}
|
|
81
|
+
parentId={data.id}
|
|
82
|
+
done={() => {
|
|
83
|
+
setReplyMode(false)
|
|
84
|
+
toast.success(<ToastContent title="Reply Posted" />)
|
|
85
|
+
}}
|
|
86
|
+
/>
|
|
87
|
+
)
|
|
88
|
+
: null}
|
|
89
89
|
</div>
|
|
90
90
|
{children}
|
|
91
91
|
</div>
|
|
@@ -1,32 +1,34 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { toast } from
|
|
3
|
-
import PropTypes from
|
|
4
|
-
import Comment from
|
|
5
|
-
import CommentEditor from
|
|
6
|
-
import LoggedIn from
|
|
7
|
-
import LoggedOut from
|
|
8
|
-
import ErrorBoundary from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { toast } from "react-toastify"
|
|
3
|
+
import PropTypes from "prop-types"
|
|
4
|
+
import Comment from "./comment.jsx"
|
|
5
|
+
import CommentEditor from "./comment-editor.jsx"
|
|
6
|
+
import LoggedIn from "../../authentication/logged-in.jsx"
|
|
7
|
+
import LoggedOut from "../../authentication/logged-out.jsx"
|
|
8
|
+
import ErrorBoundary from "../../errors/errorBoundary.jsx"
|
|
9
9
|
|
|
10
|
-
import ToastContent from
|
|
10
|
+
import ToastContent from "../../common/partials/toast-content.jsx"
|
|
11
11
|
|
|
12
12
|
const CommentTree = ({ datasetId, uploader, comments, commentMap }) => (
|
|
13
13
|
<>
|
|
14
|
-
{comments.map(comment => {
|
|
14
|
+
{comments.map((comment) => {
|
|
15
15
|
if (!comment) return null
|
|
16
16
|
// Join any replies
|
|
17
|
-
const nextLevel = comment.hasOwnProperty(
|
|
18
|
-
? comment.replies.map(reply => commentMap[reply.id])
|
|
17
|
+
const nextLevel = comment.hasOwnProperty("replies")
|
|
18
|
+
? comment.replies.map((reply) => commentMap[reply.id])
|
|
19
19
|
: []
|
|
20
20
|
return (
|
|
21
21
|
<Comment key={comment.id} datasetId={datasetId} data={comment}>
|
|
22
|
-
{nextLevel.length
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
{nextLevel.length
|
|
23
|
+
? (
|
|
24
|
+
<CommentTree
|
|
25
|
+
datasetId={datasetId}
|
|
26
|
+
uploader={uploader}
|
|
27
|
+
comments={nextLevel}
|
|
28
|
+
commentMap={commentMap}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
: null}
|
|
30
32
|
</Comment>
|
|
31
33
|
)
|
|
32
34
|
})}
|
|
@@ -43,10 +45,10 @@ CommentTree.propTypes = {
|
|
|
43
45
|
const Comments = ({ datasetId, uploader, comments }) => {
|
|
44
46
|
// Fast access map to dereference replies in CommentTree component
|
|
45
47
|
const commentMap = Object.fromEntries(
|
|
46
|
-
comments.map(comment => [comment.id, comment]),
|
|
48
|
+
comments.map((comment) => [comment.id, comment]),
|
|
47
49
|
)
|
|
48
50
|
// Get only top level comments
|
|
49
|
-
const rootComments = comments.filter(comment => comment.parent === null)
|
|
51
|
+
const rootComments = comments.filter((comment) => comment.parent === null)
|
|
50
52
|
return (
|
|
51
53
|
<div className="dataset-comments">
|
|
52
54
|
<h2>Comments</h2>
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import StyleButton from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import StyleButton from "./style-button.jsx"
|
|
4
4
|
|
|
5
5
|
const INLINE_STYLES = [
|
|
6
|
-
{ label:
|
|
7
|
-
{ label:
|
|
8
|
-
{ label:
|
|
9
|
-
{ label:
|
|
6
|
+
{ label: "Bold", style: "BOLD" },
|
|
7
|
+
{ label: "Italic", style: "ITALIC" },
|
|
8
|
+
{ label: "Underline", style: "UNDERLINE" },
|
|
9
|
+
{ label: "Monospace", style: "CODE" },
|
|
10
10
|
]
|
|
11
11
|
|
|
12
|
-
const InlineStyleControls = props => {
|
|
12
|
+
const InlineStyleControls = (props) => {
|
|
13
13
|
const currentStyle = props.editorState.getCurrentInlineStyle()
|
|
14
14
|
return (
|
|
15
15
|
<div className="RichEditor-controls">
|
|
16
|
-
{INLINE_STYLES.map(type => (
|
|
16
|
+
{INLINE_STYLES.map((type) => (
|
|
17
17
|
<StyleButton
|
|
18
18
|
key={type.label}
|
|
19
19
|
active={currentStyle.has(type.style)}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
3
|
|
|
4
4
|
const StyleButton = ({ style, label, active, onToggle }) => {
|
|
5
5
|
return (
|
|
6
6
|
<span
|
|
7
|
-
className={
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
onMouseDown={e => {
|
|
7
|
+
className={active
|
|
8
|
+
? "RichEditor-styleButton RichEditor-activeButton"
|
|
9
|
+
: "RichEditor-styleButton"}
|
|
10
|
+
onMouseDown={(e) => {
|
|
13
11
|
e.preventDefault()
|
|
14
12
|
onToggle(style)
|
|
15
|
-
}}
|
|
13
|
+
}}
|
|
14
|
+
>
|
|
16
15
|
{label}
|
|
17
16
|
</span>
|
|
18
17
|
)
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { apm } from
|
|
2
|
-
import React from
|
|
3
|
-
import PropTypes from
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { Loading } from
|
|
1
|
+
import { apm } from "../apm"
|
|
2
|
+
import React from "react"
|
|
3
|
+
import PropTypes from "prop-types"
|
|
4
|
+
import { useNavigate, useParams } from "react-router-dom"
|
|
5
|
+
import { gql, useApolloClient, useQuery } from "@apollo/client"
|
|
6
|
+
import { Loading } from "@openneuro/components/loading"
|
|
7
7
|
|
|
8
|
-
import DatasetQueryContext from
|
|
9
|
-
import DatasetContext from
|
|
10
|
-
import DatasetRoutes from
|
|
11
|
-
import FilesSubscription from
|
|
12
|
-
import usePermissionsSubscription from
|
|
13
|
-
import useSnapshotsUpdatedSubscriptions from
|
|
8
|
+
import DatasetQueryContext from "../datalad/dataset/dataset-query-context.js"
|
|
9
|
+
import DatasetContext from "../datalad/dataset/dataset-context.js"
|
|
10
|
+
import DatasetRoutes from "./dataset-routes"
|
|
11
|
+
import FilesSubscription from "../datalad/subscriptions/files-subscription.jsx"
|
|
12
|
+
import usePermissionsSubscription from "../datalad/subscriptions/usePermissionsSubscription"
|
|
13
|
+
import useSnapshotsUpdatedSubscriptions from "../datalad/subscriptions/useSnapshotsUpdatedSubscriptions"
|
|
14
14
|
import useDatasetDeletedSubscription, {
|
|
15
15
|
datasetDeletedToast,
|
|
16
|
-
} from
|
|
17
|
-
import useDraftSubscription from
|
|
16
|
+
} from "../datalad/subscriptions/useDatasetDeletedSubscription.jsx"
|
|
17
|
+
import useDraftSubscription from "../datalad/subscriptions/useDraftSubscription.js"
|
|
18
18
|
|
|
19
19
|
import ErrorBoundary, {
|
|
20
20
|
ErrorBoundaryAssertionFailureException,
|
|
21
|
-
} from
|
|
22
|
-
import DatasetRedirect from
|
|
23
|
-
import { trackAnalytics } from
|
|
24
|
-
import FourOFourPage from
|
|
25
|
-
import FourOThreePage from
|
|
26
|
-
import { getDatasetPage, getDraftPage } from
|
|
21
|
+
} from "../errors/errorBoundary.jsx"
|
|
22
|
+
import DatasetRedirect from "../datalad/routes/dataset-redirect"
|
|
23
|
+
import { trackAnalytics } from "../utils/datalad"
|
|
24
|
+
import FourOFourPage from "../errors/404page"
|
|
25
|
+
import FourOThreePage from "../errors/403page"
|
|
26
|
+
import { getDatasetPage, getDraftPage } from "../queries/dataset"
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Query to load and render dataset page - most dataset loading is done here
|
|
@@ -37,27 +37,27 @@ export const DatasetQueryHook = ({ datasetId, draft }) => {
|
|
|
37
37
|
draft ? getDraftPage : getDatasetPage,
|
|
38
38
|
{
|
|
39
39
|
variables: { datasetId },
|
|
40
|
-
fetchPolicy:
|
|
41
|
-
nextFetchPolicy:
|
|
40
|
+
fetchPolicy: "cache-and-network",
|
|
41
|
+
nextFetchPolicy: "cache-first",
|
|
42
42
|
},
|
|
43
43
|
)
|
|
44
44
|
usePermissionsSubscription([datasetId])
|
|
45
45
|
useSnapshotsUpdatedSubscriptions(datasetId)
|
|
46
46
|
useDatasetDeletedSubscription([datasetId], ({ data: subData }) => {
|
|
47
47
|
if (subData && subData.datasetDeleted === datasetId) {
|
|
48
|
-
navigate(
|
|
48
|
+
navigate("/dashboard/datasets")
|
|
49
49
|
datasetDeletedToast(datasetId, data?.dataset?.draft?.description?.Name)
|
|
50
50
|
}
|
|
51
51
|
})
|
|
52
52
|
useDraftSubscription(datasetId)
|
|
53
53
|
|
|
54
54
|
if (error) {
|
|
55
|
-
if (error.message ===
|
|
55
|
+
if (error.message === "You do not have access to read this dataset.") {
|
|
56
56
|
return <FourOThreePage />
|
|
57
|
-
} else if (error.message.includes(
|
|
57
|
+
} else if (error.message.includes("has been deleted")) {
|
|
58
58
|
for (const err of error.graphQLErrors) {
|
|
59
59
|
if (
|
|
60
|
-
err.extensions.code ===
|
|
60
|
+
err.extensions.code === "DELETED_DATASET" &&
|
|
61
61
|
err.extensions.redirect
|
|
62
62
|
) {
|
|
63
63
|
navigate(err.extensions.redirect)
|
|
@@ -73,24 +73,26 @@ export const DatasetQueryHook = ({ datasetId, draft }) => {
|
|
|
73
73
|
return <FourOFourPage />
|
|
74
74
|
}
|
|
75
75
|
} else {
|
|
76
|
-
if (loading || !data)
|
|
76
|
+
if (loading || !data) {
|
|
77
77
|
return (
|
|
78
78
|
<div className="loading-dataset">
|
|
79
79
|
<Loading />
|
|
80
80
|
Loading Dataset
|
|
81
81
|
</div>
|
|
82
82
|
)
|
|
83
|
+
}
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
return (
|
|
86
87
|
<DatasetContext.Provider value={data.dataset}>
|
|
87
|
-
<ErrorBoundary subject={
|
|
88
|
+
<ErrorBoundary subject={"error in dataset page"}>
|
|
88
89
|
<DatasetQueryContext.Provider
|
|
89
90
|
value={{
|
|
90
91
|
datasetId,
|
|
91
92
|
fetchMore,
|
|
92
93
|
error,
|
|
93
|
-
}}
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
94
96
|
<DatasetRoutes dataset={data.dataset} />
|
|
95
97
|
<FilesSubscription datasetId={datasetId} />
|
|
96
98
|
</DatasetQueryContext.Provider>
|
|
@@ -115,13 +117,14 @@ const DatasetQuery = () => {
|
|
|
115
117
|
trackAnalytics(client, datasetId, {
|
|
116
118
|
snapshot: true,
|
|
117
119
|
tag: snapshotId,
|
|
118
|
-
type:
|
|
120
|
+
type: "views",
|
|
119
121
|
})
|
|
120
122
|
return (
|
|
121
123
|
<>
|
|
122
124
|
<DatasetRedirect />
|
|
123
125
|
<ErrorBoundaryAssertionFailureException
|
|
124
|
-
subject={
|
|
126
|
+
subject={"error in dataset query"}
|
|
127
|
+
>
|
|
125
128
|
<DatasetQueryHook datasetId={datasetId} draft={!snapshotId} />
|
|
126
129
|
</ErrorBoundaryAssertionFailureException>
|
|
127
130
|
</>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, { useEffect } from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import { Route, Routes } from
|
|
4
|
-
import SnapshotContainer from
|
|
5
|
-
import DraftContainer from
|
|
1
|
+
import React, { useEffect } from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import { Route, Routes } from "react-router-dom"
|
|
4
|
+
import SnapshotContainer from "./snapshot-container"
|
|
5
|
+
import DraftContainer from "./draft-container"
|
|
6
6
|
|
|
7
7
|
const DatasetRoutes = ({ dataset, error }) => {
|
|
8
8
|
useEffect(() => {
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render, screen } from
|
|
3
|
-
import { DownloadSampleCommand } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { render, screen } from "@testing-library/react"
|
|
3
|
+
import { DownloadSampleCommand } from "../download-command-line.jsx"
|
|
4
4
|
|
|
5
|
-
const defProps = { datasetId:
|
|
5
|
+
const defProps = { datasetId: "ds000001" }
|
|
6
6
|
|
|
7
|
-
describe(
|
|
8
|
-
describe(
|
|
9
|
-
it(
|
|
7
|
+
describe("dataset/download", () => {
|
|
8
|
+
describe("DownloadSampleCommand component", () => {
|
|
9
|
+
it("renders successfully", () => {
|
|
10
10
|
const { asFragment } = render(<DownloadSampleCommand {...defProps} />)
|
|
11
11
|
expect(asFragment()).toMatchSnapshot()
|
|
12
12
|
})
|
|
13
|
-
it(
|
|
13
|
+
it("drafts show draft flag", () => {
|
|
14
14
|
render(<DownloadSampleCommand {...defProps} />)
|
|
15
|
-
expect(screen.getByRole(
|
|
16
|
-
expect(screen.queryByText(
|
|
15
|
+
expect(screen.getByRole("figure")).toHaveTextContent("--draft")
|
|
16
|
+
expect(screen.queryByText("--snapshot")).not.toBeInTheDocument()
|
|
17
17
|
})
|
|
18
|
-
it(
|
|
18
|
+
it("snapshots show snapshot flag", () => {
|
|
19
19
|
render(<DownloadSampleCommand {...defProps} snapshotTag="1.0.0" />)
|
|
20
|
-
expect(screen.getByRole(
|
|
21
|
-
expect(screen.queryByText(
|
|
20
|
+
expect(screen.getByRole("figure")).toHaveTextContent("--snapshot")
|
|
21
|
+
expect(screen.queryByText("--draft")).not.toBeInTheDocument()
|
|
22
22
|
})
|
|
23
23
|
})
|
|
24
24
|
})
|