From 5230941c88cd70ef12a52a110d725288b03fdc75 Mon Sep 17 00:00:00 2001 From: Nell Hardcastle Date: Sun, 12 Nov 2023 15:46:27 -0800 Subject: [PATCH] style: Reformat with deno fmt --- .vscode/launch.json | 2 +- __mocks__/ioredis.js | 2 +- __mocks__/superagent.js | 14 +- babel.config.js | 30 +- deno.json | 12 +- docs/api.md | 2 +- docs/faq.md | 16 +- docs/index.md | 2 +- docs/policy/data_management_plans.md | 63 ++- docs/user_guide.md | 21 +- packages/openneuro-app/__mocks__/fileMock.js | 2 +- packages/openneuro-app/pluralize-esm.js | 415 +++++++++--------- packages/openneuro-app/src/@types/custom.d.ts | 6 +- packages/openneuro-app/src/@types/react.d.ts | 7 +- packages/openneuro-app/src/client.jsx | 33 +- .../src/scripts/__mocks__/config.ts | 12 +- .../src/scripts/__utils__/mock-app-shell.tsx | 17 +- packages/openneuro-app/src/scripts/apm.js | 12 +- packages/openneuro-app/src/scripts/app.tsx | 14 +- .../authentication/__tests__/profile.spec.js | 20 +- .../src/scripts/authentication/admin-user.jsx | 4 +- .../src/scripts/authentication/logged-in.jsx | 4 +- .../src/scripts/authentication/logged-out.jsx | 4 +- .../src/scripts/authentication/loginCheck.js | 4 +- .../src/scripts/authentication/loginUrls.ts | 2 +- .../src/scripts/authentication/profile.ts | 14 +- .../scripts/authentication/regular-user.tsx | 6 +- .../src/scripts/authentication/signOut.ts | 4 +- .../scripts/authentication/withProfile.jsx | 12 +- .../src/scripts/common/block-navigation.jsx | 7 +- .../containers/__tests__/header.spec.tsx | 32 +- .../src/scripts/common/containers/footer.tsx | 6 +- .../src/scripts/common/containers/header.tsx | 60 +-- .../forms/__tests__/warn-button.spec.jsx | 12 +- .../src/scripts/common/forms/warn-button.jsx | 38 +- .../common/partials/block-navigation.jsx | 7 +- .../common/partials/freshdesk-widget.jsx | 37 +- .../scripts/common/partials/toast-content.jsx | 4 +- .../components/__tests__/data-table.spec.tsx | 14 +- .../src/scripts/components/data-table.tsx | 45 +- packages/openneuro-app/src/scripts/config.ts | 4 +- .../datalad/dataset/comments-fragments.js | 2 +- .../datalad/dataset/dataset-context.js | 2 +- .../datalad/dataset/dataset-query-context.js | 2 +- .../dataset/dataset-query-fragments.js | 2 +- .../scripts/datalad/mutations/cache-clear.jsx | 13 +- .../src/scripts/datalad/mutations/cache-id.js | 4 +- .../datalad/mutations/delete-comment.jsx | 24 +- .../src/scripts/datalad/mutations/delete.jsx | 19 +- .../src/scripts/datalad/mutations/follow.jsx | 23 +- .../src/scripts/datalad/mutations/publish.jsx | 25 +- .../datalad/mutations/remove-permissions.jsx | 16 +- .../scripts/datalad/mutations/revalidate.jsx | 13 +- .../scripts/datalad/mutations/snapshot.tsx | 14 +- .../src/scripts/datalad/mutations/star.jsx | 23 +- .../datalad/mutations/submit-metadata.jsx | 26 +- .../datalad/mutations/update-permissions.jsx | 27 +- .../scripts/datalad/mutations/update-ref.jsx | 13 +- .../datalad/routes/dataset-redirect.tsx | 98 ++--- .../__tests__/files-subscription.spec.jsx | 64 +-- .../subscriptions/files-subscription.jsx | 32 +- .../useDatasetDeletedSubscription.jsx | 8 +- .../subscriptions/useDraftSubscription.js | 8 +- .../usePermissionsSubscription.js | 8 +- .../useSnapshotsUpdatedSubscriptions.js | 6 +- .../__tests__/snapshot-container.spec.tsx | 24 +- .../comments/__tests__/comment.spec.jsx | 42 +- .../comments/__tests__/comments.spec.jsx | 20 +- .../dataset/comments/block-style-controls.jsx | 30 +- .../dataset/comments/comment-editor.jsx | 62 +-- .../src/scripts/dataset/comments/comment.jsx | 100 ++--- .../src/scripts/dataset/comments/comments.jsx | 46 +- .../comments/inline-style-controls.jsx | 18 +- .../scripts/dataset/comments/style-button.jsx | 17 +- .../scripts/dataset/common/follow-toggles.tsx | 6 +- .../scripts/dataset/dataset-query-context.js | 2 +- .../src/scripts/dataset/dataset-query.jsx | 65 +-- .../src/scripts/dataset/dataset-routes.jsx | 10 +- .../__tests__/download-command-line.spec.jsx | 26 +- .../download/__tests__/download-link.spec.jsx | 20 +- .../__tests__/download-native.spec.js | 14 +- .../download/__tests__/shell-example.spec.jsx | 10 +- .../download/download-command-line.jsx | 16 +- .../dataset/download/download-datalad.jsx | 42 +- .../download/download-derivative-datalad.tsx | 4 +- .../download/download-derivative-s3.tsx | 4 +- .../dataset/download/download-link.jsx | 12 +- .../dataset/download/download-native.js | 39 +- .../dataset/download/download-query.js | 5 +- .../scripts/dataset/download/download-s3.jsx | 16 +- .../dataset/download/download-script.tsx | 43 +- .../dataset/download/native-file-toast.jsx | 24 +- .../dataset/download/shell-example.jsx | 2 +- .../dataset/download/track-download.js | 10 +- .../src/scripts/dataset/draft-container.tsx | 206 ++++----- .../scripts/dataset/draft-snapshot-routes.tsx | 6 +- .../file-tree-unloaded-directory.spec.jsx | 46 +- .../files/__tests__/file-tree.spec.jsx | 115 +++-- .../files/__tests__/file-viewer-type.spec.jsx | 12 +- .../dataset/files/__tests__/file.spec.jsx | 30 +- .../scripts/dataset/files/file-display.jsx | 22 +- .../files/file-tree-unloaded-directory.jsx | 20 +- .../src/scripts/dataset/files/file-tree.tsx | 54 +-- .../src/scripts/dataset/files/file-view.jsx | 8 +- .../dataset/files/file-viewer-type.jsx | 42 +- .../src/scripts/dataset/files/file.tsx | 165 +++---- .../src/scripts/dataset/files/files.tsx | 81 ++-- .../src/scripts/dataset/files/index.tsx | 4 +- .../__tests__/file-viewer-json.spec.jsx | 16 +- .../viewers/__tests__/parse-tabular.spec.js | 16 +- .../dataset/files/viewers/file-viewer-csv.jsx | 10 +- .../files/viewers/file-viewer-html.jsx | 6 +- .../files/viewers/file-viewer-json.jsx | 8 +- .../files/viewers/file-viewer-nifti.tsx | 8 +- .../files/viewers/file-viewer-table.tsx | 6 +- .../files/viewers/file-viewer-text.jsx | 6 +- .../dataset/files/viewers/file-viewer-tsv.jsx | 10 +- .../dataset/files/viewers/parse-tabular.js | 8 +- .../__tests__/cancel-button.spec.tsx | 10 +- .../__tests__/dataset-alert-draft.spec.tsx | 18 +- .../__tests__/dataset-citation.spec.jsx | 20 +- .../fragments/__tests__/doi-link.spec.tsx | 58 +-- .../fragments/__tests__/edit-button.spec.tsx | 10 +- .../fragments/__tests__/edit-list.spec.jsx | 26 +- .../fragments/__tests__/save-button.spec.tsx | 10 +- .../fragments/__tests__/select-input.spec.tsx | 52 +-- .../dataset/fragments/cancel-button.tsx | 4 +- .../dataset/fragments/comments-fragments.js | 2 +- .../dataset/fragments/copyable-tooltip.jsx | 27 +- .../dataset/fragments/dataset-alert-draft.tsx | 30 +- .../fragments/dataset-alert-version.tsx | 9 +- .../dataset/fragments/dataset-citation.jsx | 44 +- .../dataset/fragments/dataset-history.jsx | 24 +- .../dataset/fragments/dataset-reviewers.ts | 2 +- .../scripts/dataset/fragments/doi-link.tsx | 12 +- .../scripts/dataset/fragments/edit-button.tsx | 4 +- .../fragments/edit-description-field.jsx | 44 +- .../fragments/edit-description-list.jsx | 16 +- .../scripts/dataset/fragments/edit-list.jsx | 16 +- .../dataset/fragments/number-input.tsx | 71 +-- .../scripts/dataset/fragments/save-button.tsx | 4 +- .../dataset/fragments/select-input.tsx | 173 ++++---- .../dataset/fragments/text-array-input.tsx | 75 ++-- .../scripts/dataset/fragments/text-input.tsx | 157 +++---- .../mutations/__tests__/cache-id.spec.js | 10 +- .../mutations/__tests__/delete-file.spec.jsx | 168 +++---- .../mutations/__tests__/delete.spec.jsx | 16 +- .../__tests__/deprecate-snapshot.spec.tsx | 34 +- .../__tests__/deprecate-version.spec.tsx | 38 +- .../mutations/__tests__/description.spec.jsx | 102 ++--- .../__tests__/remove-permissions.spec.tsx | 18 +- .../__tests__/update-permissions.spec.jsx | 14 +- .../dataset/mutations/admin-exports.jsx | 25 +- .../scripts/dataset/mutations/cache-clear.jsx | 12 +- .../src/scripts/dataset/mutations/cache-id.js | 4 +- .../src/scripts/dataset/mutations/comment.jsx | 48 +- .../mutations/create-anonymous-reviewer.tsx | 66 +-- .../dataset/mutations/dataset-relations.tsx | 57 ++- .../mutations/delete-anonymous-reviewer.tsx | 15 +- .../dataset/mutations/delete-comment.jsx | 26 +- .../dataset/mutations/delete-dataset-form.jsx | 42 +- .../scripts/dataset/mutations/delete-file.jsx | 16 +- .../src/scripts/dataset/mutations/delete.jsx | 19 +- .../dataset/mutations/deprecate-version.tsx | 11 +- .../scripts/dataset/mutations/description.jsx | 41 +- .../dataset/mutations/flag-annex-object.jsx | 19 +- .../src/scripts/dataset/mutations/follow.tsx | 29 +- .../dataset/mutations/import-dataset.tsx | 10 +- .../dataset/mutations/metadata-form.jsx | 191 ++++---- .../src/scripts/dataset/mutations/publish.jsx | 26 +- .../src/scripts/dataset/mutations/readme.jsx | 23 +- .../dataset/mutations/remove-annex-object.jsx | 19 +- .../dataset/mutations/remove-permissions.tsx | 11 +- .../scripts/dataset/mutations/revalidate.jsx | 14 +- .../scripts/dataset/mutations/snapshot.tsx | 16 +- .../src/scripts/dataset/mutations/star.tsx | 27 +- .../dataset/mutations/submit-metadata.jsx | 23 +- .../mutations/undo-deprecate-version.tsx | 11 +- .../scripts/dataset/mutations/update-file.jsx | 12 +- .../dataset/mutations/update-permissions.tsx | 18 +- .../scripts/dataset/mutations/update-ref.jsx | 14 +- .../deprecate-snapshot-page.spec.tsx | 10 +- .../scripts/dataset/routes/add-metadata.jsx | 39 +- .../scripts/dataset/routes/admin-datalad.jsx | 14 +- .../dataset/routes/dataset-default.tsx | 22 +- .../scripts/dataset/routes/delete-page.tsx | 24 +- .../routes/deprecate-snapshot-page.tsx | 16 +- .../scripts/dataset/routes/derivatives.tsx | 20 +- .../dataset/routes/download-dataset.tsx | 40 +- .../routes/manage-anonymous-reviewers.tsx | 72 +-- .../dataset/routes/manage-permissions.jsx | 44 +- .../src/scripts/dataset/routes/publish.jsx | 62 +-- .../dataset/routes/snapshot-default.tsx | 14 +- .../src/scripts/dataset/routes/snapshot.tsx | 87 ++-- .../routes/styles/dataset-page-border.tsx | 6 +- .../styles/dataset-page-tab-container.tsx | 6 +- .../dataset/routes/styles/header-row.tsx | 6 +- .../dataset/routes/tab-routes-draft.tsx | 24 +- .../dataset/routes/tab-routes-snapshot.tsx | 16 +- .../scripts/dataset/snapshot-container.tsx | 164 ++++--- .../src/scripts/errors/403page.tsx | 22 +- .../src/scripts/errors/404page.tsx | 24 +- .../src/scripts/errors/errorBoundary.jsx | 25 +- .../src/scripts/errors/errorRoute.jsx | 12 +- .../src/scripts/errors/freshdesk-widget.jsx | 37 +- .../src/scripts/errors/freshdeskInterface.jsx | 18 +- .../src/scripts/errors/orcid/email.jsx | 6 +- .../src/scripts/errors/orcid/family.jsx | 8 +- .../src/scripts/errors/orcid/general.jsx | 2 +- .../src/scripts/errors/orcid/given.jsx | 8 +- .../src/scripts/fixtures/dataset-query.ts | 238 +++++----- .../src/scripts/fixtures/mock-app-wrapper.tsx | 8 +- packages/openneuro-app/src/scripts/index.tsx | 18 +- .../src/scripts/pages/admin/admin.jsx | 10 +- .../src/scripts/pages/admin/flagged-files.jsx | 64 +-- .../src/scripts/pages/admin/user-fragment.ts | 2 +- .../src/scripts/pages/admin/user-tools.tsx | 24 +- .../src/scripts/pages/admin/users.jsx | 77 ++-- .../openneuro-app/src/scripts/pages/api.jsx | 39 +- .../src/scripts/pages/citation-page.tsx | 8 +- .../src/scripts/pages/faq/faq.tsx | 4 +- .../src/scripts/pages/front-page-comp.tsx | 6 +- .../aggregate-counts-container.tsx | 11 +- .../use-participant-count.ts | 4 +- .../use-publicDatasets-count.ts | 4 +- .../pages/front-page/front-page-content.ts | 84 ++-- .../scripts/pages/front-page/front-page.tsx | 32 +- .../src/scripts/pages/import-dataset.tsx | 20 +- .../pages/metadata/dataset-metadata.tsx | 30 +- .../src/scripts/pages/pet-redirect.tsx | 4 +- .../src/scripts/queries/dataset.ts | 6 +- .../resources/__tests__/kibana.spec.js | 18 +- .../src/scripts/resources/kibana.js | 6 +- .../src/scripts/resources/strings.js | 4 +- packages/openneuro-app/src/scripts/routes.tsx | 28 +- .../search/__helpers__/search-render.tsx | 6 +- .../__tests__/search-container.spec.tsx | 44 +- .../__tests__/search-params-ctx.spec.tsx | 40 +- .../src/scripts/search/es-query-builders.ts | 14 +- .../search/filters-block-container.tsx | 30 +- .../scripts/search/initial-search-params.tsx | 90 ++-- .../inputs/__tests__/sort-by-select.spec.tsx | 46 +- .../inputs/admin-allDatasets-toggle.tsx | 24 +- .../scripts/search/inputs/age-range-input.tsx | 17 +- .../scripts/search/inputs/author-input.tsx | 25 +- .../src/scripts/search/inputs/date-radios.tsx | 15 +- .../search/inputs/diagnosis-select.tsx | 12 +- .../src/scripts/search/inputs/index.ts | 66 +-- .../scripts/search/inputs/keyword-input.tsx | 26 +- .../scripts/search/inputs/modality-select.tsx | 63 +-- .../search/inputs/pet/bodyParts_input.tsx | 34 +- .../scannerManufacturersModelNames_input.tsx | 34 +- .../inputs/pet/scannerManufacturers_input.tsx | 34 +- .../search/inputs/pet/tracerNames_input.tsx | 31 +- .../inputs/pet/tracerRadionuclides_input.tsx | 34 +- .../scripts/search/inputs/section-select.tsx | 12 +- .../src/scripts/search/inputs/sex-radios.tsx | 12 +- .../search/inputs/show-datasets-radios.tsx | 60 +-- .../scripts/search/inputs/sort-by-select.tsx | 21 +- .../scripts/search/inputs/species-select.tsx | 12 +- .../search/inputs/study-domain-input.tsx | 34 +- .../inputs/subject-count-range-input.tsx | 15 +- .../src/scripts/search/inputs/task-input.tsx | 34 +- .../src/scripts/search/search-container.tsx | 168 ++++--- .../src/scripts/search/search-params-ctx.tsx | 78 ++-- .../src/scripts/search/search-routes.tsx | 8 +- .../src/scripts/search/use-search-results.tsx | 219 ++++----- .../src/scripts/styles/media.tsx | 6 +- .../src/scripts/styles/support-modal.jsx | 4 +- packages/openneuro-app/src/scripts/sw.ts | 23 +- .../openneuro-app/src/scripts/test-utils.js | 8 +- .../src/scripts/uploader/add-path-to-files.js | 14 +- .../src/scripts/uploader/file-select.tsx | 6 +- .../src/scripts/uploader/file-upload.js | 25 +- .../src/scripts/uploader/input.jsx | 15 +- .../src/scripts/uploader/upload-button.jsx | 6 +- .../uploader/upload-disclaimer-input.tsx | 132 +++--- .../scripts/uploader/upload-disclaimer.jsx | 11 +- .../scripts/uploader/upload-file-status.jsx | 8 +- .../src/scripts/uploader/upload-issues.jsx | 61 +-- .../src/scripts/uploader/upload-metadata.jsx | 35 +- .../src/scripts/uploader/upload-mutation.js | 37 +- .../uploader/upload-progress-button.jsx | 9 +- .../src/scripts/uploader/upload-progress.jsx | 6 +- .../src/scripts/uploader/upload-rename.jsx | 11 +- .../src/scripts/uploader/upload-resume.jsx | 50 ++- .../src/scripts/uploader/upload-select.jsx | 19 +- .../src/scripts/uploader/upload-status.jsx | 10 +- .../src/scripts/uploader/upload-step.jsx | 18 +- .../src/scripts/uploader/uploader-context.js | 2 +- .../src/scripts/uploader/uploader-location.js | 2 +- .../src/scripts/uploader/uploader-modal.jsx | 15 +- .../uploader/uploader-setup-routes.jsx | 20 +- .../uploader/uploader-status-routes.jsx | 12 +- .../src/scripts/uploader/uploader-view.jsx | 8 +- .../src/scripts/uploader/uploader.jsx | 98 +++-- .../src/scripts/users/username.tsx | 6 +- .../src/scripts/utils/__tests__/csv.spec.ts | 32 +- .../src/scripts/utils/__tests__/date.spec.js | 8 +- .../scripts/utils/__tests__/json-ld.spec.js | 24 +- .../src/scripts/utils/__tests__/newid.spec.js | 18 +- .../utils/__tests__/userNotify.spec.js | 20 +- .../src/scripts/utils/analytics.tsx | 6 +- .../src/scripts/utils/cookies.js | 2 +- .../openneuro-app/src/scripts/utils/csv.ts | 28 +- .../src/scripts/utils/datalad.js | 2 +- .../src/scripts/utils/dataset-url.js | 4 +- .../openneuro-app/src/scripts/utils/date.js | 4 +- .../src/scripts/utils/global-polyfill.ts | 4 +- .../openneuro-app/src/scripts/utils/gtag.js | 12 +- .../src/scripts/utils/json-ld.js | 26 +- .../openneuro-app/src/scripts/utils/newid.js | 2 +- .../scripts/utils/user-login-modal-ctx.tsx | 8 +- .../src/scripts/utils/userNotify.js | 4 +- .../scripts/validation/validation-panel.jsx | 6 +- .../validation-results.issues.issue.jsx | 18 +- .../validation/validation-results.issues.jsx | 36 +- .../scripts/validation/validation-results.jsx | 20 +- .../scripts/validation/validation-status.jsx | 36 +- .../src/scripts/validation/validation.jsx | 10 +- .../src/scripts/workers/schema.ts | 4 +- .../src/scripts/workers/schema.worker.ts | 8 +- .../src/scripts/workers/validate.ts | 4 +- .../src/scripts/workers/validate.worker.ts | 12 +- packages/openneuro-app/vite.config.js | 34 +- .../openneuro-cli/src/__mocks__/config.js | 6 +- .../src/__tests__/config.spec.js | 36 +- .../src/__tests__/datasets.spec.js | 20 +- .../src/__tests__/download.spec.js | 19 +- .../openneuro-cli/src/__tests__/files.spec.js | 36 +- .../src/__tests__/gitAnnexRemote.spec.js | 80 ++-- .../src/__tests__/setDuplexIfRequired.spec.js | 28 +- .../src/__tests__/validateApiKey.spec.js | 12 +- packages/openneuro-cli/src/actions.js | 133 +++--- packages/openneuro-cli/src/apm.js | 22 +- packages/openneuro-cli/src/cli.js | 74 ++-- packages/openneuro-cli/src/config.js | 30 +- .../openneuro-cli/src/configuredClient.js | 8 +- packages/openneuro-cli/src/createDataset.js | 26 +- packages/openneuro-cli/src/datasets.js | 57 ++- packages/openneuro-cli/src/download.js | 35 +- packages/openneuro-cli/src/files.js | 10 +- packages/openneuro-cli/src/gitAnnexRemote.js | 62 +-- packages/openneuro-cli/src/gitCredential.js | 22 +- packages/openneuro-cli/src/index.js | 4 +- packages/openneuro-cli/src/ls.js | 6 +- .../openneuro-cli/src/setDuplexIfRequired.js | 4 +- packages/openneuro-cli/src/snapshots.js | 4 +- packages/openneuro-cli/src/transferKey.js | 20 +- packages/openneuro-cli/src/upload.js | 68 +-- packages/openneuro-cli/src/validateApiKey.js | 4 +- .../openneuro-client/src/__mocks__/client.js | 20 +- .../src/__tests__/client.spec.js | 18 +- .../src/__tests__/datasetGenerator.spec.js | 44 +- .../src/__tests__/files.spec.js | 34 +- .../src/__tests__/uploads.spec.js | 36 +- packages/openneuro-client/src/client.js | 26 +- .../openneuro-client/src/datasetGenerator.js | 6 +- packages/openneuro-client/src/datasets.js | 2 +- packages/openneuro-client/src/files.js | 8 +- packages/openneuro-client/src/index.js | 16 +- packages/openneuro-client/src/snapshots.js | 2 +- packages/openneuro-client/src/uploads.js | 37 +- packages/openneuro-client/src/users.js | 2 +- .../src/@types/custom.d.ts | 8 +- .../src/accordion/AccordionTab.tsx | 35 +- .../src/accordion/AccordionWrap.tsx | 4 +- .../accordion/__tests__/AccordionTab.spec.tsx | 18 +- .../src/accordion/index.ts | 4 +- .../src/activity-slider/ActivitySlider.tsx | 99 +++-- .../src/activity-slider/index.ts | 2 +- .../affiliate-article/AffiliateArticle.tsx | 2 +- .../src/affiliate-article/index.ts | 2 +- .../src/aggregate-count/AggregateCount.tsx | 10 +- .../src/aggregate-count/index.ts | 2 +- .../src/button/Button.tsx | 75 ++-- .../src/button/__tests__/Button.spec.tsx | 14 +- .../openneuro-components/src/button/index.ts | 2 +- .../src/content/affiliate-content.jsx | 27 +- .../src/content/facet-content.jsx | 146 +++--- .../src/content/front-page-content.jsx | 140 +++--- .../openneuro-components/src/content/index.ts | 8 +- .../src/content/modality-cube-content.jsx | 22 +- .../src/content/portal-content.jsx | 84 ++-- .../src/content/sortby-list.jsx | 16 +- .../src/count-toggle/CountToggle.tsx | 34 +- .../__tests__/CountToggle.spec.tsx | 22 +- .../src/count-toggle/index.ts | 2 +- .../src/dataset/BrainLifeButton.tsx | 8 +- .../src/dataset/CloneDropdown.tsx | 12 +- .../src/dataset/DatasetAlert.tsx | 9 +- .../src/dataset/DatasetGitAccess.tsx | 8 +- .../src/dataset/DatasetHeader.tsx | 16 +- .../src/dataset/DatasetHeaderMeta.tsx | 4 +- .../src/dataset/DatasetToolButton.tsx | 20 +- .../src/dataset/DatasetTools.tsx | 83 ++-- .../src/dataset/MetaDataBlock.tsx | 6 +- .../src/dataset/MetaDataListBlock.tsx | 4 +- .../src/dataset/ModalitiesMetaDataBlock.tsx | 20 +- .../src/dataset/NemarButton.tsx | 8 +- .../src/dataset/ValidationBlock.tsx | 2 +- .../src/dataset/VersionList.tsx | 131 +++--- .../dataset/__tests__/DatasetAlert.spec.tsx | 18 +- .../dataset/__tests__/DatasetHeaders.spec.tsx | 14 +- .../dataset/__tests__/DatasetTools.spec.tsx | 108 ++--- .../openneuro-components/src/dataset/index.ts | 40 +- .../src/dropdown/Dropdown.tsx | 17 +- .../src/dropdown/index.ts | 2 +- .../src/facets/FacetRadio.tsx | 12 +- .../src/facets/FacetRange.tsx | 4 +- .../src/facets/FacetSearch.tsx | 8 +- .../src/facets/FacetSelect.tsx | 48 +- .../src/facets/__tests__/FacetSelect.spec.tsx | 14 +- .../openneuro-components/src/facets/index.ts | 10 +- .../src/footer/Footer.tsx | 4 +- .../openneuro-components/src/footer/index.ts | 2 +- .../src/front-page/ActivityHeader.tsx | 6 +- .../src/front-page/AffiliateBlock.tsx | 6 +- .../src/front-page/Contributors.tsx | 6 +- .../src/front-page/GetUpdates.tsx | 41 +- .../src/front-page/Infographic.tsx | 6 +- .../src/front-page/index.ts | 12 +- .../src/header/Header.tsx | 92 ++-- .../src/header/LandingExpandedHeader.tsx | 72 +-- .../openneuro-components/src/header/index.ts | 4 +- .../openneuro-components/src/icon/Icon.tsx | 33 +- .../src/icon/__tests__/Icon.spec.tsx | 10 +- .../openneuro-components/src/icon/index.ts | 2 +- packages/openneuro-components/src/index.ts | 2 +- .../openneuro-components/src/input/Input.tsx | 191 ++++---- .../src/input/TermSearch.tsx | 49 ++- .../openneuro-components/src/input/index.ts | 4 +- .../src/json-tree/ExpandableProperty.tsx | 6 +- .../src/json-tree/RecursiveProperty.tsx | 76 ++-- .../src/json-tree/index.ts | 2 +- .../src/loading/Loading.tsx | 5 +- .../src/loading/__tests__/Loading.spec.tsx | 14 +- .../openneuro-components/src/loading/index.ts | 2 +- .../openneuro-components/src/logo/Logo.tsx | 30 +- .../src/logo/__tests__/Logo.spec.tsx | 24 +- .../openneuro-components/src/logo/index.ts | 2 +- .../openneuro-components/src/modal/Modal.tsx | 32 +- .../src/modal/ModalExample.tsx | 6 +- .../src/modal/UserLoginModal.tsx | 18 +- .../modal/__tests__/UserLoginModal.spec.tsx | 32 +- .../openneuro-components/src/modal/index.ts | 4 +- .../src/modality-cube/ModalityCube.tsx | 14 +- .../src/modality-cube/index.ts | 2 +- .../openneuro-components/src/page/Page.tsx | 26 +- .../openneuro-components/src/page/index.ts | 2 +- .../src/progress-bar/ProgressBar.tsx | 6 +- .../src/progress-bar/index.ts | 2 +- .../openneuro-components/src/radio/Radio.tsx | 4 +- .../src/radio/RadioGroup.tsx | 24 +- .../src/radio/__tests__/RadioGroup.spec.tsx | 26 +- .../openneuro-components/src/radio/index.ts | 4 +- .../src/range/TwoHandleRange.tsx | 2 +- .../range/__tests__/TwoHandleRange.spec.tsx | 24 +- .../openneuro-components/src/range/index.ts | 2 +- .../src/read-more/ReadMore.tsx | 36 +- .../src/read-more/__tests__/ReadMore.spec.tsx | 10 +- .../src/read-more/index.ts | 2 +- .../src/search-page/CommunityHeader.tsx | 2 +- .../FacetBlockContainerExample.tsx | 2 +- .../src/search-page/FilterDateItem.tsx | 5 +- .../src/search-page/FilterListItem.tsx | 15 +- .../src/search-page/FiltersBlock.tsx | 94 ++-- .../src/search-page/ModalityHeader.tsx | 5 +- .../src/search-page/SearchPage.tsx | 76 ++-- .../src/search-page/SearchResultItem.tsx | 149 ++++--- .../src/search-page/SearchResultsList.tsx | 11 +- .../src/search-page/SearchSort.tsx | 9 +- .../SearchSortContainerExample.tsx | 4 +- .../src/search-page/TermListItem.tsx | 2 +- .../src/search-page/index.ts | 16 +- .../src/select/SelectGroup.tsx | 16 +- .../src/select/__tests__/SelectGroup.spec.tsx | 32 +- .../openneuro-components/src/select/index.ts | 2 +- .../src/styleguide/Typography.tsx | 2 +- .../src/styleguide/index.ts | 2 +- .../src/textarea/Textarea.tsx | 82 ++-- .../src/textarea/__tests__/Textarea.spec.tsx | 38 +- .../src/textarea/index.ts | 2 +- .../src/tooltip/Tooltip.tsx | 13 +- .../src/tooltip/__tests__/Tooltip.spec.tsx | 10 +- .../openneuro-components/src/tooltip/index.ts | 2 +- .../src/user/UserMenu.tsx | 22 +- .../openneuro-components/src/user/index.ts | 2 +- .../src/warn-button/WarnButton.tsx | 37 +- .../src/warn-button/index.ts | 2 +- .../openneuro-indexer/src/createIndices.ts | 4 +- packages/openneuro-indexer/src/index.ts | 16 +- .../openneuro-indexer/src/indexDatasets.ts | 10 +- .../src/__tests__/indexDatasets.spec.ts | 50 +-- .../src/__tests__/names.spec.ts | 26 +- packages/openneuro-search/src/auth.ts | 4 +- packages/openneuro-search/src/index.ts | 10 +- .../openneuro-search/src/indexes/datasets.ts | 6 +- packages/openneuro-search/src/names.ts | 4 +- packages/openneuro-search/src/query.ts | 12 +- .../openneuro-server/src/__mocks__/config.ts | 10 +- packages/openneuro-server/src/app.ts | 62 +-- packages/openneuro-server/src/cache/item.ts | 13 +- packages/openneuro-server/src/cache/types.ts | 16 +- packages/openneuro-server/src/config.ts | 12 +- .../src/datalad/__tests__/changelog.spec.ts | 106 ++--- .../src/datalad/__tests__/dataset.spec.ts | 86 ++-- .../src/datalad/__tests__/description.spec.ts | 116 ++--- .../src/datalad/__tests__/files.spec.ts | 72 +-- .../src/datalad/__tests__/pagination.spec.ts | 118 ++--- .../src/datalad/__tests__/snapshots.spec.ts | 34 +- .../openneuro-server/src/datalad/analytics.ts | 8 +- .../openneuro-server/src/datalad/changelog.ts | 31 +- .../openneuro-server/src/datalad/dataset.ts | 185 ++++---- .../src/datalad/description.ts | 74 ++-- .../openneuro-server/src/datalad/draft.ts | 26 +- .../openneuro-server/src/datalad/files.ts | 46 +- .../src/datalad/pagination.ts | 94 ++-- .../openneuro-server/src/datalad/readme.ts | 24 +- .../src/datalad/reexporter.ts | 8 +- .../openneuro-server/src/datalad/snapshots.ts | 95 ++-- .../openneuro-server/src/datalad/upload.ts | 12 +- .../src/elasticsearch/elastic-client.ts | 6 +- .../src/elasticsearch/reindex-dataset.ts | 14 +- .../src/graphql/__tests__/comment.spec.ts | 34 +- .../src/graphql/__tests__/permissions.spec.ts | 106 ++--- .../src/graphql/permissions.ts | 28 +- .../resolvers/__tests__/brainlife.spec.ts | 22 +- .../__tests__/dataset-search.spec.ts | 48 +- .../resolvers/__tests__/dataset.spec.ts | 142 +++--- .../resolvers/__tests__/derivatives.spec.ts | 38 +- .../__tests__/importRemoteDataset.spec.ts | 40 +- .../resolvers/__tests__/permssions.spec.ts | 20 +- .../resolvers/__tests__/snapshots.spec.ts | 58 +-- .../graphql/resolvers/__tests__/user.spec.ts | 16 +- .../src/graphql/resolvers/brainlife.ts | 8 +- .../src/graphql/resolvers/cache.ts | 8 +- .../src/graphql/resolvers/comment.ts | 32 +- .../src/graphql/resolvers/dataset-search.ts | 86 ++-- .../src/graphql/resolvers/dataset.ts | 74 ++-- .../src/graphql/resolvers/datasetType.ts | 6 +- .../src/graphql/resolvers/derivatives.ts | 20 +- .../src/graphql/resolvers/description.ts | 8 +- .../src/graphql/resolvers/draft.ts | 26 +- .../src/graphql/resolvers/flaggedFiles.ts | 8 +- .../src/graphql/resolvers/follow.ts | 2 +- .../src/graphql/resolvers/git.ts | 6 +- .../src/graphql/resolvers/history.ts | 12 +- .../graphql/resolvers/importRemoteDataset.ts | 23 +- .../src/graphql/resolvers/index.ts | 18 +- .../src/graphql/resolvers/issues.ts | 18 +- .../src/graphql/resolvers/metadata.ts | 16 +- .../src/graphql/resolvers/mutation.ts | 52 +-- .../src/graphql/resolvers/newsletter.ts | 4 +- .../src/graphql/resolvers/permissions.ts | 31 +- .../src/graphql/resolvers/publish.ts | 14 +- .../src/graphql/resolvers/query.ts | 10 +- .../src/graphql/resolvers/readme.ts | 6 +- .../src/graphql/resolvers/reexporter.ts | 4 +- .../src/graphql/resolvers/relation.ts | 10 +- .../src/graphql/resolvers/reset.ts | 4 +- .../src/graphql/resolvers/reviewer.ts | 8 +- .../src/graphql/resolvers/snapshots.ts | 98 ++--- .../src/graphql/resolvers/stars.ts | 2 +- .../src/graphql/resolvers/summary.ts | 6 +- .../src/graphql/resolvers/upload.ts | 10 +- .../src/graphql/resolvers/user.ts | 32 +- .../src/graphql/resolvers/validation.ts | 20 +- .../openneuro-server/src/graphql/schema.ts | 8 +- .../src/graphql/utils/file.ts | 4 +- .../openneuro-server/src/handlers/comments.ts | 22 +- .../openneuro-server/src/handlers/config.ts | 2 +- .../openneuro-server/src/handlers/datalad.ts | 44 +- packages/openneuro-server/src/handlers/doi.ts | 12 +- .../openneuro-server/src/handlers/reviewer.ts | 12 +- .../openneuro-server/src/handlers/sitemap.ts | 38 +- .../openneuro-server/src/handlers/stars.ts | 21 +- .../src/handlers/subscriptions.ts | 33 +- .../openneuro-server/src/handlers/users.ts | 6 +- .../src/libs/__tests__/apikey.spec.ts | 26 +- .../libs/__tests__/datalad-service.spec.ts | 38 +- .../src/libs/__tests__/dataset.spec.ts | 18 +- packages/openneuro-server/src/libs/apikey.ts | 10 +- .../libs/authentication/__tests__/jwt.spec.ts | 24 +- .../src/libs/authentication/crypto.ts | 32 +- .../src/libs/authentication/google.ts | 16 +- .../src/libs/authentication/jwt.ts | 62 ++- .../src/libs/authentication/orcid.ts | 22 +- .../src/libs/authentication/passport.ts | 58 +-- .../src/libs/authentication/states.ts | 32 +- packages/openneuro-server/src/libs/counter.ts | 2 +- .../src/libs/datalad-service.ts | 8 +- packages/openneuro-server/src/libs/dataset.ts | 6 +- .../src/libs/doi/__tests__/doi.spec.ts | 30 +- .../src/libs/doi/__tests__/normalize.spec.ts | 38 +- .../openneuro-server/src/libs/doi/index.ts | 48 +- .../src/libs/doi/normalize.ts | 4 +- .../src/libs/email/__tests__/index.spec.ts | 28 +- .../openneuro-server/src/libs/email/index.ts | 8 +- .../__tests__/comment-created.spec.ts | 24 +- .../__tests__/dataset-deleted.spec.ts | 12 +- .../__tests__/owner-unsubscribed.spec.ts | 12 +- .../__tests__/snapshot-created.spec.ts | 18 +- .../__tests__/snapshot-reminder.spec.ts | 14 +- .../libs/email/templates/comment-created.ts | 3 +- .../libs/email/templates/dataset-deleted.ts | 3 +- .../email/templates/dataset-import-failed.ts | 3 +- .../libs/email/templates/dataset-imported.ts | 3 +- .../email/templates/owner-unsubscribed.ts | 3 +- .../libs/email/templates/snapshot-created.ts | 3 +- .../libs/email/templates/snapshot-reminder.ts | 3 +- .../src/libs/notifications.ts | 195 ++++---- packages/openneuro-server/src/libs/orcid.ts | 40 +- packages/openneuro-server/src/libs/redis.ts | 12 +- .../models/__tests__/ingestDataset.spec.ts | 30 +- .../openneuro-server/src/models/analytics.ts | 4 +- .../src/models/badAnnexObject.ts | 12 +- .../openneuro-server/src/models/comment.ts | 20 +- .../openneuro-server/src/models/counter.ts | 4 +- .../openneuro-server/src/models/dataset.ts | 32 +- .../openneuro-server/src/models/deletion.ts | 6 +- .../src/models/deprecatedSnapshot.ts | 4 +- packages/openneuro-server/src/models/doi.ts | 4 +- packages/openneuro-server/src/models/file.ts | 4 +- .../src/models/ingestDataset.ts | 8 +- packages/openneuro-server/src/models/issue.ts | 4 +- packages/openneuro-server/src/models/key.ts | 4 +- .../src/models/mailgunIdentifier.ts | 4 +- .../openneuro-server/src/models/metadata.ts | 6 +- .../openneuro-server/src/models/newsletter.ts | 6 +- .../src/models/notification.ts | 4 +- .../openneuro-server/src/models/permission.ts | 8 +- .../openneuro-server/src/models/reviewer.ts | 14 +- .../openneuro-server/src/models/snapshot.ts | 4 +- packages/openneuro-server/src/models/stars.ts | 12 +- .../src/models/subscription.ts | 4 +- .../openneuro-server/src/models/summary.ts | 4 +- .../openneuro-server/src/models/upload.ts | 6 +- packages/openneuro-server/src/models/user.ts | 8 +- packages/openneuro-server/src/routes.ts | 124 +++--- packages/openneuro-server/src/server.ts | 18 +- .../utils/__tests__/datasetOrSnapshot.spec.ts | 50 +-- .../src/utils/__tests__/validateUrl.spec.ts | 20 +- .../src/utils/datasetOrSnapshot.ts | 4 +- .../openneuro-server/src/utils/validateUrl.ts | 2 +- test/setup.ts | 8 +- vite.config.ts | 6 +- 647 files changed, 8928 insertions(+), 8655 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 8aec1d53ac..46684edb43 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -11,7 +11,7 @@ "port": 9222, "url": "http://localhost:9876", "urlFilter": "http://localhost:9876*", - "webRoot": "${workspaceFolder}/packages/openneuro-app/src", + "webRoot": "${workspaceFolder}/packages/openneuro-app/src" } ] } diff --git a/__mocks__/ioredis.js b/__mocks__/ioredis.js index 1405f6faa4..799bc7fc2c 100644 --- a/__mocks__/ioredis.js +++ b/__mocks__/ioredis.js @@ -1,3 +1,3 @@ -import Redis from 'ioredis-mock' +import Redis from "ioredis-mock" export { Redis } export default Redis diff --git a/__mocks__/superagent.js b/__mocks__/superagent.js index d43db83070..49a4b4dad1 100644 --- a/__mocks__/superagent.js +++ b/__mocks__/superagent.js @@ -1,4 +1,4 @@ -import { vi } from 'vitest' +import { vi } from "vitest" // mock for superagent - __mocks__/superagent.js class MockResponse { @@ -19,7 +19,7 @@ class MockResponse { } } -const createRequestStub = obj => vi.fn(() => obj) +const createRequestStub = (obj) => vi.fn(() => obj) function Request() { this.mockResponse = new MockResponse() @@ -34,7 +34,7 @@ function Request() { this.set = createRequestStub(this) this.accept = createRequestStub(this) this.timeout = createRequestStub(this) - this.then = cb => { + this.then = (cb) => { return new Promise((resolve, reject) => { if (this.mockError) { return reject(this.mockError) @@ -42,7 +42,7 @@ function Request() { return resolve(cb(this.mockResponse)) }) } - this.end = vi.fn().mockImplementation(callback => { + this.end = vi.fn().mockImplementation((callback) => { if (this.mockDelay) { this.delayTimer = setTimeout( callback, @@ -57,13 +57,13 @@ function Request() { callback(this.mockError, this.mockResponse) }) //expose helper methods for tests to set - this.__setMockDelay = boolValue => { + this.__setMockDelay = (boolValue) => { this.mockDelay = boolValue } - this.__setMockResponse = mockRes => { + this.__setMockResponse = (mockRes) => { this.mockResponse = mockRes } - this.__setMockError = mockErr => { + this.__setMockError = (mockErr) => { this.mockError = mockErr } } diff --git a/babel.config.js b/babel.config.js index 1df5b89f9a..a249be1638 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,30 +1,30 @@ -module.exports = function(api) { +module.exports = function (api) { api.cache.never() return { plugins: [ - '@loadable/babel-plugin', - '@babel/plugin-proposal-object-rest-spread', - '@babel/plugin-proposal-class-properties', - '@babel/syntax-dynamic-import', - '@babel/plugin-proposal-optional-chaining', - ['@babel/plugin-transform-runtime', { corejs: 3 }], + "@loadable/babel-plugin", + "@babel/plugin-proposal-object-rest-spread", + "@babel/plugin-proposal-class-properties", + "@babel/syntax-dynamic-import", + "@babel/plugin-proposal-optional-chaining", + ["@babel/plugin-transform-runtime", { corejs: 3 }], ], presets: [ - '@babel/preset-react', + "@babel/preset-react", [ - '@babel/preset-env', + "@babel/preset-env", { targets: { - chrome: '63', - firefox: '60', - safari: '11', + chrome: "63", + firefox: "60", + safari: "11", }, - useBuiltIns: 'usage', + useBuiltIns: "usage", corejs: 3, }, ], - '@babel/preset-typescript', + "@babel/preset-typescript", ], - sourceType: 'unambiguous', + sourceType: "unambiguous", } } diff --git a/deno.json b/deno.json index e3bc82bc48..3e151e5aca 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,16 @@ { "fmt": { "semiColons": false, - "singleQuote": true + "proseWrap": "preserve", + "exclude": [ + ".yarn/", + ".pnp.cjs", + ".pnp.loader.mjs", + "packages/openneuro-app/src/scripts/utils/schema-validator.js", + "dist", + "packages/**/dist", + "services/datalad/tests/.pytest_cache", + "**/__pycache/**" + ] } } diff --git a/docs/api.md b/docs/api.md index 8ad7627f13..11eba63d85 100644 --- a/docs/api.md +++ b/docs/api.md @@ -210,7 +210,7 @@ mutation { ### Deleting Files/Folders You can remove files or folders from the currend draft with the `deleteFiles` mutation. Multiple -arguments can be provided in the changes array for batch deletion of paths. Paths provided in +arguments can be provided in the changes array for batch deletion of paths. Paths provided in argument are relative to the dataset root, omitting a filename a with `""` will delete the folder provided via the path argument. For examples see below: diff --git a/docs/faq.md b/docs/faq.md index e734fd4d07..7970b6968a 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -10,12 +10,12 @@ Yes! ## Are there any restrictions on the uploaded data? -Yes. By uploading this dataset to OpenNeuro you have to agree to the following conditions: +Yes. By uploading this dataset to OpenNeuro you have to agree to the following conditions: -* You are the owner of this dataset and have any necessary ethics permissions to share the data publicly. -* This dataset does not include any identifiable personal health information as defined by the Health Insurance Portability and Accountability Act of 1996 (including names, zip codes, dates of birth, acquisition dates, facial features on structural scans, etc.). -* You agree that this dataset will become publicly available under a Creative Commons CC0 license after a grace period of 36 months counted from the first successful version of the dataset. -* This dataset is not subject to GDPR protections. +- You are the owner of this dataset and have any necessary ethics permissions to share the data publicly. +- This dataset does not include any identifiable personal health information as defined by the Health Insurance Portability and Accountability Act of 1996 (including names, zip codes, dates of birth, acquisition dates, facial features on structural scans, etc.). +- You agree that this dataset will become publicly available under a Creative Commons CC0 license after a grace period of 36 months counted from the first successful version of the dataset. +- This dataset is not subject to GDPR protections. ## What if I will not be able to publish my paper in 36 months? @@ -25,7 +25,7 @@ You can apply for up to two 6-month long extensions of the grace period. To appl Yes! We recommend using the Open Brain Consent - [Ultimate consent form](https://open-brain-consent.readthedocs.io/en/stable/ultimate.html). -* For GDPR protected studies, they have a [Ultimate consent form GDPR edition](https://open-brain-consent.readthedocs.io/en/stable/gdpr/ultimate_gdpr.html). +- For GDPR protected studies, they have a [Ultimate consent form GDPR edition](https://open-brain-consent.readthedocs.io/en/stable/gdpr/ultimate_gdpr.html). ## Do I need to format my data in some special way before uploading it to OpenNeuro? @@ -47,9 +47,9 @@ We offer two options for uploading data onto OpenNeuro. The first is to upload v When OpenNeuro first began accepting data, we hosted datasets that were dedicated to the public domain (CC0 or PDDL) or released under the CC-BY license. The idea of accepting CC-BY licenses was to reflect the academic norm of citing sources, but it fails to achieve that goal. In [CC BY and data: Not always a good fit](https://osc.universityofcalifornia.edu/2016/09/cc-by-and-data-not-always-a-good-fit/), it is argued: -> **CC licenses are not sufficient for ensuring proper attribution in many cases because their restrictions — including attribution — do not apply to facts.** +> **CC licenses are not sufficient for ensuring proper attribution in many cases because their restrictions — including attribution — do not apply to facts.** > ... > **CC licenses' attribution requirements aren't necessary because scholars have very good reasons to provide attribution that has nothing to do with copyright** \[...] Data that comes from nowhere has little credibility. If someone wants to use data as persuasive evidence, they need to refer readers and reviewers back to its source: who it came from and how it was produced. -CC-BY places an ambiguous legal hurdle between researchers and data they are considering using, even if only intended to enforce standard academic practice. To reduce uncertainty for data consumers, all newly published datasets are released under CC0, as are new versions of previously released datasets. We do nonetheless want to encourage proper attribution of datasets hosted on OpenNeuro. Each version of a dataset is assigned a unique DOI, enabling researchers to cite the version of a dataset they analyzed. Additionally, all OpenNeuro datasets may include a ["HowToAcknowledge" field](https://bids-specification.readthedocs.io/en/stable/03-modality-agnostic-files.html#dataset_descriptionjson), in which dataset providers may provide specific instructions for users for what they consider an appropriate citation. +CC-BY places an ambiguous legal hurdle between researchers and data they are considering using, even if only intended to enforce standard academic practice. To reduce uncertainty for data consumers, all newly published datasets are released under CC0, as are new versions of previously released datasets. We do nonetheless want to encourage proper attribution of datasets hosted on OpenNeuro. Each version of a dataset is assigned a unique DOI, enabling researchers to cite the version of a dataset they analyzed. Additionally, all OpenNeuro datasets may include a ["HowToAcknowledge" field](https://bids-specification.readthedocs.io/en/stable/03-modality-agnostic-files.html#dataset_descriptionjson), in which dataset providers may provide specific instructions for users for what they consider an appropriate citation. diff --git a/docs/index.md b/docs/index.md index 6665f344cc..c80fc98a0b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -5,7 +5,7 @@ for sharing neuroimaging data. ## Getting started -If you are a looking for datasets, [OpenNeuro Search][] allows you to search public +If you are a looking for datasets, [OpenNeuro Search][OpenNeuro Search] allows you to search public datasets. If you are considering uploading datasets to OpenNeuro, or recommending OpenNeuro as diff --git a/docs/policy/data_management_plans.md b/docs/policy/data_management_plans.md index 46b084d8b2..8a8983b4cc 100644 --- a/docs/policy/data_management_plans.md +++ b/docs/policy/data_management_plans.md @@ -37,54 +37,54 @@ upload data to OpenNeuro: The National Institutes of Health has published a list of "desirable characteristics" for data repositories: - **Unique Persistent Identifiers** : > Assigns datasets a citable, unique persistent identifier, such as a digital object identifier (DOI) or accession number, to support data discovery, reporting, and research assessment. The identifier points to a persistent landing page that remains accessible even if the dataset is de-accessioned or no longer available. - OpenNeuro: - * assigns internal accession numbers (for example, `ds000001`) on initial upload - * generates a [DOI](https://www.doi.org/) for each version of a dataset - * maintains landing pages for published datasets that have been removed +OpenNeuro: + +- assigns internal accession numbers (for example, `ds000001`) on initial upload +- generates a [DOI](https://www.doi.org/) for each version of a dataset +- maintains landing pages for published datasets that have been removed **Long-Term Sustainability** : > Has a plan for long-term management of data, including maintaining integrity, authenticity, and availability of datasets; building on a stable technical infrastructure and funding plans; and having contingency plans to ensure data are available and maintained during and after unforeseen events. - OpenNeuro's [](data_retention.md) detail the technical approaches to maintaining integrity, authenticity - and availability, including redundant distribution mechanisms that do not rely upon the availability of - the primary website. - The source code and deployment specifications are maintained in public repositories, - using industry-standard technologies that are not tied to any one hosting provider. - OpenNeuro is funded through an NIMH R24 grant, a five-year funding mechanism that enables long-term - stability. +OpenNeuro's [](data_retention.md) detail the technical approaches to maintaining integrity, authenticity +and availability, including redundant distribution mechanisms that do not rely upon the availability of +the primary website. +The source code and deployment specifications are maintained in public repositories, +using industry-standard technologies that are not tied to any one hosting provider. +OpenNeuro is funded through an NIMH R24 grant, a five-year funding mechanism that enables long-term +stability. **Metadata** : > Ensures datasets are accompanied by metadata to enable discovery, reuse, and citation of datasets, using schema that are appropriate to, and ideally widely used across, the community(ies) the repository serves. Domain-specific repositories would generally have more detailed metadata than generalist repositories. - OpenNeuro requires all datasets be uploaded in [BIDS][] format, a community-developed - standard for organizing data and metadata. OpenNeuro extracts metadata from the datasets - to populate the dataset landing page and enable search queries. +OpenNeuro requires all datasets be uploaded in [BIDS][BIDS] format, a community-developed +standard for organizing data and metadata. OpenNeuro extracts metadata from the datasets +to populate the dataset landing page and enable search queries. **Curation and Quality Assurance** : > Provides, or has a mechanism for others to provide, expert curation and quality assurance to improve the accuracy and integrity of datasets and metadata. - OpenNeuro permits dataset owners to grant anonymous review access to private datasets, - as well as write access to trusted users, if they wish to seek expert assistance. - OpenNeuro *does not* currently provide curation assistance or a method for interested third - parties to annotate datasets without the author's consent. - Users may leave comments on datasets. +OpenNeuro permits dataset owners to grant anonymous review access to private datasets, +as well as write access to trusted users, if they wish to seek expert assistance. +OpenNeuro _does not_ currently provide curation assistance or a method for interested third +parties to annotate datasets without the author's consent. +Users may leave comments on datasets. **Free and Easy Access** : > Provides broad, equitable, and maximally open access to datasets and their metadata free of charge in a timely manner after submission, consistent with legal and ethical limits required to maintain privacy and confidentiality, Tribal sovereignty, and protection of other sensitive data. - OpenNeuro provides on-demand access to all published datasets through multiple download mechanisms, - free of charge, over the Internet. - All data and metadata are released into the Public Domain. +OpenNeuro provides on-demand access to all published datasets through multiple download mechanisms, +free of charge, over the Internet. +All data and metadata are released into the Public Domain. **Broad and Measured Reuse** : > Makes datasets and their metadata available with broadest possible terms of reuse; and provides the ability to measure attribution, citation, and reuse of data (i.e., through assignment of adequate metadata and unique PIDs). - OpenNeuro is working toward providing mechanisms for measuring dataset downloads and - linking to related digital objects like journal articles. +OpenNeuro is working toward providing mechanisms for measuring dataset downloads and +linking to related digital objects like journal articles. **Clear Use Guidance** : > Provides accompanying documentation describing terms of dataset access and use (e.g., particular licenses, need for approval by a data use committee). @@ -92,8 +92,8 @@ for data repositories: **Security and Integrity** : > Has documented measures in place to meet generally accepted criteria for preventing unauthorized access to, modification of, or release of data, with levels of security that are appropriate to the sensitivity of data. - OpenNeuro currently only hosts datasets that do not require restricted access, as attested by - the dataset uploader. +OpenNeuro currently only hosts datasets that do not require restricted access, as attested by +the dataset uploader. **Confidentiality** : > Has documented capabilities for ensuring that administrative, technical, and physical safeguards are employed to comply with applicable confidentiality, risk management, and continuous monitoring requirements for sensitive data. @@ -101,19 +101,18 @@ for data repositories: **Common Format** : > Allows datasets and metadata downloaded, accessed, or exported from the repository to be in widely used, preferably non-proprietary, formats consistent with those used in the community(ies) the repository serves. - All OpenNeuro datasets are formatted according to the [BIDS][] standard. - The DataLad access mechanism retrieves the dataset in the form of a [git][]/[git-annex][] repository. +All OpenNeuro datasets are formatted according to the [BIDS][BIDS] standard. +The DataLad access mechanism retrieves the dataset in the form of a [git][git]/[git-annex][git-annex] repository. **Provenance** : > Has mechanisms in place to record the origin, chain of custody, and any modifications to submitted datasets and metadata. - All changes to datasets are recorded in the [git][] history of each dataset. +All changes to datasets are recorded in the [git][git] history of each dataset. **Retention Policy** : > Provides documentation on policies for data retention within the repository. - These policies may be found at [](data_retention.md). - +These policies may be found at [](data_retention.md). [BIDS]: https://bids.neuroimaging.io [NIHbmic]: https://www.nlm.nih.gov/NIHbmic/domain_specific_repositories.html diff --git a/docs/user_guide.md b/docs/user_guide.md index 3e9dea74d5..d07229b376 100644 --- a/docs/user_guide.md +++ b/docs/user_guide.md @@ -19,9 +19,9 @@ To access public datasets, click on the PUBLIC DASHBOARD button in the navigatio ![navigation bar, logged in, public dashboard selected](./assets/nav-bar-logged-in-public-dashboard.png) -On the Public Dashboard, datasets can be searched for by keyword or sorted by various criteria. +On the Public Dashboard, datasets can be searched for by keyword or sorted by various criteria. -Visible from the dashboard are each dataset's high-level stats and information. To access a dataset's landing page, click on its name. +Visible from the dashboard are each dataset's high-level stats and information. To access a dataset's landing page, click on its name. ![public dashboard, dataset item](./assets/public-dashboard-dataset-item.png) @@ -34,6 +34,7 @@ A dataset's landing page has four major sections: [a toolbar](#the-toolbar), a [ ![dataset page toolbar](./assets/dataset-page-toolbar.png) Located at the top of the page, the toolbar contains the following options (icons left to right): + - Follow/Subscribe: Get email updates when a new version is posted. - Like/Save: Add dataset to your Dashboard under Saved Datasets. - View metadata: View data not necessarily contained within the dataset, including it's DOI, OpenNeuro ID and URL, study type and design, number of trials, etc. This data helps make datasets searchable, and a compilation of the metadata of all datasets on OpenNeuro can be found at [metadata.openneuro.org](http://metadata.openneuro.org/). @@ -51,6 +52,7 @@ Changes to dataset information are tracked in the dataset's snapshots (versions) ### Dataset Snapshot This is the main section of the dataset landing page, containing almost all of its information and files at the given snapshot. Here, you can: + - View a dataset's information (extracted from its README and description.json files). - View and download individual files. The file viewer supports the following file extensions: csv, html, txt, json, tsv, nii, and nii.gz. - Download the dataset via the browser. @@ -66,15 +68,15 @@ Once you've signed into OpenNeuro, you'll be able to upload your dataset by hitt There are a few things to keep in mind before uploading a dataset: - 1. You must be the owner of the dataset and have the necessary ethics permissions to share the data publicly. +1. You must be the owner of the dataset and have the necessary ethics permissions to share the data publicly. - 2. The dataset may not be subject to GDPR protections. +2. The dataset may not be subject to GDPR protections. - 3. The dataset must follow [BIDS](https://bids.neuroimaging.io/) specifications. Your dataset will be validated on upload, but if you want to check it for yourself, a web-based tool is available [here](https://bids-standard.github.io/bids-validator/), and a cli tool can be found [here](https://github.com/bids-standard/bids-validator). +3. The dataset must follow [BIDS](https://bids.neuroimaging.io/) specifications. Your dataset will be validated on upload, but if you want to check it for yourself, a web-based tool is available [here](https://bids-standard.github.io/bids-validator/), and a cli tool can be found [here](https://github.com/bids-standard/bids-validator). - 4. You will need to ensure that either all structural scans have been defaced (we recommend the [pydeface](https://github.com/poldracklab/pydeface) tool) or that you have explicit participant consent and ethical authorization to publish without defacing. +4. You will need to ensure that either all structural scans have been defaced (we recommend the [pydeface](https://github.com/poldracklab/pydeface) tool) or that you have explicit participant consent and ethical authorization to publish without defacing. - 5. You must be willing that the dataset becomes publicly available under the [Creative Commons CC0 license](https://creativecommons.org/share-your-work/public-domain/cc0/) upon publishing or after a grace period of 36 months from the date of its first snapshot creation. +5. You must be willing that the dataset becomes publicly available under the [Creative Commons CC0 license](https://creativecommons.org/share-your-work/public-domain/cc0/) upon publishing or after a grace period of 36 months from the date of its first snapshot creation. The first upload prompt will ask you to select the dataset's folder from your computer. @@ -82,7 +84,7 @@ The first upload prompt will ask you to select the dataset's folder from your co Once you've selected and uploaded the dataset, it will be checked by the BIDS validator. The dataset may be uploaded with warnings, but errors must be resolved before the upload can be finalized. -The next step is to fill out the metadata form, which contains information not accessible from the dataset itself and is used to facilitate search results. This is optional, but highly recommended. +The next step is to fill out the metadata form, which contains information not accessible from the dataset itself and is used to facilitate search results. This is optional, but highly recommended. Finally, you will need to accept the Terms and Conditions and affirm that the data has been either defaced or given consent to be made public otherwise. Once you have done so, the dataset will begin uploading in the background and you'll be free to navigate the site (but don't reload it or close the window, or the process will be cut short). When the dataset has finished uploading, you'll see a notification pop up in the bottom-right corner of the page. @@ -101,7 +103,8 @@ The draft page information is nearly identical to the snapshot pages, the differ ![owned dataset page toolbar](./assets/own-dataset-page-toolbar.png) The dataset toolbar will have a few new items, including: -- Publish: Make your dataset public. This will make it available under the CC0 license. + +- Publish: Make your dataset public. This will make it available under the CC0 license. - Delete: Permanently remove your dataset from OpenNeuro. If you are deleting the dataset to replace it, a redirect url can be submitted with the delete form. - Manage Permissions: Add collaborators to the dataset and manage their read/write permissions. - Create Snapshot: Create a new version of this dataset with changes made to Draft. diff --git a/packages/openneuro-app/__mocks__/fileMock.js b/packages/openneuro-app/__mocks__/fileMock.js index 0e56c5b5f7..ebf20155e6 100644 --- a/packages/openneuro-app/__mocks__/fileMock.js +++ b/packages/openneuro-app/__mocks__/fileMock.js @@ -1 +1 @@ -module.exports = 'test-file-stub' +module.exports = "test-file-stub" diff --git a/packages/openneuro-app/pluralize-esm.js b/packages/openneuro-app/pluralize-esm.js index 1cd134cc57..d044eaf9a8 100644 --- a/packages/openneuro-app/pluralize-esm.js +++ b/packages/openneuro-app/pluralize-esm.js @@ -16,8 +16,8 @@ var irregularSingles = {} * @return {RegExp} */ function sanitizeRule(rule) { - if (typeof rule === 'string') { - return new RegExp('^' + rule + '$', 'i') + if (typeof rule === "string") { + return new RegExp("^" + rule + "$", "i") } return rule @@ -59,7 +59,7 @@ function restoreCase(word, token) { */ function interpolate(str, args) { return str.replace(/\$(\d{1,2})/g, function (match, index) { - return args[index] || '' + return args[index] || "" }) } @@ -74,7 +74,7 @@ function replace(word, rule) { return word.replace(rule[0], function (match, index) { var result = interpolate(rule[1], arguments) - if (match === '') { + if (match === "") { return restoreCase(word[index - 1], result) } @@ -159,10 +159,11 @@ function checkWord(replaceMap, keepMap, rules, bool) { * @return {string} */ function pluralize(word, count, inclusive) { - var pluralized = - count === 1 ? pluralize.singular(word) : pluralize.plural(word) + var pluralized = count === 1 + ? pluralize.singular(word) + : pluralize.plural(word) - return (inclusive ? count + ' ' : '') + pluralized + return (inclusive ? count + " " : "") + pluralized } /** @@ -227,14 +228,14 @@ pluralize.addSingularRule = function (rule, replacement) { * @param {(string|RegExp)} word */ pluralize.addUncountableRule = function (word) { - if (typeof word === 'string') { + if (typeof word === "string") { uncountables[word.toLowerCase()] = true return } // Set singular and plural references for the word. - pluralize.addPluralRule(word, '$0') - pluralize.addSingularRule(word, '$0') + pluralize.addPluralRule(word, "$0") + pluralize.addSingularRule(word, "$0") } /** @@ -249,258 +250,250 @@ pluralize.addIrregularRule = function (single, plural) { irregularSingles[single] = plural irregularPlurals[plural] = single -} - -/** +} /** * Irregular rules. */ ;[ // Pronouns. - ['I', 'we'], - ['me', 'us'], - ['he', 'they'], - ['she', 'they'], - ['them', 'them'], - ['myself', 'ourselves'], - ['yourself', 'yourselves'], - ['itself', 'themselves'], - ['herself', 'themselves'], - ['himself', 'themselves'], - ['themself', 'themselves'], - ['is', 'are'], - ['was', 'were'], - ['has', 'have'], - ['this', 'these'], - ['that', 'those'], + ["I", "we"], + ["me", "us"], + ["he", "they"], + ["she", "they"], + ["them", "them"], + ["myself", "ourselves"], + ["yourself", "yourselves"], + ["itself", "themselves"], + ["herself", "themselves"], + ["himself", "themselves"], + ["themself", "themselves"], + ["is", "are"], + ["was", "were"], + ["has", "have"], + ["this", "these"], + ["that", "those"], // Words ending in with a consonant and `o`. - ['echo', 'echoes'], - ['dingo', 'dingoes'], - ['volcano', 'volcanoes'], - ['tornado', 'tornadoes'], - ['torpedo', 'torpedoes'], + ["echo", "echoes"], + ["dingo", "dingoes"], + ["volcano", "volcanoes"], + ["tornado", "tornadoes"], + ["torpedo", "torpedoes"], // Ends with `us`. - ['genus', 'genera'], - ['viscus', 'viscera'], + ["genus", "genera"], + ["viscus", "viscera"], // Ends with `ma`. - ['stigma', 'stigmata'], - ['stoma', 'stomata'], - ['dogma', 'dogmata'], - ['lemma', 'lemmata'], - ['schema', 'schemata'], - ['anathema', 'anathemata'], + ["stigma", "stigmata"], + ["stoma", "stomata"], + ["dogma", "dogmata"], + ["lemma", "lemmata"], + ["schema", "schemata"], + ["anathema", "anathemata"], // Other irregular rules. - ['ox', 'oxen'], - ['axe', 'axes'], - ['die', 'dice'], - ['yes', 'yeses'], - ['foot', 'feet'], - ['eave', 'eaves'], - ['goose', 'geese'], - ['tooth', 'teeth'], - ['quiz', 'quizzes'], - ['human', 'humans'], - ['proof', 'proofs'], - ['carve', 'carves'], - ['valve', 'valves'], - ['looey', 'looies'], - ['thief', 'thieves'], - ['groove', 'grooves'], - ['pickaxe', 'pickaxes'], - ['passerby', 'passersby'], + ["ox", "oxen"], + ["axe", "axes"], + ["die", "dice"], + ["yes", "yeses"], + ["foot", "feet"], + ["eave", "eaves"], + ["goose", "geese"], + ["tooth", "teeth"], + ["quiz", "quizzes"], + ["human", "humans"], + ["proof", "proofs"], + ["carve", "carves"], + ["valve", "valves"], + ["looey", "looies"], + ["thief", "thieves"], + ["groove", "grooves"], + ["pickaxe", "pickaxes"], + ["passerby", "passersby"], ].forEach(function (rule) { return pluralize.addIrregularRule(rule[0], rule[1]) -}) - -/** +}) /** * Pluralization rules. */ ;[ - [/s?$/i, 's'], - [/[^\u0000-\u007F]$/i, '$0'], - [/([^aeiou]ese)$/i, '$1'], - [/(ax|test)is$/i, '$1es'], - [/(alias|[^aou]us|t[lm]as|gas|ris)$/i, '$1es'], - [/(e[mn]u)s?$/i, '$1s'], - [/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, '$1'], + [/s?$/i, "s"], + [/[^\u0000-\u007F]$/i, "$0"], + [/([^aeiou]ese)$/i, "$1"], + [/(ax|test)is$/i, "$1es"], + [/(alias|[^aou]us|t[lm]as|gas|ris)$/i, "$1es"], + [/(e[mn]u)s?$/i, "$1s"], + [/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, "$1"], [ /(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, - '$1i', + "$1i", ], - [/(alumn|alg|vertebr)(?:a|ae)$/i, '$1ae'], - [/(seraph|cherub)(?:im)?$/i, '$1im'], - [/(her|at|gr)o$/i, '$1oes'], + [/(alumn|alg|vertebr)(?:a|ae)$/i, "$1ae"], + [/(seraph|cherub)(?:im)?$/i, "$1im"], + [/(her|at|gr)o$/i, "$1oes"], [ /(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, - '$1a', + "$1a", ], [ /(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, - '$1a', + "$1a", ], - [/sis$/i, 'ses'], - [/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, '$1$2ves'], - [/([^aeiouy]|qu)y$/i, '$1ies'], - [/([^ch][ieo][ln])ey$/i, '$1ies'], - [/(x|ch|ss|sh|zz)$/i, '$1es'], - [/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, '$1ices'], - [/\b((?:tit)?m|l)(?:ice|ouse)$/i, '$1ice'], - [/(pe)(?:rson|ople)$/i, '$1ople'], - [/(child)(?:ren)?$/i, '$1ren'], - [/eaux$/i, '$0'], - [/m[ae]n$/i, 'men'], - ['thou', 'you'], + [/sis$/i, "ses"], + [/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, "$1$2ves"], + [/([^aeiouy]|qu)y$/i, "$1ies"], + [/([^ch][ieo][ln])ey$/i, "$1ies"], + [/(x|ch|ss|sh|zz)$/i, "$1es"], + [/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, "$1ices"], + [/\b((?:tit)?m|l)(?:ice|ouse)$/i, "$1ice"], + [/(pe)(?:rson|ople)$/i, "$1ople"], + [/(child)(?:ren)?$/i, "$1ren"], + [/eaux$/i, "$0"], + [/m[ae]n$/i, "men"], + ["thou", "you"], ].forEach(function (rule) { return pluralize.addPluralRule(rule[0], rule[1]) -}) - -/** +}) /** * Singularization rules. */ ;[ - [/s$/i, ''], - [/(ss)$/i, '$1'], - [/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, '$1fe'], - [/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, '$1f'], - [/ies$/i, 'y'], - [/(dg|ss|ois|lk|ok|wn|mb|th|ch|ec|oal|is|ck|ix|sser|ts|wb)ies$/i, '$1ie'], + [/s$/i, ""], + [/(ss)$/i, "$1"], + [/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, "$1fe"], + [/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, "$1f"], + [/ies$/i, "y"], + [/(dg|ss|ois|lk|ok|wn|mb|th|ch|ec|oal|is|ck|ix|sser|ts|wb)ies$/i, "$1ie"], [ /\b(l|(?:neck|cross|hog|aun)?t|coll|faer|food|gen|goon|group|hipp|junk|vegg|(?:pork)?p|charl|calor|cut)ies$/i, - '$1ie', + "$1ie", ], - [/\b(mon|smil)ies$/i, '$1ey'], - [/\b((?:tit)?m|l)ice$/i, '$1ouse'], - [/(seraph|cherub)im$/i, '$1'], + [/\b(mon|smil)ies$/i, "$1ey"], + [/\b((?:tit)?m|l)ice$/i, "$1ouse"], + [/(seraph|cherub)im$/i, "$1"], [ /(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, - '$1', + "$1", ], [ /(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, - '$1sis', + "$1sis", ], - [/(movie|twelve|abuse|e[mn]u)s$/i, '$1'], - [/(test)(?:is|es)$/i, '$1is'], + [/(movie|twelve|abuse|e[mn]u)s$/i, "$1"], + [/(test)(?:is|es)$/i, "$1is"], [ /(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, - '$1us', + "$1us", ], [ /(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, - '$1um', + "$1um", ], [ /(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, - '$1on', + "$1on", ], - [/(alumn|alg|vertebr)ae$/i, '$1a'], - [/(cod|mur|sil|vert|ind)ices$/i, '$1ex'], - [/(matr|append)ices$/i, '$1ix'], - [/(pe)(rson|ople)$/i, '$1rson'], - [/(child)ren$/i, '$1'], - [/(eau)x?$/i, '$1'], - [/men$/i, 'man'], + [/(alumn|alg|vertebr)ae$/i, "$1a"], + [/(cod|mur|sil|vert|ind)ices$/i, "$1ex"], + [/(matr|append)ices$/i, "$1ix"], + [/(pe)(rson|ople)$/i, "$1rson"], + [/(child)ren$/i, "$1"], + [/(eau)x?$/i, "$1"], + [/men$/i, "man"], ].forEach(function (rule) { return pluralize.addSingularRule(rule[0], rule[1]) -}) - -/** +}) /** * Uncountable rules. */ ;[ // Singular words with no plurals. - 'adulthood', - 'advice', - 'agenda', - 'aid', - 'aircraft', - 'alcohol', - 'ammo', - 'analytics', - 'anime', - 'athletics', - 'audio', - 'bison', - 'blood', - 'bream', - 'buffalo', - 'butter', - 'carp', - 'cash', - 'chassis', - 'chess', - 'clothing', - 'cod', - 'commerce', - 'cooperation', - 'corps', - 'debris', - 'diabetes', - 'digestion', - 'elk', - 'energy', - 'equipment', - 'excretion', - 'expertise', - 'firmware', - 'flounder', - 'fun', - 'gallows', - 'garbage', - 'graffiti', - 'hardware', - 'headquarters', - 'health', - 'herpes', - 'highjinks', - 'homework', - 'housework', - 'information', - 'jeans', - 'justice', - 'kudos', - 'labour', - 'literature', - 'machinery', - 'mackerel', - 'mail', - 'media', - 'mews', - 'moose', - 'music', - 'mud', - 'manga', - 'news', - 'only', - 'personnel', - 'pike', - 'plankton', - 'pliers', - 'police', - 'pollution', - 'premises', - 'rain', - 'research', - 'rice', - 'salmon', - 'scissors', - 'series', - 'sewage', - 'shambles', - 'shrimp', - 'software', - 'staff', - 'swine', - 'tennis', - 'traffic', - 'transportation', - 'trout', - 'tuna', - 'wealth', - 'welfare', - 'whiting', - 'wildebeest', - 'wildlife', - 'you', + "adulthood", + "advice", + "agenda", + "aid", + "aircraft", + "alcohol", + "ammo", + "analytics", + "anime", + "athletics", + "audio", + "bison", + "blood", + "bream", + "buffalo", + "butter", + "carp", + "cash", + "chassis", + "chess", + "clothing", + "cod", + "commerce", + "cooperation", + "corps", + "debris", + "diabetes", + "digestion", + "elk", + "energy", + "equipment", + "excretion", + "expertise", + "firmware", + "flounder", + "fun", + "gallows", + "garbage", + "graffiti", + "hardware", + "headquarters", + "health", + "herpes", + "highjinks", + "homework", + "housework", + "information", + "jeans", + "justice", + "kudos", + "labour", + "literature", + "machinery", + "mackerel", + "mail", + "media", + "mews", + "moose", + "music", + "mud", + "manga", + "news", + "only", + "personnel", + "pike", + "plankton", + "pliers", + "police", + "pollution", + "premises", + "rain", + "research", + "rice", + "salmon", + "scissors", + "series", + "sewage", + "shambles", + "shrimp", + "software", + "staff", + "swine", + "tennis", + "traffic", + "transportation", + "trout", + "tuna", + "wealth", + "welfare", + "whiting", + "wildebeest", + "wildlife", + "you", /pok[eé]mon$/i, // Regexes. /[^aeiou]ese$/i, // "chinese", "japanese" diff --git a/packages/openneuro-app/src/@types/custom.d.ts b/packages/openneuro-app/src/@types/custom.d.ts index bf78eb1f8d..b0d0ea9ab4 100644 --- a/packages/openneuro-app/src/@types/custom.d.ts +++ b/packages/openneuro-app/src/@types/custom.d.ts @@ -1,18 +1,18 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ // Allow .png imports -declare module '*.png' { +declare module "*.png" { const value: string export = value } // Allow .svg imports -declare module '*.svg' { +declare module "*.svg" { const value: string export = value } // Allow .scss imports -declare module '*.scss' { +declare module "*.scss" { const value: string export = value } diff --git a/packages/openneuro-app/src/@types/react.d.ts b/packages/openneuro-app/src/@types/react.d.ts index aa7ed8f9bb..d30b029519 100644 --- a/packages/openneuro-app/src/@types/react.d.ts +++ b/packages/openneuro-app/src/@types/react.d.ts @@ -1,12 +1,11 @@ -import React from 'react' +import React from "react" /** * Required to use the webkitdirectory attribute on */ -declare module 'react' { +declare module "react" { interface InputHTMLAttributes - extends AriaAttributes, - DOMAttributes { + extends AriaAttributes, DOMAttributes { directory?: string webkitdirectory?: string } diff --git a/packages/openneuro-app/src/client.jsx b/packages/openneuro-app/src/client.jsx index d5a0154a90..52d1c644a1 100644 --- a/packages/openneuro-app/src/client.jsx +++ b/packages/openneuro-app/src/client.jsx @@ -1,20 +1,20 @@ /** * Browser client entrypoint - see server.tsx for SSR entrypoint */ -import './scripts/utils/global-polyfill' -import './scripts/apm.js' -import { ApolloProvider, InMemoryCache } from '@apollo/client' -import { createClient } from '@openneuro/client' -import React from 'react' -import ReactDOM from 'react-dom' -import { BrowserRouter, Route, Routes } from 'react-router-dom' -import App from './scripts/app' -import Index from './scripts/index' -import { version } from './lerna.json' -import { config } from './scripts/config' -import * as gtag from './scripts/utils/gtag' -import { relayStylePagination } from '@apollo/client/utilities' -import '@openneuro/components/page/page.scss' +import "./scripts/utils/global-polyfill" +import "./scripts/apm.js" +import { ApolloProvider, InMemoryCache } from "@apollo/client" +import { createClient } from "@openneuro/client" +import React from "react" +import ReactDOM from "react-dom" +import { BrowserRouter, Route, Routes } from "react-router-dom" +import App from "./scripts/app" +import Index from "./scripts/index" +import { version } from "./lerna.json" +import { config } from "./scripts/config" +import * as gtag from "./scripts/utils/gtag" +import { relayStylePagination } from "@apollo/client/utilities" +import "@openneuro/components/page/page.scss" gtag.initialize(config.analytics.trackingIds) @@ -32,7 +32,8 @@ ReactDOM.render( }, }, }), - })}> + })} + > } /> @@ -40,5 +41,5 @@ ReactDOM.render( , - document.getElementById('main'), + document.getElementById("main"), ) diff --git a/packages/openneuro-app/src/scripts/__mocks__/config.ts b/packages/openneuro-app/src/scripts/__mocks__/config.ts index 88958c1970..6230058dac 100644 --- a/packages/openneuro-app/src/scripts/__mocks__/config.ts +++ b/packages/openneuro-app/src/scripts/__mocks__/config.ts @@ -2,10 +2,10 @@ export const config = { /** * CRN */ - url: 'localhost:9876/crn/', + url: "localhost:9876/crn/", graphql: { - uri: 'http://server:8111', + uri: "http://server:8111", }, /** @@ -13,17 +13,17 @@ export const config = { */ auth: { google: { - clientID: 'google-client-id', + clientID: "google-client-id", }, orcid: { - clientID: 'orcid-client-id', + clientID: "orcid-client-id", }, }, sentry: { - environment: 'unit-tests', + environment: "unit-tests", }, support: { - url: 'https://example.com/test-suite', + url: "https://example.com/test-suite", }, } diff --git a/packages/openneuro-app/src/scripts/__utils__/mock-app-shell.tsx b/packages/openneuro-app/src/scripts/__utils__/mock-app-shell.tsx index a389c24498..ddda202af0 100644 --- a/packages/openneuro-app/src/scripts/__utils__/mock-app-shell.tsx +++ b/packages/openneuro-app/src/scripts/__utils__/mock-app-shell.tsx @@ -1,19 +1,20 @@ -import React from 'react' -import { MemoryRouter } from 'react-router-dom' -import { MockedProvider } from '@apollo/client/testing' -import { SearchParamsCtx } from '../search/search-params-ctx' -import { UserModalOpenCtx } from '../utils/user-login-modal-ctx' -import initialSearchParams from '../search/initial-search-params' +import React from "react" +import { MemoryRouter } from "react-router-dom" +import { MockedProvider } from "@apollo/client/testing" +import { SearchParamsCtx } from "../search/search-params-ctx" +import { UserModalOpenCtx } from "../utils/user-login-modal-ctx" +import initialSearchParams from "../search/initial-search-params" /** * Reusable shell component that provides any context required by major component trees */ -export const MockAppShell = ({ children, route = '/' }) => ( +export const MockAppShell = ({ children, route = "/" }) => ( + }} + > {children} diff --git a/packages/openneuro-app/src/scripts/apm.js b/packages/openneuro-app/src/scripts/apm.js index 46b55a603e..b29c0559bb 100644 --- a/packages/openneuro-app/src/scripts/apm.js +++ b/packages/openneuro-app/src/scripts/apm.js @@ -1,17 +1,17 @@ -import { init as initApm } from '@elastic/apm-rum' -import { config } from './config' -import { version } from '../lerna.json' +import { init as initApm } from "@elastic/apm-rum" +import { config } from "./config" +import { version } from "../lerna.json" export let apm export function setupApm() { if ( - config.sentry.environment === 'production' || - config.sentry.environment === 'staging' + config.sentry.environment === "production" || + config.sentry.environment === "staging" ) { apm = initApm({ serverUrl: config.ELASTIC_APM_SERVER_URL, - serviceName: 'openneuro-app', + serviceName: "openneuro-app", serviceVersion: version, environment: config.sentry.environment, }) diff --git a/packages/openneuro-app/src/scripts/app.tsx b/packages/openneuro-app/src/scripts/app.tsx index 3b3d968582..344ae8c594 100644 --- a/packages/openneuro-app/src/scripts/app.tsx +++ b/packages/openneuro-app/src/scripts/app.tsx @@ -1,10 +1,10 @@ -import React, { FC, ReactNode } from 'react' -import Helmet from 'react-helmet' -import { frontPage } from './pages/front-page/front-page-content' -import { CookiesProvider, Cookies } from 'react-cookie' -import { ToastContainer } from 'react-toastify' -import 'react-toastify/dist/ReactToastify.css' -import { MediaContextProvider } from './styles/media' +import React, { FC, ReactNode } from "react" +import Helmet from "react-helmet" +import { frontPage } from "./pages/front-page/front-page-content" +import { Cookies, CookiesProvider } from "react-cookie" +import { ToastContainer } from "react-toastify" +import "react-toastify/dist/ReactToastify.css" +import { MediaContextProvider } from "./styles/media" interface AppProps { children: ReactNode diff --git a/packages/openneuro-app/src/scripts/authentication/__tests__/profile.spec.js b/packages/openneuro-app/src/scripts/authentication/__tests__/profile.spec.js index 97cba319b4..cdf6bdb7c4 100644 --- a/packages/openneuro-app/src/scripts/authentication/__tests__/profile.spec.js +++ b/packages/openneuro-app/src/scripts/authentication/__tests__/profile.spec.js @@ -1,22 +1,22 @@ -import { parseJwt } from '../profile' +import { parseJwt } from "../profile" const asciiToken = - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" const utf8Token = - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Iuelnue1jOenkeWtpuiAhSIsImlhdCI6MTUxNjIzOTAyMn0.pUw2ARoXv4LkJXB1ZR3Th6xG83URT6mn1TftC7ac_O8' + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Iuelnue1jOenkeWtpuiAhSIsImlhdCI6MTUxNjIzOTAyMn0.pUw2ARoXv4LkJXB1ZR3Th6xG83URT6mn1TftC7ac_O8" -describe('authentication/profile', () => { - it('decodes a JWT to Javascript object', () => { +describe("authentication/profile", () => { + it("decodes a JWT to Javascript object", () => { expect(parseJwt(asciiToken)).toEqual({ - sub: '1234567890', - name: 'John Doe', + sub: "1234567890", + name: "John Doe", iat: 1516239022, }) }) - it('decodes a JWT with Unicode strings', () => { + it("decodes a JWT with Unicode strings", () => { expect(parseJwt(utf8Token)).toEqual({ - sub: '1234567890', - name: '神経科学者', + sub: "1234567890", + name: "神経科学者", iat: 1516239022, }) }) diff --git a/packages/openneuro-app/src/scripts/authentication/admin-user.jsx b/packages/openneuro-app/src/scripts/authentication/admin-user.jsx index 7587736f4c..1308bfc10c 100644 --- a/packages/openneuro-app/src/scripts/authentication/admin-user.jsx +++ b/packages/openneuro-app/src/scripts/authentication/admin-user.jsx @@ -1,5 +1,5 @@ -import { useCookies } from 'react-cookie' -import { getProfile } from './profile' +import { useCookies } from "react-cookie" +import { getProfile } from "./profile" export const isAdmin = () => { const [cookies] = useCookies() diff --git a/packages/openneuro-app/src/scripts/authentication/logged-in.jsx b/packages/openneuro-app/src/scripts/authentication/logged-in.jsx index d4edafe850..7ac6a26bd9 100644 --- a/packages/openneuro-app/src/scripts/authentication/logged-in.jsx +++ b/packages/openneuro-app/src/scripts/authentication/logged-in.jsx @@ -1,5 +1,5 @@ -import { useCookies } from 'react-cookie' -import { loginCheck } from './loginCheck.js' +import { useCookies } from "react-cookie" +import { loginCheck } from "./loginCheck.js" /** * Render children if logged in diff --git a/packages/openneuro-app/src/scripts/authentication/logged-out.jsx b/packages/openneuro-app/src/scripts/authentication/logged-out.jsx index f9f6cd4ddb..87b35fae58 100644 --- a/packages/openneuro-app/src/scripts/authentication/logged-out.jsx +++ b/packages/openneuro-app/src/scripts/authentication/logged-out.jsx @@ -1,5 +1,5 @@ -import { useCookies } from 'react-cookie' -import { loginCheck } from './loginCheck.js' +import { useCookies } from "react-cookie" +import { loginCheck } from "./loginCheck.js" /** * Render children if logged out diff --git a/packages/openneuro-app/src/scripts/authentication/loginCheck.js b/packages/openneuro-app/src/scripts/authentication/loginCheck.js index 9b9c77272b..798ed38387 100644 --- a/packages/openneuro-app/src/scripts/authentication/loginCheck.js +++ b/packages/openneuro-app/src/scripts/authentication/loginCheck.js @@ -1,4 +1,4 @@ -import { getProfile, guardExpired } from './profile' +import { getProfile, guardExpired } from "./profile" // Expects a universal cookie -export const loginCheck = cookies => guardExpired(getProfile(cookies)) +export const loginCheck = (cookies) => guardExpired(getProfile(cookies)) diff --git a/packages/openneuro-app/src/scripts/authentication/loginUrls.ts b/packages/openneuro-app/src/scripts/authentication/loginUrls.ts index eb508caa95..cc0803a7e8 100644 --- a/packages/openneuro-app/src/scripts/authentication/loginUrls.ts +++ b/packages/openneuro-app/src/scripts/authentication/loginUrls.ts @@ -1,4 +1,4 @@ -import { config } from '../config' +import { config } from "../config" export default { google: `${config.api}auth/google`, diff --git a/packages/openneuro-app/src/scripts/authentication/profile.ts b/packages/openneuro-app/src/scripts/authentication/profile.ts index 593ab92c62..9327a33092 100644 --- a/packages/openneuro-app/src/scripts/authentication/profile.ts +++ b/packages/openneuro-app/src/scripts/authentication/profile.ts @@ -1,4 +1,4 @@ -import jwtDecode from 'jwt-decode' +import jwtDecode from "jwt-decode" interface OpenNeuroTokenProfile { sub: string @@ -20,7 +20,7 @@ export const parseJwt = jwtDecode * Retrieve the user profile from JWT cookie */ export function getProfile(cookies): OpenNeuroTokenProfile { - const accessToken = cookies['accessToken'] + const accessToken = cookies["accessToken"] return accessToken ? parseJwt(accessToken) : null } @@ -28,7 +28,7 @@ export function getProfile(cookies): OpenNeuroTokenProfile { * Return profile if token is not expired. * @param {*} cookies */ -export const getUnexpiredProfile = cookies => { +export const getUnexpiredProfile = (cookies) => { const profile = getProfile(cookies) if (guardExpired(profile)) return profile } @@ -51,10 +51,10 @@ export const guardExpired = (profile: OpenNeuroTokenProfile): boolean => { * Returns true if active user has at least one of the permissions in expectedLevels * @param {string[]} expectedLevels */ -const hasDatasetPermissions = expectedLevels => (permissions, userId) => { +const hasDatasetPermissions = (expectedLevels) => (permissions, userId) => { if (userId) { const permission = permissions.userPermissions.find( - perm => perm.user.id === userId, + (perm) => perm.user.id === userId, ) return (permission && expectedLevels.includes(permission.level)) || false } @@ -62,7 +62,7 @@ const hasDatasetPermissions = expectedLevels => (permissions, userId) => { } // Return true if the active user has write permission -export const hasEditPermissions = hasDatasetPermissions(['admin', 'rw']) +export const hasEditPermissions = hasDatasetPermissions(["admin", "rw"]) // -export const hasDatasetAdminPermissions = hasDatasetPermissions(['admin']) +export const hasDatasetAdminPermissions = hasDatasetPermissions(["admin"]) diff --git a/packages/openneuro-app/src/scripts/authentication/regular-user.tsx b/packages/openneuro-app/src/scripts/authentication/regular-user.tsx index a6fc43aa1d..695732920e 100644 --- a/packages/openneuro-app/src/scripts/authentication/regular-user.tsx +++ b/packages/openneuro-app/src/scripts/authentication/regular-user.tsx @@ -1,6 +1,6 @@ -import React from 'react' -import { useCookies } from 'react-cookie' -import { getProfile } from './profile' +import React from "react" +import { useCookies } from "react-cookie" +import { getProfile } from "./profile" interface RegularUserProps { children?: React.ReactNode diff --git a/packages/openneuro-app/src/scripts/authentication/signOut.ts b/packages/openneuro-app/src/scripts/authentication/signOut.ts index 76e5643d8b..abe57536bf 100644 --- a/packages/openneuro-app/src/scripts/authentication/signOut.ts +++ b/packages/openneuro-app/src/scripts/authentication/signOut.ts @@ -1,8 +1,8 @@ -import cookies from '../utils/cookies.js' +import cookies from "../utils/cookies.js" const signOut = () => { // Delete the token will reset client login state - cookies.remove('accessToken') + cookies.remove("accessToken") } export default signOut diff --git a/packages/openneuro-app/src/scripts/authentication/withProfile.jsx b/packages/openneuro-app/src/scripts/authentication/withProfile.jsx index c7f252ea9a..8a73967cc4 100644 --- a/packages/openneuro-app/src/scripts/authentication/withProfile.jsx +++ b/packages/openneuro-app/src/scripts/authentication/withProfile.jsx @@ -1,11 +1,11 @@ /* eslint-disable */ -import React from 'react' -import { useCookies } from 'react-cookie' -import { getProfile, guardExpired } from './profile' +import React from "react" +import { useCookies } from "react-cookie" +import { getProfile, guardExpired } from "./profile" -const withProfile = WrappedComponent => { - return props => { - const [cookies] = useCookies(['accessToken']) +const withProfile = (WrappedComponent) => { + return (props) => { + const [cookies] = useCookies(["accessToken"]) const profile = getProfile(cookies) // If we have a profile and it is unexpired if (profile && guardExpired(profile)) { diff --git a/packages/openneuro-app/src/scripts/common/block-navigation.jsx b/packages/openneuro-app/src/scripts/common/block-navigation.jsx index d0c03bc2c5..e593bef82a 100644 --- a/packages/openneuro-app/src/scripts/common/block-navigation.jsx +++ b/packages/openneuro-app/src/scripts/common/block-navigation.jsx @@ -1,11 +1,10 @@ -import React from 'react' -import PropTypes from 'prop-types' +import React from "react" +import PropTypes from "prop-types" class BlockNavigation extends React.Component { componentDidMount() { // Attempt to set a message even though browsers do not display it - window.onbeforeunload = () => - this.props.message ? this.props.message : true + window.onbeforeunload = () => this.props.message ? this.props.message : true } componentWillUnmount() { diff --git a/packages/openneuro-app/src/scripts/common/containers/__tests__/header.spec.tsx b/packages/openneuro-app/src/scripts/common/containers/__tests__/header.spec.tsx index f38f983f61..35bbbc49db 100644 --- a/packages/openneuro-app/src/scripts/common/containers/__tests__/header.spec.tsx +++ b/packages/openneuro-app/src/scripts/common/containers/__tests__/header.spec.tsx @@ -1,31 +1,31 @@ -import { vi } from 'vitest' -import React from 'react' -import { MockAppShell } from '../../../__utils__/mock-app-shell' -import { render, screen, fireEvent, waitFor } from '@testing-library/react' -import { HeaderContainer } from '../header' +import { vi } from "vitest" +import React from "react" +import { MockAppShell } from "../../../__utils__/mock-app-shell" +import { fireEvent, render, screen, waitFor } from "@testing-library/react" +import { HeaderContainer } from "../header" const navigate = vi.fn() -vi.mock('../../../config.ts') -vi.mock('../../../uploader/uploader-view.jsx', () => ({ - default: () => 'mocked UploaderView', +vi.mock("../../../config.ts") +vi.mock("../../../uploader/uploader-view.jsx", () => ({ + default: () => "mocked UploaderView", })) -vi.mock('react-router-dom', async () => ({ +vi.mock("react-router-dom", async () => ({ // @ts-ignore-check - ...(await vi.importActual('react-router-dom')), + ...(await vi.importActual("react-router-dom")), useNavigate: () => navigate, })) -describe('HeaderContainer component', () => { - it('navigates prepopulated search when you use the home page search box', async () => { +describe("HeaderContainer component", () => { + it("navigates prepopulated search when you use the home page search box", async () => { render(, { wrapper: MockAppShell }) - const searchbox = screen.getByRole('textbox') - const button = screen.getByLabelText('Search') - await fireEvent.change(searchbox, { target: { value: 'test argument' } }) + const searchbox = screen.getByRole("textbox") + const button = screen.getByLabelText("Search") + await fireEvent.change(searchbox, { target: { value: "test argument" } }) await fireEvent.click(button) await waitFor(() => expect(navigate).toHaveBeenCalledWith( '/search?query={"keywords":["test argument"]}', - ), + ) ) }) }) diff --git a/packages/openneuro-app/src/scripts/common/containers/footer.tsx b/packages/openneuro-app/src/scripts/common/containers/footer.tsx index 3edc307a3f..94c4739320 100644 --- a/packages/openneuro-app/src/scripts/common/containers/footer.tsx +++ b/packages/openneuro-app/src/scripts/common/containers/footer.tsx @@ -1,6 +1,6 @@ -import React, { FC } from 'react' -import { Footer } from '@openneuro/components/footer' -import { version as openneuroVersion } from '../../../lerna.json' +import React, { FC } from "react" +import { Footer } from "@openneuro/components/footer" +import { version as openneuroVersion } from "../../../lerna.json" const FooterContainer: FC = () => { return ( diff --git a/packages/openneuro-app/src/scripts/common/containers/header.tsx b/packages/openneuro-app/src/scripts/common/containers/header.tsx index 0b39799561..976780452a 100644 --- a/packages/openneuro-app/src/scripts/common/containers/header.tsx +++ b/packages/openneuro-app/src/scripts/common/containers/header.tsx @@ -1,45 +1,45 @@ -import React, { FC, useContext } from 'react' -import useState from 'react-usestateref' -import UploaderContext from '../../uploader/uploader-context.js' -import UploadProgress from '../../uploader/upload-progress.jsx' -import { Header, LandingExpandedHeader } from '@openneuro/components/header' -import { Input } from '@openneuro/components/input' -import ModalitySelect from '../../search/inputs/modality-select' -import { UserModalOpenCtx } from '../../utils/user-login-modal-ctx' -import { useLocation, useNavigate } from 'react-router-dom' -import { useCookies } from 'react-cookie' -import signOut from '../../authentication/signOut' -import { getUnexpiredProfile } from '../../authentication/profile' -import FreshdeskWidget from '../partials/freshdesk-widget' -import AggregateCountsContainer from '../../pages/front-page/aggregate-queries/aggregate-counts-container' -import loginUrls from '../../authentication/loginUrls' -import UploaderView from '../../uploader/uploader-view.jsx' -import UploadButton from '../../uploader/upload-button.jsx' -import UploadProgressButton from '../../uploader/upload-progress-button.jsx' +import React, { FC, useContext } from "react" +import useState from "react-usestateref" +import UploaderContext from "../../uploader/uploader-context.js" +import UploadProgress from "../../uploader/upload-progress.jsx" +import { Header, LandingExpandedHeader } from "@openneuro/components/header" +import { Input } from "@openneuro/components/input" +import ModalitySelect from "../../search/inputs/modality-select" +import { UserModalOpenCtx } from "../../utils/user-login-modal-ctx" +import { useLocation, useNavigate } from "react-router-dom" +import { useCookies } from "react-cookie" +import signOut from "../../authentication/signOut" +import { getUnexpiredProfile } from "../../authentication/profile" +import FreshdeskWidget from "../partials/freshdesk-widget" +import AggregateCountsContainer from "../../pages/front-page/aggregate-queries/aggregate-counts-container" +import loginUrls from "../../authentication/loginUrls" +import UploaderView from "../../uploader/uploader-view.jsx" +import UploadButton from "../../uploader/upload-button.jsx" +import UploadProgressButton from "../../uploader/upload-progress-button.jsx" export const HeaderContainer: FC = () => { const navigate = useNavigate() const { pathname: currentPath } = useLocation() - const expanded = currentPath === '/' + const expanded = currentPath === "/" const [cookies] = useCookies() const profile = getUnexpiredProfile(cookies) const { userModalOpen, setUserModalOpen } = useContext(UserModalOpenCtx) - const [newKeyword, setNewKeyword, newKeywordRef] = useState('') + const [newKeyword, setNewKeyword, newKeywordRef] = useState("") const handleSubmit = () => { const query = JSON.stringify({ keywords: newKeywordRef.current ? [newKeywordRef.current] : [], }) - setNewKeyword('') + setNewKeyword("") navigate(`/search?query=${query}`) } const toggleLoginModal = (): void => { - setUserModalOpen(prevState => ({ + setUserModalOpen((prevState) => ({ ...prevState, userModalOpen: !prevState.userModalOpen, })) @@ -47,19 +47,19 @@ export const HeaderContainer: FC = () => { const signOutAndRedirect = () => { signOut() - const homepage = '/' + const homepage = "/" if (window.location.pathname === homepage) window.location.reload() else window.location.pathname = homepage } const [isOpenSupport, setSupportIsOpen] = React.useState(false) - const toggleSupport = () => setSupportIsOpen(prevIsOpen => !prevIsOpen) + const toggleSupport = () => setSupportIsOpen((prevIsOpen) => !prevIsOpen) return ( <> - {uploader => { + {(uploader) => { if (uploader?.uploading) { return ( @@ -81,13 +81,13 @@ export const HeaderContainer: FC = () => { navigateToNewSearch={handleSubmit} renderUploader={() => ( - {uploader => { + {(uploader) => { if (uploader?.uploading) { return } else { return ( uploader.setLocation('/upload')} + onClick={() => uploader.setLocation("/upload")} /> ) } @@ -95,7 +95,7 @@ export const HeaderContainer: FC = () => { )} renderOnFreshDeskWidget={() => } - renderOnExpanded={profile => ( + renderOnExpanded={(profile) => ( { labelStyle="default" value={newKeyword} setValue={setNewKeyword} - onKeyDown={e => { + onKeyDown={(e) => { if (e.keyCode === 13) { handleSubmit() } @@ -132,7 +132,7 @@ export const HeaderContainer: FC = () => { )} /> - {uploader => } + {(uploader) => } ) diff --git a/packages/openneuro-app/src/scripts/common/forms/__tests__/warn-button.spec.jsx b/packages/openneuro-app/src/scripts/common/forms/__tests__/warn-button.spec.jsx index ec6ee37653..d1846b6187 100644 --- a/packages/openneuro-app/src/scripts/common/forms/__tests__/warn-button.spec.jsx +++ b/packages/openneuro-app/src/scripts/common/forms/__tests__/warn-button.spec.jsx @@ -1,13 +1,13 @@ -import React from 'react' -import { render } from '@testing-library/react' -import WarnButton from '../warn-button' +import React from "react" +import { render } from "@testing-library/react" +import WarnButton from "../warn-button" -describe('common/forms/WarnButton', () => { - it('renders successfully', () => { +describe("common/forms/WarnButton", () => { + it("renders successfully", () => { const { asFragment } = render() expect(asFragment()).toMatchSnapshot() }) - it('renders with warnings disable', () => { + it("renders with warnings disable", () => { const { asFragment } = render( , ) diff --git a/packages/openneuro-app/src/scripts/common/forms/warn-button.jsx b/packages/openneuro-app/src/scripts/common/forms/warn-button.jsx index f3441b9df5..104e350fe9 100644 --- a/packages/openneuro-app/src/scripts/common/forms/warn-button.jsx +++ b/packages/openneuro-app/src/scripts/common/forms/warn-button.jsx @@ -1,10 +1,10 @@ // dependencies ------------------------------------------------------- -import React from 'react' -import PropTypes from 'prop-types' -import { Tooltip } from '@openneuro/components/tooltip' -import { toast } from 'react-toastify' -import ToastContent from '../partials/toast-content.jsx' +import React from "react" +import PropTypes from "prop-types" +import { Tooltip } from "@openneuro/components/tooltip" +import { toast } from "react-toastify" +import ToastContent from "../partials/toast-content.jsx" class WarnButton extends React.Component { constructor(props) { @@ -49,7 +49,8 @@ class WarnButton extends React.Component { + href={this.state.link} + > {confirm} ) @@ -57,8 +58,9 @@ class WarnButton extends React.Component { const confirmBtn = ( ) @@ -67,7 +69,8 @@ class WarnButton extends React.Component { {link ? link : confirmBtn} @@ -75,12 +78,13 @@ class WarnButton extends React.Component { ) const hideAction = ( - + ) @@ -130,7 +134,7 @@ class WarnButton extends React.Component { // generate download links if (this.props.prepDownload) { this.setState({ loading: true }) - this.props.prepDownload(link => { + this.props.prepDownload((link) => { this.setState({ displayOptions: true, link: link, loading: false }) }) return @@ -154,9 +158,9 @@ class WarnButton extends React.Component { } } - if (typeof action === 'function') { + if (typeof action === "function") { this.setState({ loading: true }) - action(e => { + action((e) => { if (e && e.error) { toast.error() } @@ -190,10 +194,10 @@ WarnButton.propTypes = { } WarnButton.defaultProps = { - message: '', + message: "", cancel: , confirm: , - icon: 'fa-trash-o', + icon: "fa-trash-o", warn: true, tooltip: null, } diff --git a/packages/openneuro-app/src/scripts/common/partials/block-navigation.jsx b/packages/openneuro-app/src/scripts/common/partials/block-navigation.jsx index d0c03bc2c5..e593bef82a 100644 --- a/packages/openneuro-app/src/scripts/common/partials/block-navigation.jsx +++ b/packages/openneuro-app/src/scripts/common/partials/block-navigation.jsx @@ -1,11 +1,10 @@ -import React from 'react' -import PropTypes from 'prop-types' +import React from "react" +import PropTypes from "prop-types" class BlockNavigation extends React.Component { componentDidMount() { // Attempt to set a message even though browsers do not display it - window.onbeforeunload = () => - this.props.message ? this.props.message : true + window.onbeforeunload = () => this.props.message ? this.props.message : true } componentWillUnmount() { diff --git a/packages/openneuro-app/src/scripts/common/partials/freshdesk-widget.jsx b/packages/openneuro-app/src/scripts/common/partials/freshdesk-widget.jsx index 19fc37f325..3e1fa7bd3b 100644 --- a/packages/openneuro-app/src/scripts/common/partials/freshdesk-widget.jsx +++ b/packages/openneuro-app/src/scripts/common/partials/freshdesk-widget.jsx @@ -1,8 +1,8 @@ -import React from 'react' -import PropTypes from 'prop-types' -import { useCookies } from 'react-cookie' -import { getProfile } from '../../authentication/profile' -import { config } from '../../config' +import React from "react" +import PropTypes from "prop-types" +import { useCookies } from "react-cookie" +import { getProfile } from "../../authentication/profile" +import { config } from "../../config" const buildCustomQuery = (customText, prepopulatedFields) => { const customizerQueries = [ @@ -11,7 +11,7 @@ const buildCustomQuery = (customText, prepopulatedFields) => { .filter(([, value]) => value) .map(([key, value]) => `helpdesk_ticket[${key}]=${value}`), ] - return customizerQueries.length ? `&${customizerQueries.join(';')}` : '' + return customizerQueries.length ? `&${customizerQueries.join(";")}` : "" } function FreshdeskWidget({ subject, error, sentryId, description }) { @@ -19,17 +19,17 @@ function FreshdeskWidget({ subject, error, sentryId, description }) { const profile = getProfile(cookies) const sentry = sentryId && `Sentry ID: ${sentryId}` const joinedDescription = [sentry, description, error] - .filter(item => item) - .join(' \u2014 ') + .filter((item) => item) + .join(" \u2014 ") const customText = { - widgetType: 'embedded', - formTitle: 'Report+an+Issue', - submitTitle: 'Request+Support', + widgetType: "embedded", + formTitle: "Report+an+Issue", + submitTitle: "Request+Support", submitThanks: - 'Thank+you+for+taking+the+time+to+report+your+case.+A+support+representative+will+be+reviewing+your+request+and+will+send+you+a+personal+response+within+24+to+48+hours.', - screenshot: 'No', - captcha: 'yes', + "Thank+you+for+taking+the+time+to+report+your+case.+A+support+representative+will+be+reviewing+your+request+and+will+send+you+a+personal+response+within+24+to+48+hours.", + screenshot: "No", + captcha: "yes", } const prepopulatedFields = { requester: profile && profile.email, @@ -43,17 +43,14 @@ function FreshdeskWidget({ subject, error, sentryId, description }) { src="https://s3.amazonaws.com/assets.freshdesk.com/widget/freshwidget.js" />