@openneuro/app 4.1.1 → 4.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -18
- package/src/scripts/common/forms/warn-button.jsx +1 -1
- package/src/scripts/{redesign.tsx → index.tsx} +4 -4
- package/src/scripts/pages/citation-page.tsx +41 -0
- package/src/scripts/refactor_2021/admin/admin.jsx +1 -1
- package/src/scripts/refactor_2021/admin/flagged-files.jsx +2 -1
- package/src/scripts/refactor_2021/admin/user-tools.tsx +3 -5
- package/src/scripts/refactor_2021/admin/users.jsx +7 -10
- package/src/scripts/{authentication → refactor_2021/authentication}/__tests__/profile.spec.js +1 -1
- package/src/scripts/refactor_2021/containers/footer.tsx +1 -3
- package/src/scripts/{datalad/dataset → refactor_2021/dataset/comments}/__tests__/__snapshots__/comment.spec.jsx.snap +0 -8
- package/src/scripts/refactor_2021/dataset/comments/__tests__/__snapshots__/comments.spec.jsx.snap +129 -0
- package/src/scripts/{datalad/dataset → refactor_2021/dataset/comments}/__tests__/comment.spec.jsx +0 -0
- package/src/scripts/{datalad/dataset → refactor_2021/dataset/comments}/__tests__/comments.spec.jsx +0 -0
- package/src/scripts/refactor_2021/dataset/dataset-routes.jsx +14 -4
- package/src/scripts/{datalad → refactor_2021/dataset}/download/__tests__/__snapshots__/download-command-line.spec.jsx.snap +0 -0
- package/src/scripts/{datalad → refactor_2021/dataset}/download/__tests__/__snapshots__/download-link.spec.jsx.snap +645 -105
- package/src/scripts/{datalad → refactor_2021/dataset}/download/__tests__/__snapshots__/shell-example.spec.jsx.snap +6 -3
- package/src/scripts/{datalad → refactor_2021/dataset}/download/__tests__/download-command-line.spec.jsx +0 -0
- package/src/scripts/{datalad → refactor_2021/dataset}/download/__tests__/download-link.spec.jsx +0 -0
- package/src/scripts/{datalad → refactor_2021/dataset}/download/__tests__/download-native.spec.js +0 -0
- package/src/scripts/{datalad → refactor_2021/dataset}/download/__tests__/shell-example.spec.jsx +0 -0
- package/src/scripts/refactor_2021/dataset/download/download-datalad.jsx +45 -10
- package/src/scripts/refactor_2021/dataset/draft-container.tsx +20 -35
- package/src/scripts/refactor_2021/dataset/files/file-tree.jsx +3 -2
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/cancel-button.spec.tsx.snap +10 -0
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/edit-button.spec.tsx.snap +10 -0
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/edit-list.spec.jsx.snap +24 -0
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/save-button.spec.tsx.snap +10 -0
- package/src/scripts/{datalad/fragments/__tests__/__snapshots__/select-input.spec.jsx.snap → refactor_2021/dataset/fragments/__tests__/__snapshots__/select-input.spec.tsx.snap} +0 -0
- package/src/scripts/{datalad/fragments/__tests__/cancel-button.spec.jsx → refactor_2021/dataset/fragments/__tests__/cancel-button.spec.tsx} +2 -2
- package/src/scripts/{datalad → refactor_2021/dataset}/fragments/__tests__/dataset-citation.spec.jsx +0 -0
- package/src/scripts/{datalad/fragments/__tests__/edit-button.spec.jsx → refactor_2021/dataset/fragments/__tests__/edit-button.spec.tsx} +2 -2
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/edit-list.spec.jsx +27 -0
- package/src/scripts/{datalad/fragments/__tests__/save-button.spec.jsx → refactor_2021/dataset/fragments/__tests__/save-button.spec.tsx} +2 -2
- package/src/scripts/{datalad/fragments/__tests__/select-input.spec.jsx → refactor_2021/dataset/fragments/__tests__/select-input.spec.tsx} +0 -0
- package/src/scripts/refactor_2021/dataset/mutations/__tests__/__snapshots__/delete.spec.jsx.snap +50 -0
- package/src/scripts/{datalad → refactor_2021/dataset}/mutations/__tests__/__snapshots__/description.spec.jsx.snap +0 -0
- package/src/scripts/refactor_2021/dataset/mutations/__tests__/__snapshots__/update-permissions.spec.jsx.snap +27 -0
- package/src/scripts/{datalad → refactor_2021/dataset}/mutations/__tests__/cache-id.spec.js +0 -0
- package/src/scripts/{datalad → refactor_2021/dataset}/mutations/__tests__/delete.spec.jsx +8 -8
- package/src/scripts/{datalad → refactor_2021/dataset}/mutations/__tests__/description.spec.jsx +0 -0
- package/src/scripts/{datalad/mutations/__tests__/remove-permissions.spec.jsx → refactor_2021/dataset/mutations/__tests__/remove-permissions.spec.tsx} +1 -1
- package/src/scripts/refactor_2021/dataset/mutations/__tests__/update-permissions.spec.jsx +28 -0
- package/src/scripts/refactor_2021/dataset/mutations/update-file.jsx +2 -2
- package/src/scripts/refactor_2021/dataset/routes/download-dataset.tsx +76 -0
- package/src/scripts/refactor_2021/dataset/snapshot-container.tsx +10 -4
- package/src/scripts/refactor_2021/routes.tsx +1 -1
- package/src/scripts/refactor_2021/search/__tests__/search-params-ctx.spec.tsx +20 -0
- package/src/scripts/refactor_2021/search/initial-search-params.tsx +7 -7
- package/src/scripts/refactor_2021/search/inputs/__tests__/sort-by-select.spec.tsx +83 -0
- package/src/scripts/refactor_2021/search/inputs/index.ts +2 -2
- package/src/scripts/refactor_2021/search/inputs/{gender-radios.tsx → sex-radios.tsx} +10 -10
- package/src/scripts/refactor_2021/search/inputs/sort-by-select.tsx +38 -8
- package/src/scripts/refactor_2021/search/search-container.tsx +3 -3
- package/src/scripts/refactor_2021/search/search-params-ctx.tsx +3 -3
- package/src/scripts/refactor_2021/search/use-search-results.tsx +4 -3
- package/src/scripts/refactor_2021/user/api.jsx +11 -6
- package/src/server.jsx +1 -5
- package/src/ssr.ts +0 -1
- package/src/sass/_bootstrap-compass.scss +0 -9
- package/src/sass/_bootstrap-mincer.scss +0 -19
- package/src/sass/_bootstrap-sprockets.scss +0 -9
- package/src/sass/_bootstrap.scss +0 -50
- package/src/sass/animate/_attention-seekers/_bounce.scss +0 -15
- package/src/sass/animate/_attention-seekers/_flash.scss +0 -14
- package/src/sass/animate/_attention-seekers/_pulse.scss +0 -17
- package/src/sass/animate/_attention-seekers/_rubberBand.scss +0 -19
- package/src/sass/animate/_attention-seekers/_shake.scss +0 -15
- package/src/sass/animate/_attention-seekers/_swing.scss +0 -19
- package/src/sass/animate/_attention-seekers/_tada.scss +0 -17
- package/src/sass/animate/_attention-seekers/_wobble.scss +0 -21
- package/src/sass/animate/_attention-seekers/attention-seekers.scss +0 -12
- package/src/sass/animate/_bouncing-entrances/_bounceIn.scss +0 -26
- package/src/sass/animate/_bouncing-entrances/_bounceInDown.scss +0 -26
- package/src/sass/animate/_bouncing-entrances/_bounceInLeft.scss +0 -26
- package/src/sass/animate/_bouncing-entrances/_bounceInRight.scss +0 -26
- package/src/sass/animate/_bouncing-entrances/_bounceInUp.scss +0 -26
- package/src/sass/animate/_bouncing-entrances/bouncing-entrances.scss +0 -9
- package/src/sass/animate/_bouncing-exits/_bounceOut.scss +0 -26
- package/src/sass/animate/_bouncing-exits/_bounceOutDown.scss +0 -23
- package/src/sass/animate/_bouncing-exits/_bounceOutLeft.scss +0 -23
- package/src/sass/animate/_bouncing-exits/_bounceOutRight.scss +0 -23
- package/src/sass/animate/_bouncing-exits/_bounceOutUp.scss +0 -23
- package/src/sass/animate/_bouncing-exits/bouncing-exits.scss +0 -4
- package/src/sass/animate/_fading-entrances/_fadeIn.scss +0 -14
- package/src/sass/animate/_fading-entrances/_fadeInDown.scss +0 -20
- package/src/sass/animate/_fading-entrances/_fadeInDownBig.scss +0 -20
- package/src/sass/animate/_fading-entrances/_fadeInLeft.scss +0 -20
- package/src/sass/animate/_fading-entrances/_fadeInLeftBig.scss +0 -20
- package/src/sass/animate/_fading-entrances/_fadeInRight.scss +0 -20
- package/src/sass/animate/_fading-entrances/_fadeInRightBig.scss +0 -20
- package/src/sass/animate/_fading-entrances/_fadeInUp.scss +0 -19
- package/src/sass/animate/_fading-entrances/_fadeInUpBig.scss +0 -20
- package/src/sass/animate/_fading-entrances/fading-entrances.scss +0 -5
- package/src/sass/animate/_fading-exits/_fadeOut.scss +0 -14
- package/src/sass/animate/_fading-exits/_fadeOutDown.scss +0 -20
- package/src/sass/animate/_fading-exits/_fadeOutDownBig.scss +0 -20
- package/src/sass/animate/_fading-exits/_fadeOutLeft.scss +0 -20
- package/src/sass/animate/_fading-exits/_fadeOutLeftBig.scss +0 -20
- package/src/sass/animate/_fading-exits/_fadeOutRight.scss +0 -20
- package/src/sass/animate/_fading-exits/_fadeOutRightBig.scss +0 -20
- package/src/sass/animate/_fading-exits/_fadeOutUp.scss +0 -20
- package/src/sass/animate/_fading-exits/_fadeOutUpBig.scss +0 -20
- package/src/sass/animate/_fading-exits/fading-exits.scss +0 -5
- package/src/sass/animate/_flippers/_flip.scss +0 -33
- package/src/sass/animate/_flippers/_flipInX.scss +0 -26
- package/src/sass/animate/_flippers/_flipInY.scss +0 -26
- package/src/sass/animate/_flippers/_flipOutX.scss +0 -20
- package/src/sass/animate/_flippers/_flipOutY.scss +0 -20
- package/src/sass/animate/_flippers/flippers.scss +0 -8
- package/src/sass/animate/_lightspeed/_lightSpeedIn.scss +0 -29
- package/src/sass/animate/_lightspeed/_lightSpeedOut.scss +0 -21
- package/src/sass/animate/_lightspeed/lightspeed.scss +0 -3
- package/src/sass/animate/_properties.scss +0 -119
- package/src/sass/animate/_rotating-entrances/_rotateIn.scss +0 -22
- package/src/sass/animate/_rotating-entrances/_rotateInDownLeft.scss +0 -22
- package/src/sass/animate/_rotating-entrances/_rotateInDownRight.scss +0 -22
- package/src/sass/animate/_rotating-entrances/_rotateInUpLeft.scss +0 -22
- package/src/sass/animate/_rotating-entrances/_rotateInUpRight.scss +0 -22
- package/src/sass/animate/_rotating-entrances/rotating-entrances.scss +0 -8
- package/src/sass/animate/_rotating-exits/_rotateOut.scss +0 -22
- package/src/sass/animate/_rotating-exits/_rotateOutDownLeft.scss +0 -22
- package/src/sass/animate/_rotating-exits/_rotateOutDownRight.scss +0 -22
- package/src/sass/animate/_rotating-exits/_rotateOutUpLeft.scss +0 -22
- package/src/sass/animate/_rotating-exits/_rotateOutUpRight.scss +0 -22
- package/src/sass/animate/_rotating-exits/rotating-exits.scss +0 -8
- package/src/sass/animate/_sliding-entrances/_slideInDown.scss +0 -19
- package/src/sass/animate/_sliding-entrances/_slideInLeft.scss +0 -19
- package/src/sass/animate/_sliding-entrances/_slideInRight.scss +0 -42
- package/src/sass/animate/_sliding-entrances/_slideInUp.scss +0 -19
- package/src/sass/animate/_sliding-entrances/sliding-entrances.scss +0 -7
- package/src/sass/animate/_sliding-exits/_slideOutDown.scss +0 -19
- package/src/sass/animate/_sliding-exits/_slideOutLeft.scss +0 -19
- package/src/sass/animate/_sliding-exits/_slideOutRight.scss +0 -19
- package/src/sass/animate/_sliding-exits/_slideOutUp.scss +0 -19
- package/src/sass/animate/_sliding-exits/sliding-exits.scss +0 -7
- package/src/sass/animate/_specials/_hinge.scss +0 -37
- package/src/sass/animate/_specials/_rollIn.scss +0 -20
- package/src/sass/animate/_specials/_rollOut.scss +0 -22
- package/src/sass/animate/_specials/specials.scss +0 -6
- package/src/sass/animate/_zooming-entrances/_zoomIn.scss +0 -19
- package/src/sass/animate/_zooming-entrances/_zoomInDown.scss +0 -22
- package/src/sass/animate/_zooming-entrances/_zoomInLeft.scss +0 -22
- package/src/sass/animate/_zooming-entrances/_zoomInRight.scss +0 -22
- package/src/sass/animate/_zooming-entrances/_zoomInUp.scss +0 -22
- package/src/sass/animate/_zooming-entrances/zooming-entrances.scss +0 -4
- package/src/sass/animate/_zooming-exits/_zoomOut.scss +0 -22
- package/src/sass/animate/_zooming-exits/_zoomOutDown.scss +0 -23
- package/src/sass/animate/_zooming-exits/_zoomOutLeft.scss +0 -21
- package/src/sass/animate/_zooming-exits/_zoomOutRight.scss +0 -21
- package/src/sass/animate/_zooming-exits/_zoomOutUp.scss +0 -23
- package/src/sass/animate/_zooming-exits/zooming-exits.scss +0 -4
- package/src/sass/animate/animate.css +0 -7497
- package/src/sass/animate/animate.css.map +0 -7
- package/src/sass/animate/animate.min.css +0 -2
- package/src/sass/animate/animate.min.css.map +0 -7
- package/src/sass/animate/animate.scss +0 -30
- package/src/sass/animate/bower.json +0 -22
- package/src/sass/bootstrap/_alerts.scss +0 -70
- package/src/sass/bootstrap/_badges.scss +0 -68
- package/src/sass/bootstrap/_breadcrumbs.scss +0 -26
- package/src/sass/bootstrap/_button-groups.scss +0 -243
- package/src/sass/bootstrap/_buttons.scss +0 -160
- package/src/sass/bootstrap/_carousel.scss +0 -269
- package/src/sass/bootstrap/_close.scss +0 -36
- package/src/sass/bootstrap/_code.scss +0 -69
- package/src/sass/bootstrap/_component-animations.scss +0 -37
- package/src/sass/bootstrap/_dropdowns.scss +0 -223
- package/src/sass/bootstrap/_forms.scss +0 -613
- package/src/sass/bootstrap/_grid.scss +0 -84
- package/src/sass/bootstrap/_input-groups.scss +0 -166
- package/src/sass/bootstrap/_jumbotron.scss +0 -50
- package/src/sass/bootstrap/_labels.scss +0 -66
- package/src/sass/bootstrap/_list-group.scss +0 -124
- package/src/sass/bootstrap/_media.scss +0 -61
- package/src/sass/bootstrap/_mixins.scss +0 -39
- package/src/sass/bootstrap/_modals.scss +0 -150
- package/src/sass/bootstrap/_navbar.scss +0 -647
- package/src/sass/bootstrap/_navs.scss +0 -243
- package/src/sass/bootstrap/_normalize.scss +0 -427
- package/src/sass/bootstrap/_pager.scss +0 -54
- package/src/sass/bootstrap/_pagination.scss +0 -88
- package/src/sass/bootstrap/_panels.scss +0 -265
- package/src/sass/bootstrap/_popovers.scss +0 -135
- package/src/sass/bootstrap/_print.scss +0 -107
- package/src/sass/bootstrap/_progress-bars.scss +0 -87
- package/src/sass/bootstrap/_responsive-embed.scss +0 -35
- package/src/sass/bootstrap/_responsive-utilities.scss +0 -177
- package/src/sass/bootstrap/_scaffolding.scss +0 -162
- package/src/sass/bootstrap/_tables.scss +0 -234
- package/src/sass/bootstrap/_theme.scss +0 -273
- package/src/sass/bootstrap/_thumbnails.scss +0 -38
- package/src/sass/bootstrap/_tooltip.scss +0 -102
- package/src/sass/bootstrap/_type.scss +0 -298
- package/src/sass/bootstrap/_utilities.scss +0 -55
- package/src/sass/bootstrap/_variables.scss +0 -866
- package/src/sass/bootstrap/_wells.scss +0 -29
- package/src/sass/bootstrap/float-label.scss +0 -70
- package/src/sass/bootstrap/mixins/_alerts.scss +0 -14
- package/src/sass/bootstrap/mixins/_background-variant.scss +0 -11
- package/src/sass/bootstrap/mixins/_border-radius.scss +0 -18
- package/src/sass/bootstrap/mixins/_buttons.scss +0 -52
- package/src/sass/bootstrap/mixins/_center-block.scss +0 -7
- package/src/sass/bootstrap/mixins/_clearfix.scss +0 -22
- package/src/sass/bootstrap/mixins/_forms.scss +0 -88
- package/src/sass/bootstrap/mixins/_gradients.scss +0 -58
- package/src/sass/bootstrap/mixins/_grid-framework.scss +0 -81
- package/src/sass/bootstrap/mixins/_grid.scss +0 -122
- package/src/sass/bootstrap/mixins/_hide-text.scss +0 -21
- package/src/sass/bootstrap/mixins/_image.scss +0 -33
- package/src/sass/bootstrap/mixins/_labels.scss +0 -12
- package/src/sass/bootstrap/mixins/_list-group.scss +0 -31
- package/src/sass/bootstrap/mixins/_nav-divider.scss +0 -10
- package/src/sass/bootstrap/mixins/_nav-vertical-align.scss +0 -9
- package/src/sass/bootstrap/mixins/_opacity.scss +0 -8
- package/src/sass/bootstrap/mixins/_pagination.scss +0 -23
- package/src/sass/bootstrap/mixins/_panels.scss +0 -24
- package/src/sass/bootstrap/mixins/_progress-bar.scss +0 -10
- package/src/sass/bootstrap/mixins/_reset-filter.scss +0 -8
- package/src/sass/bootstrap/mixins/_resize.scss +0 -6
- package/src/sass/bootstrap/mixins/_responsive-visibility.scss +0 -21
- package/src/sass/bootstrap/mixins/_size.scss +0 -10
- package/src/sass/bootstrap/mixins/_tab-focus.scss +0 -9
- package/src/sass/bootstrap/mixins/_table-row.scss +0 -28
- package/src/sass/bootstrap/mixins/_text-emphasis.scss +0 -11
- package/src/sass/bootstrap/mixins/_text-overflow.scss +0 -8
- package/src/sass/bootstrap/mixins/_vendor-prefixes.scss +0 -222
- package/src/sass/crn_app/_admin.admin.scss +0 -205
- package/src/sass/crn_app/_admin.graphs.scss +0 -51
- package/src/sass/crn_app/_admin.tools.scss +0 -24
- package/src/sass/crn_app/_api.scss +0 -65
- package/src/sass/crn_app/_bootstrap.overrides.scss +0 -54
- package/src/sass/crn_app/_colors.scss +0 -88
- package/src/sass/crn_app/_common.click-to-edit.scss +0 -187
- package/src/sass/crn_app/_common.modals.scss +0 -686
- package/src/sass/crn_app/_common.pagination.scss +0 -41
- package/src/sass/crn_app/_common.papaya.scss +0 -348
- package/src/sass/crn_app/_common.progress-bar.scss +0 -26
- package/src/sass/crn_app/_common.spinner.scss +0 -63
- package/src/sass/crn_app/_common.status.scss +0 -103
- package/src/sass/crn_app/_common.tooltip.scss +0 -22
- package/src/sass/crn_app/_common.typeahead.scss +0 -31
- package/src/sass/crn_app/_common.variables.scss +0 -16
- package/src/sass/crn_app/_dashboard.datasets.scss +0 -588
- package/src/sass/crn_app/_dataset.comments.scss +0 -201
- package/src/sass/crn_app/_dataset.dataset.scss +0 -161
- package/src/sass/crn_app/_dataset.file-tree.scss +0 -277
- package/src/sass/crn_app/_dataset.jobs.scss +0 -701
- package/src/sass/crn_app/_dataset.sidebar.scss +0 -265
- package/src/sass/crn_app/_dataset.tools.scss +0 -118
- package/src/sass/crn_app/_elements-wrappers.scss +0 -870
- package/src/sass/crn_app/_faq.scss +0 -37
- package/src/sass/crn_app/_frontPage.scss +0 -569
- package/src/sass/crn_app/_nav.navbar.scss +0 -387
- package/src/sass/crn_app/_theme.scss +0 -87
- package/src/sass/crn_app/_upload.upload.scss +0 -393
- package/src/sass/crn_app/_upload.validation.scss +0 -210
- package/src/sass/draft/draft.scss +0 -11
- package/src/sass/draft/rich-editor.scss +0 -73
- package/src/sass/font-awesome/_animated.scss +0 -34
- package/src/sass/font-awesome/_bordered-pulled.scss +0 -25
- package/src/sass/font-awesome/_core.scss +0 -12
- package/src/sass/font-awesome/_fixed-width.scss +0 -6
- package/src/sass/font-awesome/_font-awesome.scss +0 -17
- package/src/sass/font-awesome/_icons.scss +0 -697
- package/src/sass/font-awesome/_larger.scss +0 -13
- package/src/sass/font-awesome/_list.scss +0 -19
- package/src/sass/font-awesome/_mixins.scss +0 -26
- package/src/sass/font-awesome/_path.scss +0 -15
- package/src/sass/font-awesome/_rotated-flipped.scss +0 -20
- package/src/sass/font-awesome/_stacked.scss +0 -20
- package/src/sass/font-awesome/_variables.scss +0 -713
- package/src/sass/main.scss +0 -317
- package/src/sass/pre-refactor-with-wrapper-main.scss +0 -1549
- package/src/scripts/admin/__tests__/__snapshots__/exports.spec.jsx.snap +0 -112
- package/src/scripts/admin/__tests__/exports.spec.jsx +0 -15
- package/src/scripts/admin/__tests__/users.spec.jsx +0 -15
- package/src/scripts/admin/admin.jsx +0 -53
- package/src/scripts/admin/flagged-files.jsx +0 -178
- package/src/scripts/admin/user-fragment.ts +0 -14
- package/src/scripts/admin/user-tools.tsx +0 -83
- package/src/scripts/admin/users.jsx +0 -224
- package/src/scripts/authentication/admin-user.jsx +0 -23
- package/src/scripts/authentication/buttons.jsx +0 -26
- package/src/scripts/authentication/globus-button.jsx +0 -39
- package/src/scripts/authentication/google-button.jsx +0 -32
- package/src/scripts/authentication/logged-in.jsx +0 -12
- package/src/scripts/authentication/logged-out.jsx +0 -12
- package/src/scripts/authentication/loginCheck.js +0 -7
- package/src/scripts/authentication/orcid-button.jsx +0 -32
- package/src/scripts/authentication/withProfile.jsx +0 -22
- package/src/scripts/classic.tsx +0 -18
- package/src/scripts/common/forms/file-select.tsx +0 -71
- package/src/scripts/common/partials/__tests__/__snapshots__/footer.spec.jsx.snap +0 -42
- package/src/scripts/common/partials/__tests__/__snapshots__/metric.spec.jsx.snap +0 -101
- package/src/scripts/common/partials/__tests__/footer.spec.jsx +0 -10
- package/src/scripts/common/partials/__tests__/metric.spec.jsx +0 -31
- package/src/scripts/common/partials/footer.jsx +0 -40
- package/src/scripts/common/partials/login.jsx +0 -99
- package/src/scripts/common/partials/metric.jsx +0 -73
- package/src/scripts/common/partials/spinner.jsx +0 -34
- package/src/scripts/common/partials/status.jsx +0 -96
- package/src/scripts/common/partials/timeout.jsx +0 -47
- package/src/scripts/common/partials/tooltip.jsx +0 -36
- package/src/scripts/components/__tests__/dropdown-button.spec.tsx +0 -49
- package/src/scripts/components/dropdown-button.tsx +0 -42
- package/src/scripts/components/feature-toggle.tsx +0 -19
- package/src/scripts/components/panel-group.tsx +0 -24
- package/src/scripts/components/panel.tsx +0 -42
- package/src/scripts/datalad/__tests__/snapshotVersion.spec.js +0 -21
- package/src/scripts/datalad/comments/__tests__/comment-editor.spec.jsx +0 -19
- package/src/scripts/datalad/comments/block-style-controls.jsx +0 -46
- package/src/scripts/datalad/comments/comment-editor.jsx +0 -79
- package/src/scripts/datalad/comments/inline-style-controls.jsx +0 -34
- package/src/scripts/datalad/comments/style-button.jsx +0 -28
- package/src/scripts/datalad/dashboard/__tests__/__snapshots__/dashboard.spec.jsx.snap +0 -163
- package/src/scripts/datalad/dashboard/__tests__/dashboard.spec.jsx +0 -21
- package/src/scripts/datalad/dashboard/dashboard.jsx +0 -54
- package/src/scripts/datalad/dashboard/datasets/__tests__/__snapshots__/dataset-filter.spec.jsx.snap +0 -20
- package/src/scripts/datalad/dashboard/datasets/__tests__/__snapshots__/dataset-row-skeleton.spec.jsx.snap +0 -13
- package/src/scripts/datalad/dashboard/datasets/__tests__/__snapshots__/dataset-row.spec.jsx.snap +0 -65
- package/src/scripts/datalad/dashboard/datasets/__tests__/__snapshots__/dataset-sorter.spec.jsx.snap +0 -14
- package/src/scripts/datalad/dashboard/datasets/__tests__/__snapshots__/dataset-virtual-scroller.spec.jsx.snap +0 -17
- package/src/scripts/datalad/dashboard/datasets/__tests__/__snapshots__/uploaded.spec.jsx.snap +0 -27
- package/src/scripts/datalad/dashboard/datasets/__tests__/dataset-filter.spec.jsx +0 -67
- package/src/scripts/datalad/dashboard/datasets/__tests__/dataset-query.spec.jsx +0 -72
- package/src/scripts/datalad/dashboard/datasets/__tests__/dataset-row-skeleton.spec.jsx +0 -9
- package/src/scripts/datalad/dashboard/datasets/__tests__/dataset-row.spec.jsx +0 -53
- package/src/scripts/datalad/dashboard/datasets/__tests__/dataset-sorter.spec.jsx +0 -69
- package/src/scripts/datalad/dashboard/datasets/__tests__/dataset-virtual-scroller.spec.jsx +0 -65
- package/src/scripts/datalad/dashboard/datasets/__tests__/uploaded.spec.jsx +0 -17
- package/src/scripts/datalad/dashboard/datasets/dataset-filter.jsx +0 -78
- package/src/scripts/datalad/dashboard/datasets/dataset-query.jsx +0 -102
- package/src/scripts/datalad/dashboard/datasets/dataset-row-error-boundary.jsx +0 -52
- package/src/scripts/datalad/dashboard/datasets/dataset-row-skeleton.jsx +0 -10
- package/src/scripts/datalad/dashboard/datasets/dataset-row.jsx +0 -58
- package/src/scripts/datalad/dashboard/datasets/dataset-sorter.jsx +0 -148
- package/src/scripts/datalad/dashboard/datasets/dataset-statuses.jsx +0 -44
- package/src/scripts/datalad/dashboard/datasets/dataset-tab.jsx +0 -192
- package/src/scripts/datalad/dashboard/datasets/dataset-virtual-scroller.jsx +0 -126
- package/src/scripts/datalad/dashboard/datasets/row-height.jsx +0 -7
- package/src/scripts/datalad/dashboard/datasets/uploaded.jsx +0 -33
- package/src/scripts/datalad/dataset/__tests__/__snapshots__/comments.spec.jsx.snap +0 -137
- package/src/scripts/datalad/dataset/__tests__/__snapshots__/dataset-page.spec.jsx.snap +0 -69
- package/src/scripts/datalad/dataset/__tests__/__snapshots__/dataset-query.spec.jsx.snap +0 -15
- package/src/scripts/datalad/dataset/__tests__/__snapshots__/left-siderbar.spec.jsx.snap +0 -85
- package/src/scripts/datalad/dataset/__tests__/dataset-page.spec.jsx +0 -33
- package/src/scripts/datalad/dataset/__tests__/dataset-query.spec.jsx +0 -20
- package/src/scripts/datalad/dataset/__tests__/left-siderbar.spec.jsx +0 -106
- package/src/scripts/datalad/dataset/comment.jsx +0 -90
- package/src/scripts/datalad/dataset/comments.jsx +0 -83
- package/src/scripts/datalad/dataset/dataset-description.jsx +0 -111
- package/src/scripts/datalad/dataset/dataset-main.jsx +0 -29
- package/src/scripts/datalad/dataset/dataset-page.jsx +0 -63
- package/src/scripts/datalad/dataset/dataset-query.jsx +0 -192
- package/src/scripts/datalad/dataset/dataset.jsx +0 -22
- package/src/scripts/datalad/dataset/delete-page.tsx +0 -92
- package/src/scripts/datalad/dataset/left-sidebar.jsx +0 -109
- package/src/scripts/datalad/download/__tests__/__snapshots__/download-dataset.spec.jsx.snap +0 -7
- package/src/scripts/datalad/download/__tests__/__snapshots__/download-tool.spec.jsx.snap +0 -26
- package/src/scripts/datalad/download/__tests__/download-dataset.spec.jsx +0 -19
- package/src/scripts/datalad/download/__tests__/download-tool.spec.jsx +0 -19
- package/src/scripts/datalad/download/download-command-line.jsx +0 -43
- package/src/scripts/datalad/download/download-datalad.jsx +0 -58
- package/src/scripts/datalad/download/download-dataset.jsx +0 -61
- package/src/scripts/datalad/download/download-link.jsx +0 -41
- package/src/scripts/datalad/download/download-native.js +0 -118
- package/src/scripts/datalad/download/download-query.js +0 -22
- package/src/scripts/datalad/download/download-s3.jsx +0 -46
- package/src/scripts/datalad/download/download-tool.jsx +0 -44
- package/src/scripts/datalad/download/native-file-toast.jsx +0 -90
- package/src/scripts/datalad/download/shell-example.jsx +0 -9
- package/src/scripts/datalad/download/track-download.js +0 -15
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/cancel-button.spec.jsx.snap +0 -21
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/dataset-analytics.spec.jsx.snap +0 -41
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/dataset-authors.spec.jsx.snap +0 -13
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/dataset-readme.spec.jsx.snap +0 -49
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/dataset-title.spec.jsx.snap +0 -7
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/dataset-tools.spec.jsx.snap +0 -346
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/dataset-uploaded.spec.jsx.snap +0 -7
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/edit-button.spec.jsx.snap +0 -21
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/edit-list.spec.jsx.snap +0 -34
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/edit-readme.spec.jsx.snap +0 -3
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/save-button.spec.jsx.snap +0 -21
- package/src/scripts/datalad/fragments/__tests__/dataset-analytics.spec.jsx +0 -16
- package/src/scripts/datalad/fragments/__tests__/dataset-authors.spec.jsx +0 -22
- package/src/scripts/datalad/fragments/__tests__/dataset-prominent-links.spec.jsx +0 -32
- package/src/scripts/datalad/fragments/__tests__/dataset-readme.spec.jsx +0 -10
- package/src/scripts/datalad/fragments/__tests__/dataset-summary.spec.jsx +0 -55
- package/src/scripts/datalad/fragments/__tests__/dataset-title.spec.jsx +0 -10
- package/src/scripts/datalad/fragments/__tests__/dataset-tools.spec.jsx +0 -55
- package/src/scripts/datalad/fragments/__tests__/dataset-uploaded.spec.jsx +0 -16
- package/src/scripts/datalad/fragments/__tests__/edit-list.spec.jsx +0 -25
- package/src/scripts/datalad/fragments/__tests__/edit-readme.spec.jsx +0 -10
- package/src/scripts/datalad/fragments/cancel-button.jsx +0 -24
- package/src/scripts/datalad/fragments/copyable-tooltip.jsx +0 -82
- package/src/scripts/datalad/fragments/dataset-analytics.jsx +0 -27
- package/src/scripts/datalad/fragments/dataset-authors.jsx +0 -16
- package/src/scripts/datalad/fragments/dataset-citation.jsx +0 -77
- package/src/scripts/datalad/fragments/dataset-files.jsx +0 -50
- package/src/scripts/datalad/fragments/dataset-git-access.jsx +0 -56
- package/src/scripts/datalad/fragments/dataset-git-hash.jsx +0 -27
- package/src/scripts/datalad/fragments/dataset-history.jsx +0 -95
- package/src/scripts/datalad/fragments/dataset-modified.jsx +0 -17
- package/src/scripts/datalad/fragments/dataset-prominent-links.jsx +0 -129
- package/src/scripts/datalad/fragments/dataset-readme.jsx +0 -42
- package/src/scripts/datalad/fragments/dataset-summary.jsx +0 -230
- package/src/scripts/datalad/fragments/dataset-title.jsx +0 -10
- package/src/scripts/datalad/fragments/dataset-tools.jsx +0 -190
- package/src/scripts/datalad/fragments/dataset-uploaded.jsx +0 -25
- package/src/scripts/datalad/fragments/edit-button.jsx +0 -24
- package/src/scripts/datalad/fragments/edit-description-field.jsx +0 -54
- package/src/scripts/datalad/fragments/edit-description-list.jsx +0 -49
- package/src/scripts/datalad/fragments/edit-list.jsx +0 -82
- package/src/scripts/datalad/fragments/edit-readme.jsx +0 -44
- package/src/scripts/datalad/fragments/incomplete-dataset.jsx +0 -23
- package/src/scripts/datalad/fragments/metadata-tool.jsx +0 -34
- package/src/scripts/datalad/fragments/number-input.tsx +0 -126
- package/src/scripts/datalad/fragments/save-button.jsx +0 -24
- package/src/scripts/datalad/fragments/select-input.tsx +0 -247
- package/src/scripts/datalad/fragments/share-dataset-button.jsx +0 -32
- package/src/scripts/datalad/fragments/text-array-input.tsx +0 -119
- package/src/scripts/datalad/fragments/text-input.tsx +0 -206
- package/src/scripts/datalad/mutations/__tests__/__snapshots__/comment.spec.jsx.snap +0 -5
- package/src/scripts/datalad/mutations/__tests__/__snapshots__/delete.spec.jsx.snap +0 -181
- package/src/scripts/datalad/mutations/__tests__/__snapshots__/manage-permissions.spec.jsx.snap +0 -361
- package/src/scripts/datalad/mutations/__tests__/__snapshots__/subscribe-to-newsletter.spec.jsx.snap +0 -83
- package/src/scripts/datalad/mutations/__tests__/__snapshots__/update-file.spec.jsx.snap +0 -25
- package/src/scripts/datalad/mutations/__tests__/__snapshots__/update-permissions.spec.jsx.snap +0 -361
- package/src/scripts/datalad/mutations/__tests__/comment.spec.jsx +0 -154
- package/src/scripts/datalad/mutations/__tests__/manage-permissions.spec.jsx +0 -21
- package/src/scripts/datalad/mutations/__tests__/subscribe-to-newsletter.spec.jsx +0 -10
- package/src/scripts/datalad/mutations/__tests__/update-file.spec.jsx +0 -15
- package/src/scripts/datalad/mutations/__tests__/update-permissions.spec.jsx +0 -21
- package/src/scripts/datalad/mutations/add-metadata.jsx +0 -164
- package/src/scripts/datalad/mutations/comment.jsx +0 -164
- package/src/scripts/datalad/mutations/delete-dataset-form.jsx +0 -82
- package/src/scripts/datalad/mutations/description.jsx +0 -129
- package/src/scripts/datalad/mutations/flag-annex-object.jsx +0 -62
- package/src/scripts/datalad/mutations/metadata-form.jsx +0 -388
- package/src/scripts/datalad/mutations/readme.jsx +0 -53
- package/src/scripts/datalad/mutations/remove-annex-object.jsx +0 -71
- package/src/scripts/datalad/mutations/subscribe-to-newsletter.jsx +0 -26
- package/src/scripts/datalad/mutations/update-file.jsx +0 -51
- package/src/scripts/datalad/routes/__tests__/__snapshots__/manage-permissions.spec.jsx.snap +0 -159
- package/src/scripts/datalad/routes/__tests__/__snapshots__/snapshot.spec.jsx.snap +0 -31
- package/src/scripts/datalad/routes/__tests__/dataset-content.spec.jsx +0 -108
- package/src/scripts/datalad/routes/__tests__/file-display.spec.jsx +0 -22
- package/src/scripts/datalad/routes/__tests__/manage-permissions.spec.jsx +0 -101
- package/src/scripts/datalad/routes/__tests__/snapshot.spec.jsx +0 -49
- package/src/scripts/datalad/routes/admin-datalad.jsx +0 -45
- package/src/scripts/datalad/routes/admin-exports.jsx +0 -125
- package/src/scripts/datalad/routes/dataset-content.jsx +0 -198
- package/src/scripts/datalad/routes/dataset-routes.jsx +0 -162
- package/src/scripts/datalad/routes/file-display.jsx +0 -84
- package/src/scripts/datalad/routes/manage-permissions.jsx +0 -128
- package/src/scripts/datalad/routes/snapshot-content.jsx +0 -135
- package/src/scripts/datalad/routes/snapshot.jsx +0 -131
- package/src/scripts/datalad/snapshotVersion.js +0 -7
- package/src/scripts/datalad/validation/validation-panel.jsx +0 -48
- package/src/scripts/datalad/validation/validation-status.jsx +0 -120
- package/src/scripts/datalad/validation/validation.jsx +0 -40
- package/src/scripts/dataset/dataset.metrics.jsx +0 -61
- package/src/scripts/file-tree/__tests__/__snapshots__/file-tree-unloaded-directory.spec.jsx.snap +0 -26
- package/src/scripts/file-tree/__tests__/__snapshots__/file-tree.spec.jsx.snap +0 -18
- package/src/scripts/file-tree/__tests__/__snapshots__/file.spec.jsx.snap +0 -81
- package/src/scripts/file-tree/__tests__/file-tree-loading.spec.jsx +0 -18
- package/src/scripts/file-tree/__tests__/file-tree-unloaded-directory.spec.jsx +0 -74
- package/src/scripts/file-tree/__tests__/file-tree.spec.jsx +0 -94
- package/src/scripts/file-tree/__tests__/file-viewer-type.spec.jsx +0 -15
- package/src/scripts/file-tree/__tests__/file.spec.jsx +0 -44
- package/src/scripts/file-tree/__tests__/flat-to-tree.spec.js +0 -55
- package/src/scripts/file-tree/file-tree-loading.jsx +0 -64
- package/src/scripts/file-tree/file-tree-unloaded-directory.jsx +0 -108
- package/src/scripts/file-tree/file-tree.jsx +0 -133
- package/src/scripts/file-tree/file-view.jsx +0 -31
- package/src/scripts/file-tree/file-viewer-type.jsx +0 -45
- package/src/scripts/file-tree/file.jsx +0 -123
- package/src/scripts/file-tree/files.jsx +0 -126
- package/src/scripts/file-tree/flat-to-tree.js +0 -49
- package/src/scripts/file-tree/viewers/__tests__/__snapshots__/file-viewer-json.spec.jsx.snap +0 -51
- package/src/scripts/file-tree/viewers/__tests__/file-viewer-json.spec.jsx +0 -15
- package/src/scripts/file-tree/viewers/__tests__/parse-tabular.spec.js +0 -24
- package/src/scripts/file-tree/viewers/file-viewer-csv.jsx +0 -16
- package/src/scripts/file-tree/viewers/file-viewer-html.jsx +0 -20
- package/src/scripts/file-tree/viewers/file-viewer-json.jsx +0 -50
- package/src/scripts/file-tree/viewers/file-viewer-nifti.jsx +0 -11
- package/src/scripts/file-tree/viewers/file-viewer-table.jsx +0 -34
- package/src/scripts/file-tree/viewers/file-viewer-text.jsx +0 -13
- package/src/scripts/file-tree/viewers/file-viewer-tsv.jsx +0 -16
- package/src/scripts/file-tree/viewers/parse-tabular.js +0 -18
- package/src/scripts/front-page/__tests__/__snapshots__/email-subscription-box.spec.jsx.snap +0 -190
- package/src/scripts/front-page/__tests__/__snapshots__/front-page-stats.spec.jsx.snap +0 -29
- package/src/scripts/front-page/__tests__/__snapshots__/front-page-top-datasets.spec.jsx.snap +0 -464
- package/src/scripts/front-page/__tests__/dataset-count.spec.jsx +0 -33
- package/src/scripts/front-page/__tests__/email-subscription-box.spec.jsx +0 -57
- package/src/scripts/front-page/__tests__/front-page-stats.spec.jsx +0 -10
- package/src/scripts/front-page/__tests__/front-page-top-datasets.spec.jsx +0 -27
- package/src/scripts/front-page/__tests__/participant-count.spec.jsx +0 -31
- package/src/scripts/front-page/dataset-count.jsx +0 -29
- package/src/scripts/front-page/email-subscription-box.jsx +0 -131
- package/src/scripts/front-page/front-page-additional-info.jsx +0 -15
- package/src/scripts/front-page/front-page-collaborators.jsx +0 -117
- package/src/scripts/front-page/front-page-stats.jsx +0 -71
- package/src/scripts/front-page/front-page-support.jsx +0 -30
- package/src/scripts/front-page/front-page-tabs.jsx +0 -166
- package/src/scripts/front-page/front-page-top-datasets.jsx +0 -203
- package/src/scripts/front-page/front-page.jsx +0 -95
- package/src/scripts/front-page/participant-count.jsx +0 -25
- package/src/scripts/hooks/use-measure.js +0 -15
- package/src/scripts/hooks/use-previous.js +0 -7
- package/src/scripts/index.jsx +0 -16
- package/src/scripts/nav/assets/brand_mark.png +0 -0
- package/src/scripts/nav/assets/favicon-upload.png +0 -0
- package/src/scripts/nav/assets/logo_app.png +0 -0
- package/src/scripts/nav/navbar.jsx +0 -144
- package/src/scripts/nav/navbar.navmenu.jsx +0 -106
- package/src/scripts/nav/navbar.usermenu.jsx +0 -52
- package/src/scripts/pages/citation-page.jsx +0 -43
- package/src/scripts/pet/__tests__/__snapshots__/dummy.spec.jsx.snap +0 -70
- package/src/scripts/pet/__tests__/dummy.spec.jsx +0 -10
- package/src/scripts/pet/dummy.jsx +0 -61
- package/src/scripts/refactor_2021/dataset/dataset-pre-refactor-container.tsx +0 -12
- package/src/scripts/refactor_2021/dataset/routes/download-dataset.jsx +0 -70
- package/src/scripts/refactor_2021/redesign-form.jsx +0 -427
- package/src/scripts/routes.tsx +0 -36
- package/src/scripts/search/search-input.tsx +0 -42
- package/src/scripts/search/search-results.tsx +0 -114
- package/src/scripts/styles/capitalized.jsx +0 -6
- package/src/scripts/styles/uppercase.jsx +0 -6
- package/src/scripts/uploader/__tests__/add-path-to-files.spec.js +0 -29
- package/src/scripts/uploader/__tests__/file-upload.spec.js +0 -116
- package/src/scripts/uploader/__tests__/upload-disclaimer.spec.jsx +0 -67
- package/src/scripts/uploader/__tests__/upload-mutation.spec.js +0 -57
- package/src/scripts/uploader/__tests__/uploader.spec.js +0 -31
- package/src/scripts/uploader/add-path-to-files.js +0 -19
- package/src/scripts/uploader/file-upload.js +0 -88
- package/src/scripts/uploader/upload-button.jsx +0 -18
- package/src/scripts/uploader/upload-disclaimer.jsx +0 -92
- package/src/scripts/uploader/upload-file-status.jsx +0 -20
- package/src/scripts/uploader/upload-issues.jsx +0 -131
- package/src/scripts/uploader/upload-metadata.jsx +0 -59
- package/src/scripts/uploader/upload-mutation.js +0 -111
- package/src/scripts/uploader/upload-progress-button.jsx +0 -20
- package/src/scripts/uploader/upload-progress-class.js +0 -36
- package/src/scripts/uploader/upload-progress.jsx +0 -15
- package/src/scripts/uploader/upload-rename.jsx +0 -33
- package/src/scripts/uploader/upload-resume.jsx +0 -35
- package/src/scripts/uploader/upload-select.jsx +0 -29
- package/src/scripts/uploader/upload-status.jsx +0 -23
- package/src/scripts/uploader/upload-step.jsx +0 -48
- package/src/scripts/uploader/uploader-context.js +0 -6
- package/src/scripts/uploader/uploader-location.js +0 -5
- package/src/scripts/uploader/uploader-modal.jsx +0 -27
- package/src/scripts/uploader/uploader-setup-routes.jsx +0 -52
- package/src/scripts/uploader/uploader-status-routes.jsx +0 -30
- package/src/scripts/uploader/uploader-view.jsx +0 -45
- package/src/scripts/uploader/uploader.jsx +0 -388
- package/src/scripts/user/__mocks__/user.store.js +0 -1
- package/src/scripts/user/api.jsx +0 -132
- package/src/scripts/user/avatar.jsx +0 -40
- package/src/scripts/utils/crn.js +0 -15
- package/src/scripts/utils/request.js +0 -107
- package/src/scripts/utils/user.js +0 -18
- package/src/scripts/validation/validation-results.issues.issue.jsx +0 -90
- package/src/scripts/validation/validation-results.issues.jsx +0 -79
- package/src/scripts/validation/validation-results.jsx +0 -96
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import { Link } from 'react-router-dom'
|
|
4
|
-
import UpdateFile from '../datalad/mutations/update-file.jsx'
|
|
5
|
-
import DeleteFile from '../datalad/mutations/delete-file.jsx'
|
|
6
|
-
import { Media } from '../styles/media'
|
|
7
|
-
import RemoveAnnexObject from '../datalad/mutations/remove-annex-object.jsx'
|
|
8
|
-
import FlagAnnexObject from '../datalad/mutations/flag-annex-object.jsx'
|
|
9
|
-
import { isAdmin } from '../authentication/admin-user.jsx'
|
|
10
|
-
import {
|
|
11
|
-
getProfile,
|
|
12
|
-
hasEditPermissions,
|
|
13
|
-
} from '../refactor_2021/authentication/profile.js'
|
|
14
|
-
import { useCookies } from 'react-cookie'
|
|
15
|
-
|
|
16
|
-
const filePath = (path, filename) => `${(path && path + ':') || ''}${filename}`
|
|
17
|
-
|
|
18
|
-
export const apiPath = (datasetId, snapshotTag, filePath) => {
|
|
19
|
-
const snapshotPath = snapshotTag ? `/snapshots/${snapshotTag}` : ''
|
|
20
|
-
return `/crn/datasets/${datasetId}${snapshotPath}/files/${filePath}`
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const File = ({
|
|
24
|
-
id,
|
|
25
|
-
datasetId,
|
|
26
|
-
path,
|
|
27
|
-
filename,
|
|
28
|
-
snapshotTag,
|
|
29
|
-
editMode = false,
|
|
30
|
-
isMobile,
|
|
31
|
-
annexed,
|
|
32
|
-
annexKey,
|
|
33
|
-
datasetPermissions,
|
|
34
|
-
toggleFileToDelete,
|
|
35
|
-
isFileToBeDeleted,
|
|
36
|
-
}) => {
|
|
37
|
-
const snapshotVersionPath = snapshotTag ? `/versions/${snapshotTag}` : ''
|
|
38
|
-
// React route to display the file
|
|
39
|
-
const viewerPath = `/datasets/${datasetId}${snapshotVersionPath}/file-display/${filePath(
|
|
40
|
-
path,
|
|
41
|
-
filename,
|
|
42
|
-
)}`
|
|
43
|
-
const [cookies] = useCookies()
|
|
44
|
-
const user = getProfile(cookies)
|
|
45
|
-
return (
|
|
46
|
-
<>
|
|
47
|
-
{filename}
|
|
48
|
-
<span className="filetree-editfile">
|
|
49
|
-
<Media greaterThanOrEqual="medium">
|
|
50
|
-
<span className="edit-file download-file">
|
|
51
|
-
<a
|
|
52
|
-
href={apiPath(datasetId, snapshotTag, filePath(path, filename))}
|
|
53
|
-
download>
|
|
54
|
-
<i className="fa fa-download" /> Download
|
|
55
|
-
</a>
|
|
56
|
-
</span>
|
|
57
|
-
</Media>
|
|
58
|
-
<span className="edit-file view-file">
|
|
59
|
-
<Link to={viewerPath}>
|
|
60
|
-
<i className="fa fa-eye" /> View
|
|
61
|
-
</Link>
|
|
62
|
-
</span>
|
|
63
|
-
{editMode && (
|
|
64
|
-
<Media greaterThanOrEqual="medium">
|
|
65
|
-
<UpdateFile datasetId={datasetId} path={path}>
|
|
66
|
-
<i className="fa fa-file-o" /> Update
|
|
67
|
-
</UpdateFile>
|
|
68
|
-
</Media>
|
|
69
|
-
)}
|
|
70
|
-
{editMode && filename !== 'dataset_description.json' && (
|
|
71
|
-
<>
|
|
72
|
-
<Media greaterThanOrEqual="medium">
|
|
73
|
-
<DeleteFile
|
|
74
|
-
datasetId={datasetId}
|
|
75
|
-
path={path}
|
|
76
|
-
filename={filename}
|
|
77
|
-
/>
|
|
78
|
-
</Media>
|
|
79
|
-
<div className="bulk-delete-checkbox-group delete-file">
|
|
80
|
-
<input
|
|
81
|
-
id={'cb-' + filename}
|
|
82
|
-
type="checkbox"
|
|
83
|
-
checked={isFileToBeDeleted(id)}
|
|
84
|
-
onChange={() => toggleFileToDelete({ id, path, filename })}
|
|
85
|
-
/>
|
|
86
|
-
<label htmlFor={'cb-' + filename}>
|
|
87
|
-
{isFileToBeDeleted(id) ? 'ADDED' : 'ADD TO BULK DELETE'}{' '}
|
|
88
|
-
</label>
|
|
89
|
-
</div>
|
|
90
|
-
</>
|
|
91
|
-
)}
|
|
92
|
-
{!isMobile &&
|
|
93
|
-
annexed &&
|
|
94
|
-
(isAdmin() ? (
|
|
95
|
-
<RemoveAnnexObject
|
|
96
|
-
datasetId={datasetId}
|
|
97
|
-
snapshot={snapshotTag}
|
|
98
|
-
annexKey={annexKey}
|
|
99
|
-
path={path}
|
|
100
|
-
filename={filename}
|
|
101
|
-
/>
|
|
102
|
-
) : hasEditPermissions(datasetPermissions, user && user.sub) ? (
|
|
103
|
-
<FlagAnnexObject
|
|
104
|
-
datasetId={datasetId}
|
|
105
|
-
snapshot={snapshotTag}
|
|
106
|
-
filepath={filePath(path, filename)}
|
|
107
|
-
annexKey={annexKey}
|
|
108
|
-
/>
|
|
109
|
-
) : null)}
|
|
110
|
-
</span>
|
|
111
|
-
</>
|
|
112
|
-
)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
File.propTypes = {
|
|
116
|
-
datasetId: PropTypes.string,
|
|
117
|
-
path: PropTypes.string,
|
|
118
|
-
filename: PropTypes.string,
|
|
119
|
-
snapshotTag: PropTypes.string,
|
|
120
|
-
editMode: PropTypes.bool,
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export default File
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import { flatToTree } from './flat-to-tree.js'
|
|
4
|
-
import FileTree from './file-tree.jsx'
|
|
5
|
-
import { Media } from '../styles/media'
|
|
6
|
-
import { useMutation, gql } from '@apollo/client'
|
|
7
|
-
import WarnButton from '../common/forms/warn-button.jsx'
|
|
8
|
-
|
|
9
|
-
const DELETE_FILES = gql`
|
|
10
|
-
mutation deleteFiles($datasetId: ID!, $files: [DeleteFile]) {
|
|
11
|
-
deleteFiles(datasetId: $datasetId, files: $files)
|
|
12
|
-
}
|
|
13
|
-
`
|
|
14
|
-
|
|
15
|
-
const Files = ({
|
|
16
|
-
datasetId,
|
|
17
|
-
snapshotTag,
|
|
18
|
-
datasetName,
|
|
19
|
-
files,
|
|
20
|
-
editMode = false,
|
|
21
|
-
datasetPermissions,
|
|
22
|
-
}) => {
|
|
23
|
-
const [filesToDelete, setFilesToDelete] = useState({})
|
|
24
|
-
const [isDeleting, setIsDeleting] = useState(false)
|
|
25
|
-
const [deleteFiles] = useMutation(DELETE_FILES)
|
|
26
|
-
|
|
27
|
-
const isFileToBeDeleted = id => id in filesToDelete
|
|
28
|
-
|
|
29
|
-
const toggleFileToDelete = ({ id, path, filename }) =>
|
|
30
|
-
setFilesToDelete(prevFilesToDelete => {
|
|
31
|
-
if (isFileToBeDeleted(id)) {
|
|
32
|
-
delete prevFilesToDelete[id]
|
|
33
|
-
return { ...prevFilesToDelete }
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
...prevFilesToDelete,
|
|
37
|
-
[id]: { path, filename },
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
const bulkDelete = () => {
|
|
42
|
-
if (Object.values(filesToDelete).length) {
|
|
43
|
-
setIsDeleting(true)
|
|
44
|
-
deleteFiles({
|
|
45
|
-
variables: { datasetId, files: Object.values(filesToDelete) },
|
|
46
|
-
}).then(() => {
|
|
47
|
-
setIsDeleting(false)
|
|
48
|
-
setFilesToDelete({})
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const fileTree = flatToTree(files)
|
|
54
|
-
const diableBtn = Object.values(filesToDelete).length ? null : true
|
|
55
|
-
const filesCount = Object.values(filesToDelete).length
|
|
56
|
-
const bulkDeleteButton =
|
|
57
|
-
editMode &&
|
|
58
|
-
(isDeleting ? (
|
|
59
|
-
<span>Deleting...</span>
|
|
60
|
-
) : (
|
|
61
|
-
<span className="delete-file">
|
|
62
|
-
<WarnButton
|
|
63
|
-
message="Bulk Delete"
|
|
64
|
-
icon="fa-trash"
|
|
65
|
-
warn={true}
|
|
66
|
-
className="edit-file"
|
|
67
|
-
action={bulkDelete}
|
|
68
|
-
/>{' '}
|
|
69
|
-
{diableBtn ? (
|
|
70
|
-
'0 files added'
|
|
71
|
-
) : (
|
|
72
|
-
<>
|
|
73
|
-
{filesCount} file{filesCount > 1 ? 's' : ''} added
|
|
74
|
-
</>
|
|
75
|
-
)}
|
|
76
|
-
</span>
|
|
77
|
-
))
|
|
78
|
-
return (
|
|
79
|
-
<ul className="top-level-item">
|
|
80
|
-
<li className="clearfix">
|
|
81
|
-
<Media at="small">
|
|
82
|
-
<FileTree
|
|
83
|
-
datasetId={datasetId}
|
|
84
|
-
snapshotTag={snapshotTag}
|
|
85
|
-
path={''}
|
|
86
|
-
{...fileTree}
|
|
87
|
-
name={datasetName}
|
|
88
|
-
editMode={editMode}
|
|
89
|
-
defaultExpanded={false}
|
|
90
|
-
datasetPermissions={datasetPermissions}
|
|
91
|
-
toggleFileToDelete={toggleFileToDelete}
|
|
92
|
-
isFileToBeDeleted={isFileToBeDeleted}
|
|
93
|
-
bulkDeleteButton={bulkDeleteButton}
|
|
94
|
-
/>
|
|
95
|
-
</Media>
|
|
96
|
-
<Media greaterThanOrEqual="medium">
|
|
97
|
-
<FileTree
|
|
98
|
-
datasetId={datasetId}
|
|
99
|
-
snapshotTag={snapshotTag}
|
|
100
|
-
path={''}
|
|
101
|
-
{...fileTree}
|
|
102
|
-
name={datasetName}
|
|
103
|
-
editMode={editMode}
|
|
104
|
-
defaultExpanded={true}
|
|
105
|
-
datasetPermissions={datasetPermissions}
|
|
106
|
-
toggleFileToDelete={toggleFileToDelete}
|
|
107
|
-
isFileToBeDeleted={isFileToBeDeleted}
|
|
108
|
-
bulkDeleteButton={bulkDeleteButton}
|
|
109
|
-
/>
|
|
110
|
-
</Media>
|
|
111
|
-
</li>
|
|
112
|
-
</ul>
|
|
113
|
-
)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
Files.propTypes = {
|
|
117
|
-
datasetId: PropTypes.string,
|
|
118
|
-
snapshotTag: PropTypes.string,
|
|
119
|
-
datasetName: PropTypes.string,
|
|
120
|
-
files: PropTypes.array,
|
|
121
|
-
editMode: PropTypes.bool,
|
|
122
|
-
fetchMore: PropTypes.func,
|
|
123
|
-
datasetPermissions: PropTypes.object,
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export default Files
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Takes an array of files and returns a tree representation
|
|
3
|
-
* @param {array} files
|
|
4
|
-
*/
|
|
5
|
-
export const flatToTree = files => {
|
|
6
|
-
const tree = { name: '', files: [], directories: [] }
|
|
7
|
-
for (const file of files) {
|
|
8
|
-
const pathTokens = file.filename.split('/')
|
|
9
|
-
const lastPath = pathTokens.slice(-1).pop()
|
|
10
|
-
if (pathTokens.length === 1) {
|
|
11
|
-
// Top level file or directory stub
|
|
12
|
-
if (file.directory) {
|
|
13
|
-
tree.directories.push({ ...file, name: file.filename })
|
|
14
|
-
} else {
|
|
15
|
-
tree.files.push({ ...file })
|
|
16
|
-
}
|
|
17
|
-
} else {
|
|
18
|
-
// File in a directory
|
|
19
|
-
let directory = tree
|
|
20
|
-
for (const token of pathTokens) {
|
|
21
|
-
if (token === lastPath) {
|
|
22
|
-
// Leaf (file)
|
|
23
|
-
directory.files.push({
|
|
24
|
-
...file,
|
|
25
|
-
filename: lastPath,
|
|
26
|
-
})
|
|
27
|
-
} else {
|
|
28
|
-
const newDir = directory.directories.find(dir => dir.name === token)
|
|
29
|
-
if (newDir) {
|
|
30
|
-
// Already exists, keep going
|
|
31
|
-
directory = newDir
|
|
32
|
-
} else {
|
|
33
|
-
// Create the missing directory
|
|
34
|
-
const createDir = {
|
|
35
|
-
name: token,
|
|
36
|
-
path: `${(directory.path && directory.path + ':') || ''}${token}`,
|
|
37
|
-
files: [],
|
|
38
|
-
directories: [],
|
|
39
|
-
}
|
|
40
|
-
directory.directories.push(createDir)
|
|
41
|
-
directory = createDir
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
tree.directories
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return tree
|
|
49
|
-
}
|
package/src/scripts/file-tree/viewers/__tests__/__snapshots__/file-viewer-json.spec.jsx.snap
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`File Viewer - JSON renders with invalid JSON 1`] = `
|
|
4
|
-
<Fragment>
|
|
5
|
-
<div
|
|
6
|
-
className="col-xs-6"
|
|
7
|
-
>
|
|
8
|
-
<h3>
|
|
9
|
-
Tree
|
|
10
|
-
</h3>
|
|
11
|
-
<hr />
|
|
12
|
-
1234;
|
|
13
|
-
</div>
|
|
14
|
-
<div
|
|
15
|
-
className="col-xs-6"
|
|
16
|
-
>
|
|
17
|
-
<h3>
|
|
18
|
-
Raw
|
|
19
|
-
</h3>
|
|
20
|
-
<hr />
|
|
21
|
-
<Styled(pre)>
|
|
22
|
-
1234;
|
|
23
|
-
</Styled(pre)>
|
|
24
|
-
</div>
|
|
25
|
-
</Fragment>
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
exports[`File Viewer - JSON renders with valid JSON 1`] = `
|
|
29
|
-
<Fragment>
|
|
30
|
-
<div
|
|
31
|
-
className="col-xs-6"
|
|
32
|
-
>
|
|
33
|
-
<h3>
|
|
34
|
-
Tree
|
|
35
|
-
</h3>
|
|
36
|
-
<hr />
|
|
37
|
-
{"thing":1,"name":"string"}
|
|
38
|
-
</div>
|
|
39
|
-
<div
|
|
40
|
-
className="col-xs-6"
|
|
41
|
-
>
|
|
42
|
-
<h3>
|
|
43
|
-
Raw
|
|
44
|
-
</h3>
|
|
45
|
-
<hr />
|
|
46
|
-
<Styled(pre)>
|
|
47
|
-
{"thing":1,"name":"string"}
|
|
48
|
-
</Styled(pre)>
|
|
49
|
-
</div>
|
|
50
|
-
</Fragment>
|
|
51
|
-
`;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { shallow } from 'enzyme'
|
|
3
|
-
import { FileViewerJsonRaw } from '../file-viewer-json.jsx'
|
|
4
|
-
|
|
5
|
-
describe('File Viewer - JSON', () => {
|
|
6
|
-
it('renders with valid JSON', () => {
|
|
7
|
-
const validJson = JSON.stringify({ thing: 1, name: 'string' })
|
|
8
|
-
const wrapper = shallow(<FileViewerJsonRaw jsonRaw={validJson} />)
|
|
9
|
-
expect(wrapper).toMatchSnapshot()
|
|
10
|
-
})
|
|
11
|
-
it('renders with invalid JSON', () => {
|
|
12
|
-
const wrapper = shallow(<FileViewerJsonRaw jsonRaw="1234;" />)
|
|
13
|
-
expect(wrapper).toMatchSnapshot()
|
|
14
|
-
})
|
|
15
|
-
})
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import parseTabular from '../parse-tabular.js'
|
|
2
|
-
|
|
3
|
-
const demoCsv = `participant_id,age,sex
|
|
4
|
-
sub-01,M,28
|
|
5
|
-
sub-02,F,30
|
|
6
|
-
sub-03,F,27
|
|
7
|
-
`
|
|
8
|
-
|
|
9
|
-
const demoTsv = `participant_id age sex
|
|
10
|
-
sub-01 M 28
|
|
11
|
-
sub-02 F 30
|
|
12
|
-
`
|
|
13
|
-
|
|
14
|
-
describe('parseTabular()', () => {
|
|
15
|
-
it('returns an array', () => {
|
|
16
|
-
expect(Array.isArray(parseTabular(demoCsv, ','))).toBe(true)
|
|
17
|
-
})
|
|
18
|
-
it('returns the expected number of data rows', () => {
|
|
19
|
-
expect(parseTabular(demoCsv, ',')).toHaveLength(3)
|
|
20
|
-
})
|
|
21
|
-
it('works with tab separators', () => {
|
|
22
|
-
expect(parseTabular(demoTsv, '\t')).toHaveLength(2)
|
|
23
|
-
})
|
|
24
|
-
})
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import parseTabular from './parse-tabular.js'
|
|
4
|
-
import FileViewerTable from './file-viewer-table.jsx'
|
|
5
|
-
|
|
6
|
-
const FileViewerCsv = ({ data }) => {
|
|
7
|
-
const decoder = new TextDecoder()
|
|
8
|
-
const tableData = parseTabular(decoder.decode(data), ',')
|
|
9
|
-
return <FileViewerTable tableData={tableData} />
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
FileViewerCsv.propTypes = {
|
|
13
|
-
data: PropTypes.instanceOf(ArrayBuffer),
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default FileViewerCsv
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import styled from '@emotion/styled'
|
|
4
|
-
|
|
5
|
-
const ScaledIframe = styled.iframe`
|
|
6
|
-
width: 100%;
|
|
7
|
-
height: 50vh;
|
|
8
|
-
border: none;
|
|
9
|
-
`
|
|
10
|
-
|
|
11
|
-
const FileViewerHtml = ({ data }) => {
|
|
12
|
-
const decoder = new TextDecoder()
|
|
13
|
-
return <ScaledIframe srcDoc={decoder.decode(data)} />
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
FileViewerHtml.propTypes = {
|
|
17
|
-
data: PropTypes.instanceOf(ArrayBuffer),
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default FileViewerHtml
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import styled from '@emotion/styled'
|
|
4
|
-
|
|
5
|
-
const WrappedPre = styled.pre`
|
|
6
|
-
white-space: pre-wrap;
|
|
7
|
-
`
|
|
8
|
-
|
|
9
|
-
export const FileViewerJsonRaw = ({ jsonRaw }) => {
|
|
10
|
-
let jsonViewer
|
|
11
|
-
try {
|
|
12
|
-
jsonViewer = jsonRaw
|
|
13
|
-
} catch (e) {
|
|
14
|
-
jsonViewer = (
|
|
15
|
-
<>
|
|
16
|
-
<p>JSON failed to parse</p>
|
|
17
|
-
<pre>{e.message}</pre>
|
|
18
|
-
</>
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
return (
|
|
22
|
-
<>
|
|
23
|
-
<div className="col-xs-6">
|
|
24
|
-
<h3>Tree</h3>
|
|
25
|
-
<hr />
|
|
26
|
-
{jsonViewer}
|
|
27
|
-
</div>
|
|
28
|
-
<div className="col-xs-6">
|
|
29
|
-
<h3>Raw</h3>
|
|
30
|
-
<hr />
|
|
31
|
-
<WrappedPre>{jsonRaw}</WrappedPre>
|
|
32
|
-
</div>
|
|
33
|
-
</>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
FileViewerJsonRaw.propTypes = {
|
|
38
|
-
jsonRaw: PropTypes.string,
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const FileViewerJson = ({ data }) => {
|
|
42
|
-
const decoder = new TextDecoder()
|
|
43
|
-
return <FileViewerJsonRaw jsonRaw={decoder.decode(data)} />
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
FileViewerJson.propTypes = {
|
|
47
|
-
data: PropTypes.instanceOf(ArrayBuffer),
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export default FileViewerJson
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import Papaya from '../../common/partials/papaya.jsx'
|
|
4
|
-
|
|
5
|
-
const FileViewerNifti = ({ imageUrl }) => <Papaya image={imageUrl} />
|
|
6
|
-
|
|
7
|
-
FileViewerNifti.propTypes = {
|
|
8
|
-
imageUrl: PropTypes.string,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default FileViewerNifti
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { AutoSizer, Column, Table } from 'react-virtualized'
|
|
3
|
-
import PropTypes from 'prop-types'
|
|
4
|
-
import styled from '@emotion/styled'
|
|
5
|
-
|
|
6
|
-
const HalfViewport = styled.div`
|
|
7
|
-
height: 50vh;
|
|
8
|
-
`
|
|
9
|
-
|
|
10
|
-
const FileViewerTable = ({ tableData }) => (
|
|
11
|
-
<HalfViewport>
|
|
12
|
-
<AutoSizer defaultWidth={1024} defaultHeight={2048}>
|
|
13
|
-
{({ width, height }) => (
|
|
14
|
-
<Table
|
|
15
|
-
width={width}
|
|
16
|
-
height={height}
|
|
17
|
-
headerHeight={20}
|
|
18
|
-
rowHeight={30}
|
|
19
|
-
rowCount={tableData.length}
|
|
20
|
-
rowGetter={({ index }) => tableData[index]}>
|
|
21
|
-
{Object.keys(tableData[0]).map((colName, index) => (
|
|
22
|
-
<Column label={colName} dataKey={colName} key={index} width={100} />
|
|
23
|
-
))}
|
|
24
|
-
</Table>
|
|
25
|
-
)}
|
|
26
|
-
</AutoSizer>
|
|
27
|
-
</HalfViewport>
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
FileViewerTable.propTypes = {
|
|
31
|
-
tableData: PropTypes.array,
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default FileViewerTable
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
|
|
4
|
-
const FileViewerText = ({ data }) => {
|
|
5
|
-
const decoder = new TextDecoder()
|
|
6
|
-
return <pre>{decoder.decode(data)}</pre>
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
FileViewerText.propTypes = {
|
|
10
|
-
data: PropTypes.instanceOf(ArrayBuffer),
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default FileViewerText
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import parseTabular from './parse-tabular.js'
|
|
4
|
-
import FileViewerTable from './file-viewer-table.jsx'
|
|
5
|
-
|
|
6
|
-
const FileViewerTsv = ({ data }) => {
|
|
7
|
-
const decoder = new TextDecoder()
|
|
8
|
-
const tableData = parseTabular(decoder.decode(data), '\t')
|
|
9
|
-
return <FileViewerTable tableData={tableData} />
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
FileViewerTsv.propTypes = {
|
|
13
|
-
data: PropTypes.instanceOf(ArrayBuffer),
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default FileViewerTsv
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const parseTabular = (data, separator) => {
|
|
2
|
-
const rows = data.split('\n')
|
|
3
|
-
// Remove any whitespace rows (usually trailing)
|
|
4
|
-
const trimmedRows = rows.filter(row => !/^\s*$/.test(row))
|
|
5
|
-
// remove header from rows
|
|
6
|
-
const header = trimmedRows.shift().split(separator)
|
|
7
|
-
|
|
8
|
-
return trimmedRows.map(row =>
|
|
9
|
-
row
|
|
10
|
-
.split(separator)
|
|
11
|
-
.reduce(
|
|
12
|
-
(rowObj, col, colIndex) => ((rowObj[header[colIndex]] = col), rowObj),
|
|
13
|
-
{},
|
|
14
|
-
),
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default parseTabular
|