@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,13 +1,13 @@
|
|
|
1
|
-
import { describe,
|
|
2
|
-
import React from
|
|
3
|
-
import {
|
|
4
|
-
import { createMemoryHistory } from
|
|
5
|
-
import { MockedProvider } from
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { describe, expect, it, vi } from "vitest"
|
|
2
|
+
import React from "react"
|
|
3
|
+
import { fireEvent, render, screen, waitFor } from "@testing-library/react"
|
|
4
|
+
import { createMemoryHistory } from "history"
|
|
5
|
+
import { MockedProvider } from "@apollo/client/testing"
|
|
6
|
+
import { MemoryRouter, Router } from "react-router-dom"
|
|
7
|
+
import { DEPRECATE_VERSION, DeprecateVersion } from "../deprecate-version"
|
|
8
8
|
|
|
9
|
-
describe(
|
|
10
|
-
it(
|
|
9
|
+
describe("DeprecateVersion mutation", () => {
|
|
10
|
+
it("renders with typical props", () => {
|
|
11
11
|
const { asFragment } = render(
|
|
12
12
|
<MemoryRouter>
|
|
13
13
|
<MockedProvider>
|
|
@@ -21,14 +21,14 @@ describe('DeprecateVersion mutation', () => {
|
|
|
21
21
|
)
|
|
22
22
|
expect(asFragment()).toMatchSnapshot()
|
|
23
23
|
})
|
|
24
|
-
it(
|
|
25
|
-
const datasetId =
|
|
26
|
-
const tag =
|
|
27
|
-
const reason =
|
|
24
|
+
it("calls the DEPRECATE_VERSION mutation when clicked and navigates to the snapshot on success", async () => {
|
|
25
|
+
const datasetId = "test00001"
|
|
26
|
+
const tag = "1.0.0"
|
|
27
|
+
const reason = "This is a test suite."
|
|
28
28
|
const history = createMemoryHistory({
|
|
29
29
|
initialEntries: [`/datasets/${datasetId}/versions/${tag}/deprecate`],
|
|
30
30
|
})
|
|
31
|
-
const historyPushSpy = vi.spyOn(history,
|
|
31
|
+
const historyPushSpy = vi.spyOn(history, "push")
|
|
32
32
|
const snapshotId = `${datasetId}:${tag}`
|
|
33
33
|
const deprecateSnapshotMock = {
|
|
34
34
|
request: {
|
|
@@ -42,12 +42,12 @@ describe('DeprecateVersion mutation', () => {
|
|
|
42
42
|
result: {
|
|
43
43
|
data: {
|
|
44
44
|
deprecateSnapshot: {
|
|
45
|
-
__typename:
|
|
45
|
+
__typename: "Snapshot",
|
|
46
46
|
id: snapshotId,
|
|
47
47
|
deprecated: {
|
|
48
|
-
__typename:
|
|
48
|
+
__typename: "DeprecatedSnapshot",
|
|
49
49
|
id: snapshotId,
|
|
50
|
-
user:
|
|
50
|
+
user: "1245",
|
|
51
51
|
reason,
|
|
52
52
|
},
|
|
53
53
|
},
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { describe,
|
|
2
|
-
import React from
|
|
3
|
-
import {
|
|
4
|
-
import { MockedProvider } from
|
|
1
|
+
import { describe, expect, it, vi } from "vitest"
|
|
2
|
+
import React from "react"
|
|
3
|
+
import { fireEvent, render, screen, waitFor } from "@testing-library/react"
|
|
4
|
+
import { MockedProvider } from "@apollo/client/testing"
|
|
5
5
|
import {
|
|
6
6
|
Router,
|
|
7
7
|
unstable_HistoryRouter as HistoryRouter,
|
|
8
|
-
} from
|
|
9
|
-
import { createMemoryHistory } from
|
|
10
|
-
import {
|
|
8
|
+
} from "react-router-dom"
|
|
9
|
+
import { createMemoryHistory } from "history"
|
|
10
|
+
import { DEPRECATE_VERSION, DeprecateVersion } from "../deprecate-version"
|
|
11
11
|
|
|
12
|
-
describe(
|
|
13
|
-
it(
|
|
14
|
-
const datasetId =
|
|
15
|
-
const tag =
|
|
12
|
+
describe("DeprecateVersion mutation", () => {
|
|
13
|
+
it("renders with typical props", () => {
|
|
14
|
+
const datasetId = "test00001"
|
|
15
|
+
const tag = "1.0.0"
|
|
16
16
|
const history = createMemoryHistory({
|
|
17
17
|
initialEntries: [`/datasets/${datasetId}/versions/${tag}/deprecate`],
|
|
18
18
|
})
|
|
@@ -29,14 +29,14 @@ describe('DeprecateVersion mutation', () => {
|
|
|
29
29
|
)
|
|
30
30
|
expect(asFragment()).toMatchSnapshot()
|
|
31
31
|
})
|
|
32
|
-
it(
|
|
33
|
-
const datasetId =
|
|
34
|
-
const tag =
|
|
35
|
-
const reason =
|
|
32
|
+
it("calls the DEPRECATE_VERSION mutation when clicked and navigates to the snapshot on success", async () => {
|
|
33
|
+
const datasetId = "test00001"
|
|
34
|
+
const tag = "1.0.0"
|
|
35
|
+
const reason = "This is a test suite."
|
|
36
36
|
const history = createMemoryHistory({
|
|
37
37
|
initialEntries: [`/datasets/${datasetId}/versions/${tag}/deprecate`],
|
|
38
38
|
})
|
|
39
|
-
const historyPushSpy = vi.spyOn(history,
|
|
39
|
+
const historyPushSpy = vi.spyOn(history, "push")
|
|
40
40
|
const snapshotId = `${datasetId}:${tag}`
|
|
41
41
|
const deprecateSnapshotMock = {
|
|
42
42
|
request: {
|
|
@@ -50,12 +50,12 @@ describe('DeprecateVersion mutation', () => {
|
|
|
50
50
|
result: {
|
|
51
51
|
data: {
|
|
52
52
|
deprecateSnapshot: {
|
|
53
|
-
__typename:
|
|
53
|
+
__typename: "Snapshot",
|
|
54
54
|
id: snapshotId,
|
|
55
55
|
deprecated: {
|
|
56
|
-
__typename:
|
|
56
|
+
__typename: "DeprecatedSnapshot",
|
|
57
57
|
id: snapshotId,
|
|
58
|
-
user:
|
|
58
|
+
user: "1245",
|
|
59
59
|
reason,
|
|
60
60
|
},
|
|
61
61
|
},
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render } from
|
|
3
|
-
import { MockedProvider } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { render } from "@testing-library/react"
|
|
3
|
+
import { MockedProvider } from "@apollo/client/testing"
|
|
4
4
|
import UpdateDescription, {
|
|
5
5
|
mergeFieldValue,
|
|
6
6
|
UPDATE_DESCRIPTION,
|
|
7
7
|
UPDATE_DESCRIPTION_LIST,
|
|
8
|
-
} from
|
|
8
|
+
} from "../description.jsx"
|
|
9
9
|
|
|
10
10
|
const mockMutation = vi.fn()
|
|
11
|
-
vi.mock(
|
|
12
|
-
...vi.importActual(
|
|
13
|
-
Mutation: props => {
|
|
11
|
+
vi.mock("@apollo/client/react/components", () => ({
|
|
12
|
+
...vi.importActual("@apollo/client/react/components"),
|
|
13
|
+
Mutation: (props) => {
|
|
14
14
|
mockMutation(props)
|
|
15
15
|
return <>Mutation mock</>
|
|
16
16
|
},
|
|
17
17
|
}))
|
|
18
18
|
|
|
19
|
-
describe(
|
|
20
|
-
it(
|
|
19
|
+
describe("UpdateDescription mutation", () => {
|
|
20
|
+
it("renders with common props", () => {
|
|
21
21
|
const { asFragment } = render(
|
|
22
22
|
<UpdateDescription
|
|
23
23
|
datasetId="ds001"
|
|
@@ -29,7 +29,7 @@ describe('UpdateDescription mutation', () => {
|
|
|
29
29
|
)
|
|
30
30
|
expect(asFragment()).toMatchSnapshot()
|
|
31
31
|
})
|
|
32
|
-
it(
|
|
32
|
+
it("uses the scalar mutation for scalar values", () => {
|
|
33
33
|
render(
|
|
34
34
|
<UpdateDescription
|
|
35
35
|
datasetId="ds001"
|
|
@@ -43,12 +43,12 @@ describe('UpdateDescription mutation', () => {
|
|
|
43
43
|
expect.objectContaining({ mutation: UPDATE_DESCRIPTION }),
|
|
44
44
|
)
|
|
45
45
|
})
|
|
46
|
-
it(
|
|
46
|
+
it("uses the list mutation for array values", () => {
|
|
47
47
|
render(
|
|
48
48
|
<UpdateDescription
|
|
49
49
|
datasetId="ds001"
|
|
50
50
|
field="Authors"
|
|
51
|
-
value={[
|
|
51
|
+
value={["John Doe", "Jane Doe"]}
|
|
52
52
|
done={vi.fn()}
|
|
53
53
|
/>,
|
|
54
54
|
{ wrapper: MockedProvider },
|
|
@@ -57,76 +57,76 @@ describe('UpdateDescription mutation', () => {
|
|
|
57
57
|
expect.objectContaining({ mutation: UPDATE_DESCRIPTION_LIST }),
|
|
58
58
|
)
|
|
59
59
|
})
|
|
60
|
-
describe(
|
|
61
|
-
it(
|
|
60
|
+
describe("mergeFieldValue()", () => {
|
|
61
|
+
it("merges in scalar fields", () => {
|
|
62
62
|
expect(
|
|
63
63
|
mergeFieldValue(
|
|
64
|
-
|
|
64
|
+
"ds001",
|
|
65
65
|
{
|
|
66
|
-
__typename:
|
|
67
|
-
id:
|
|
68
|
-
created:
|
|
66
|
+
__typename: "Draft",
|
|
67
|
+
id: "1234",
|
|
68
|
+
created: "1999",
|
|
69
69
|
description: {
|
|
70
|
-
Name:
|
|
71
|
-
BIDSVersion:
|
|
72
|
-
License:
|
|
70
|
+
Name: "Old Name",
|
|
71
|
+
BIDSVersion: "1.2",
|
|
72
|
+
License: "AGPL3",
|
|
73
73
|
},
|
|
74
74
|
},
|
|
75
|
-
{ Name:
|
|
75
|
+
{ Name: "New Name", BIDSVersion: "1.2", License: "AGPL3" },
|
|
76
76
|
null,
|
|
77
77
|
),
|
|
78
78
|
).toEqual({
|
|
79
|
-
__typename:
|
|
79
|
+
__typename: "Dataset",
|
|
80
80
|
draft: {
|
|
81
|
-
__typename:
|
|
82
|
-
created:
|
|
81
|
+
__typename: "Draft",
|
|
82
|
+
created: "1999",
|
|
83
83
|
description: {
|
|
84
|
-
BIDSVersion:
|
|
85
|
-
License:
|
|
86
|
-
Name:
|
|
84
|
+
BIDSVersion: "1.2",
|
|
85
|
+
License: "AGPL3",
|
|
86
|
+
Name: "New Name",
|
|
87
87
|
},
|
|
88
|
-
id:
|
|
88
|
+
id: "1234",
|
|
89
89
|
},
|
|
90
|
-
id:
|
|
90
|
+
id: "ds001",
|
|
91
91
|
})
|
|
92
92
|
})
|
|
93
|
-
it(
|
|
93
|
+
it("merges in array fields", () => {
|
|
94
94
|
expect(
|
|
95
95
|
mergeFieldValue(
|
|
96
|
-
|
|
96
|
+
"ds001",
|
|
97
97
|
{
|
|
98
|
-
__typename:
|
|
99
|
-
id:
|
|
100
|
-
created:
|
|
98
|
+
__typename: "Draft",
|
|
99
|
+
id: "1234",
|
|
100
|
+
created: "1999",
|
|
101
101
|
description: {
|
|
102
|
-
Name:
|
|
103
|
-
BIDSVersion:
|
|
104
|
-
License:
|
|
102
|
+
Name: "Old Name",
|
|
103
|
+
BIDSVersion: "1.2",
|
|
104
|
+
License: "AGPL3",
|
|
105
105
|
Authors: [],
|
|
106
106
|
},
|
|
107
107
|
},
|
|
108
108
|
null,
|
|
109
109
|
{
|
|
110
|
-
Name:
|
|
111
|
-
BIDSVersion:
|
|
112
|
-
License:
|
|
113
|
-
Authors: [
|
|
110
|
+
Name: "New Name",
|
|
111
|
+
BIDSVersion: "1.2",
|
|
112
|
+
License: "AGPL3",
|
|
113
|
+
Authors: ["One", "Two"],
|
|
114
114
|
},
|
|
115
115
|
),
|
|
116
116
|
).toEqual({
|
|
117
|
-
__typename:
|
|
117
|
+
__typename: "Dataset",
|
|
118
118
|
draft: {
|
|
119
|
-
__typename:
|
|
120
|
-
created:
|
|
119
|
+
__typename: "Draft",
|
|
120
|
+
created: "1999",
|
|
121
121
|
description: {
|
|
122
|
-
Authors: [
|
|
123
|
-
BIDSVersion:
|
|
124
|
-
License:
|
|
125
|
-
Name:
|
|
122
|
+
Authors: ["One", "Two"],
|
|
123
|
+
BIDSVersion: "1.2",
|
|
124
|
+
License: "AGPL3",
|
|
125
|
+
Name: "New Name",
|
|
126
126
|
},
|
|
127
|
-
id:
|
|
127
|
+
id: "1234",
|
|
128
128
|
},
|
|
129
|
-
id:
|
|
129
|
+
id: "ds001",
|
|
130
130
|
})
|
|
131
131
|
})
|
|
132
132
|
})
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { userPermissionsFilter } from
|
|
1
|
+
import { userPermissionsFilter } from "../remove-permissions"
|
|
2
2
|
|
|
3
|
-
describe(
|
|
4
|
-
describe(
|
|
5
|
-
it(
|
|
3
|
+
describe("RemovePermissions mutation", () => {
|
|
4
|
+
describe("userPermissionsFilter()", () => {
|
|
5
|
+
it("accepts a permissions array object", () => {
|
|
6
6
|
expect(
|
|
7
7
|
userPermissionsFilter(
|
|
8
|
-
[{ user: { id:
|
|
9
|
-
|
|
8
|
+
[{ user: { id: "1234", email: "example@example.com" }, level: "ro" }],
|
|
9
|
+
"1234",
|
|
10
10
|
),
|
|
11
11
|
).toEqual([])
|
|
12
12
|
})
|
|
13
|
-
it(
|
|
13
|
+
it("does not filter non-matching entries", () => {
|
|
14
14
|
const permissions = [
|
|
15
|
-
{ user: { id:
|
|
15
|
+
{ user: { id: "5678", email: "example@example.com" }, level: "ro" },
|
|
16
16
|
]
|
|
17
|
-
expect(userPermissionsFilter(permissions,
|
|
17
|
+
expect(userPermissionsFilter(permissions, "1234")).toEqual(permissions)
|
|
18
18
|
})
|
|
19
19
|
})
|
|
20
20
|
})
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render } from
|
|
3
|
-
import { MockedProvider } from
|
|
4
|
-
import { UpdateDatasetPermissions } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { render } from "@testing-library/react"
|
|
3
|
+
import { MockedProvider } from "@apollo/client/testing"
|
|
4
|
+
import { UpdateDatasetPermissions } from "../update-permissions"
|
|
5
5
|
|
|
6
|
-
describe(
|
|
7
|
-
it(
|
|
6
|
+
describe("UpdateDatasetPermissions mutation", () => {
|
|
7
|
+
it("renders with default props", () => {
|
|
8
8
|
const { asFragment } = render(
|
|
9
9
|
<MockedProvider>
|
|
10
10
|
<UpdateDatasetPermissions />
|
|
@@ -12,7 +12,7 @@ describe('UpdateDatasetPermissions mutation', () => {
|
|
|
12
12
|
)
|
|
13
13
|
expect(asFragment()).toMatchSnapshot()
|
|
14
14
|
})
|
|
15
|
-
it(
|
|
15
|
+
it("renders with typical props", () => {
|
|
16
16
|
const { asFragment } = render(
|
|
17
17
|
<MockedProvider>
|
|
18
18
|
<UpdateDatasetPermissions
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { gql, useMutation } from
|
|
3
|
-
import PropTypes from
|
|
4
|
-
import { reexporterLogsURL } from
|
|
5
|
-
import { Button } from
|
|
6
|
-
import styled from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { gql, useMutation } from "@apollo/client"
|
|
3
|
+
import PropTypes from "prop-types"
|
|
4
|
+
import { reexporterLogsURL } from "../../resources/kibana"
|
|
5
|
+
import { Button } from "@openneuro/components/button"
|
|
6
|
+
import styled from "@emotion/styled"
|
|
7
7
|
|
|
8
8
|
const ButtonRow = styled.div`
|
|
9
9
|
display: grid;
|
|
@@ -13,13 +13,13 @@ const ButtonRow = styled.div`
|
|
|
13
13
|
`
|
|
14
14
|
|
|
15
15
|
const SuccessMessage = styled.p({
|
|
16
|
-
color:
|
|
16
|
+
color: "rgb(92, 184, 92)",
|
|
17
17
|
})
|
|
18
18
|
const InProgressMessage = styled.p({
|
|
19
|
-
color:
|
|
19
|
+
color: "orange",
|
|
20
20
|
})
|
|
21
21
|
const ErrorMessage = styled.p({
|
|
22
|
-
color:
|
|
22
|
+
color: "red",
|
|
23
23
|
})
|
|
24
24
|
|
|
25
25
|
const REEXPORT_REMOTES = gql`
|
|
@@ -29,8 +29,9 @@ const REEXPORT_REMOTES = gql`
|
|
|
29
29
|
`
|
|
30
30
|
|
|
31
31
|
const AdminExports = ({ dataset }) => {
|
|
32
|
-
const [reexportRemotes, { data, loading, error }] =
|
|
33
|
-
|
|
32
|
+
const [reexportRemotes, { data, loading, error }] = useMutation(
|
|
33
|
+
REEXPORT_REMOTES,
|
|
34
|
+
)
|
|
34
35
|
const success = data && data.reexportRemotes
|
|
35
36
|
return (
|
|
36
37
|
<div className="dataset-form">
|
|
@@ -55,7 +56,7 @@ const AdminExports = ({ dataset }) => {
|
|
|
55
56
|
secondary={true}
|
|
56
57
|
size="small"
|
|
57
58
|
onClick={() => {
|
|
58
|
-
window.open(reexporterLogsURL,
|
|
59
|
+
window.open(reexporterLogsURL, "_blank")
|
|
59
60
|
}}
|
|
60
61
|
/>
|
|
61
62
|
</ButtonRow>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import { gql } from
|
|
4
|
-
import { Mutation } from
|
|
5
|
-
import { Button } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import { gql } from "@apollo/client"
|
|
4
|
+
import { Mutation } from "@apollo/client/react/components"
|
|
5
|
+
import { Button } from "@openneuro/components/button"
|
|
6
6
|
const CACHE_CLEAR = gql`
|
|
7
7
|
mutation cacheClear($datasetId: ID!) {
|
|
8
8
|
cacheClear(datasetId: $datasetId)
|
|
@@ -11,7 +11,7 @@ const CACHE_CLEAR = gql`
|
|
|
11
11
|
|
|
12
12
|
const CacheClear = ({ datasetId }) => (
|
|
13
13
|
<Mutation mutation={CACHE_CLEAR}>
|
|
14
|
-
{cacheClear => (
|
|
14
|
+
{(cacheClear) => (
|
|
15
15
|
<span>
|
|
16
16
|
<Button
|
|
17
17
|
icon="fa fa-eraser"
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const datasetCacheId = datasetId => `Dataset:${datasetId}`
|
|
1
|
+
export const datasetCacheId = (datasetId) => `Dataset:${datasetId}`
|
|
2
2
|
|
|
3
|
-
export const draftCacheId = draftId => `Draft:${draftId}`
|
|
3
|
+
export const draftCacheId = (draftId) => `Draft:${draftId}`
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import { gql } from
|
|
4
|
-
import { Mutation } from
|
|
5
|
-
import { convertToRaw } from
|
|
6
|
-
import withProfile from
|
|
7
|
-
import { DATASET_COMMENTS } from
|
|
8
|
-
import { datasetCacheId } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import { gql } from "@apollo/client"
|
|
4
|
+
import { Mutation } from "@apollo/client/react/components"
|
|
5
|
+
import { convertToRaw } from "draft-js"
|
|
6
|
+
import withProfile from "../../authentication/withProfile.jsx"
|
|
7
|
+
import { DATASET_COMMENTS } from "../fragments/comments-fragments"
|
|
8
|
+
import { datasetCacheId } from "./cache-id.js"
|
|
9
9
|
|
|
10
10
|
const NEW_COMMENT = gql`
|
|
11
11
|
mutation addComment($datasetId: ID!, $parentId: ID, $comment: String!) {
|
|
@@ -30,12 +30,12 @@ const EDIT_COMMENT = gql`
|
|
|
30
30
|
*/
|
|
31
31
|
export const commentStateFactory = (id, parentId, body, profile) => ({
|
|
32
32
|
id,
|
|
33
|
-
parent: parentId ? { __typename:
|
|
33
|
+
parent: parentId ? { __typename: "Comment", id: parentId } : null,
|
|
34
34
|
text: JSON.stringify(convertToRaw(body)),
|
|
35
35
|
createDate: new Date().toISOString(),
|
|
36
|
-
user: { __typename:
|
|
36
|
+
user: { __typename: "User", ...profile },
|
|
37
37
|
replies: [],
|
|
38
|
-
__typename:
|
|
38
|
+
__typename: "Comment",
|
|
39
39
|
})
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -58,12 +58,12 @@ export const newCommentsReducer = (
|
|
|
58
58
|
// If this is not a root level comment, add to replies
|
|
59
59
|
if (parentId) {
|
|
60
60
|
const parentIndex = nextCommentsState.findIndex(
|
|
61
|
-
comment => comment.id === parentId,
|
|
61
|
+
(comment) => comment.id === parentId,
|
|
62
62
|
)
|
|
63
63
|
const parentReplies = nextCommentsState[parentIndex].replies
|
|
64
64
|
nextCommentsState[parentIndex] = {
|
|
65
65
|
...comments[parentIndex],
|
|
66
|
-
replies: [...parentReplies, { __typename:
|
|
66
|
+
replies: [...parentReplies, { __typename: "Comment", id: commentId }],
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
return nextCommentsState
|
|
@@ -81,7 +81,7 @@ export const modifyCommentsReducer = (comments, { commentId, comment }) => {
|
|
|
81
81
|
// Must copy with freezeResults enabled
|
|
82
82
|
const nextCommentsState = [...comments]
|
|
83
83
|
const modifiedCommentIndex = nextCommentsState.findIndex(
|
|
84
|
-
c => c.id === commentId,
|
|
84
|
+
(c) => c.id === commentId,
|
|
85
85
|
)
|
|
86
86
|
const modifiedComment = nextCommentsState[modifiedCommentIndex]
|
|
87
87
|
nextCommentsState[modifiedCommentIndex] = {
|
|
@@ -113,23 +113,24 @@ const CommentMutation = ({
|
|
|
113
113
|
// Apply state reduction to cache for new comment changes
|
|
114
114
|
const nextCommentsState = addComment
|
|
115
115
|
? newCommentsReducer(comments, {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
116
|
+
parentId,
|
|
117
|
+
commentId: addComment,
|
|
118
|
+
comment,
|
|
119
|
+
profile,
|
|
120
|
+
})
|
|
121
121
|
: modifyCommentsReducer(comments, { commentId, comment })
|
|
122
122
|
cache.writeFragment({
|
|
123
123
|
id: datasetCacheId(datasetId),
|
|
124
124
|
fragment: DATASET_COMMENTS,
|
|
125
125
|
data: {
|
|
126
|
-
__typename:
|
|
126
|
+
__typename: "Dataset",
|
|
127
127
|
id: datasetId,
|
|
128
128
|
comments: nextCommentsState,
|
|
129
129
|
},
|
|
130
130
|
})
|
|
131
|
-
}}
|
|
132
|
-
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
133
|
+
{(newComment) => (
|
|
133
134
|
<button
|
|
134
135
|
className="on-button on-button--primary on-button--small "
|
|
135
136
|
disabled={disabled}
|
|
@@ -143,7 +144,8 @@ const CommentMutation = ({
|
|
|
143
144
|
},
|
|
144
145
|
})
|
|
145
146
|
done()
|
|
146
|
-
}}
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
147
149
|
Submit Comment
|
|
148
150
|
</button>
|
|
149
151
|
)}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, { FC } from
|
|
2
|
-
import { gql, useMutation } from
|
|
3
|
-
import { Link } from
|
|
4
|
-
import { Tooltip } from
|
|
5
|
-
import { Button } from
|
|
1
|
+
import React, { FC } from "react"
|
|
2
|
+
import { gql, useMutation } from "@apollo/client"
|
|
3
|
+
import { Link } from "react-router-dom"
|
|
4
|
+
import { Tooltip } from "@openneuro/components/tooltip"
|
|
5
|
+
import { Button } from "@openneuro/components/button"
|
|
6
6
|
|
|
7
7
|
const CREATE_LINK = gql`
|
|
8
8
|
mutation createReviewer($datasetId: ID!) {
|
|
@@ -28,32 +28,38 @@ export const CreateReviewLink: FC<CreateReviewLinkProps> = ({ datasetId }) => {
|
|
|
28
28
|
return (
|
|
29
29
|
<>
|
|
30
30
|
<div className="share-form-controls">
|
|
31
|
-
{error
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
31
|
+
{error
|
|
32
|
+
? (
|
|
33
|
+
"An Error Occured"
|
|
34
|
+
)
|
|
35
|
+
: data
|
|
36
|
+
? (
|
|
37
|
+
<div className="reviewer-link">
|
|
38
|
+
<div>
|
|
39
|
+
<Tooltip
|
|
40
|
+
tooltip="Click to copy URL to clipboard"
|
|
41
|
+
flow="right"
|
|
42
|
+
className="tooltip"
|
|
43
|
+
>
|
|
44
|
+
<Button
|
|
45
|
+
onClick={() => copyToClipboard(data.createReviewer.url)}
|
|
46
|
+
icon="fas fa-clipboard"
|
|
47
|
+
size="small"
|
|
48
|
+
nobg={true}
|
|
49
|
+
iconSize="18px"
|
|
50
|
+
label="copy anonymous URL"
|
|
51
|
+
/>
|
|
52
|
+
</Tooltip>
|
|
53
|
+
<pre>{data.createReviewer.url}</pre>
|
|
54
|
+
</div>
|
|
55
|
+
<small className="alert-color">
|
|
56
|
+
Copy and save this reviewer link. It will disappear when you
|
|
57
|
+
leave the page. To get a new link click the Create Link button
|
|
58
|
+
below.
|
|
59
|
+
</small>
|
|
50
60
|
</div>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
the page. To get a new link click the Create Link button below.
|
|
54
|
-
</small>
|
|
55
|
-
</div>
|
|
56
|
-
) : null}
|
|
61
|
+
)
|
|
62
|
+
: null}
|
|
57
63
|
<Button
|
|
58
64
|
className="btn-modal-action"
|
|
59
65
|
primary={true}
|