@openneuro/app 4.2.2 → 4.2.5

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.
Files changed (57) hide show
  1. package/jestsetup.ts +0 -5
  2. package/package.json +7 -13
  3. package/src/scripts/common/forms/__tests__/__snapshots__/warn-button.spec.jsx.snap +26 -26
  4. package/src/scripts/common/forms/__tests__/warn-button.spec.jsx +7 -5
  5. package/src/scripts/datalad/subscriptions/__tests__/__snapshots__/files-subscription.spec.jsx.snap +1 -159
  6. package/src/scripts/datalad/subscriptions/__tests__/files-subscription.spec.jsx +6 -3
  7. package/src/scripts/errors/errorRoute.jsx +4 -23
  8. package/src/scripts/faq/__tests__/__snapshots__/faq.spec.jsx.snap +183 -154
  9. package/src/scripts/faq/__tests__/faq.spec.jsx +3 -3
  10. package/src/scripts/refactor_2021/admin/admin.jsx +1 -7
  11. package/src/scripts/refactor_2021/dataset/comments/__tests__/__snapshots__/comments.spec.jsx.snap +12 -110
  12. package/src/scripts/refactor_2021/dataset/comments/__tests__/comments.spec.jsx +7 -5
  13. package/src/scripts/refactor_2021/dataset/dataset-routes.jsx +0 -11
  14. package/src/scripts/refactor_2021/dataset/download/__tests__/__snapshots__/download-command-line.spec.jsx.snap +8 -9
  15. package/src/scripts/refactor_2021/dataset/download/__tests__/__snapshots__/download-link.spec.jsx.snap +46 -1255
  16. package/src/scripts/refactor_2021/dataset/download/__tests__/__snapshots__/shell-example.spec.jsx.snap +3 -4
  17. package/src/scripts/refactor_2021/dataset/download/__tests__/download-command-line.spec.jsx +10 -11
  18. package/src/scripts/refactor_2021/dataset/download/__tests__/download-link.spec.jsx +3 -3
  19. package/src/scripts/refactor_2021/dataset/download/__tests__/shell-example.spec.jsx +3 -3
  20. package/src/scripts/refactor_2021/dataset/download/download-command-line.jsx +1 -1
  21. package/src/scripts/refactor_2021/dataset/draft-container.tsx +15 -9
  22. package/src/scripts/refactor_2021/dataset/draft-snapshot-routes.tsx +1 -6
  23. package/src/scripts/refactor_2021/dataset/files/__tests__/__snapshots__/file-tree.spec.jsx.snap +24 -49
  24. package/src/scripts/refactor_2021/dataset/files/__tests__/__snapshots__/file.spec.jsx.snap +74 -54
  25. package/src/scripts/refactor_2021/dataset/files/__tests__/file-tree-unloaded-directory.spec.jsx +4 -3
  26. package/src/scripts/refactor_2021/dataset/files/__tests__/file-tree.spec.jsx +23 -19
  27. package/src/scripts/refactor_2021/dataset/files/__tests__/file-viewer-type.spec.jsx +5 -3
  28. package/src/scripts/refactor_2021/dataset/files/__tests__/file.spec.jsx +21 -21
  29. package/src/scripts/refactor_2021/dataset/files/file.jsx +3 -2
  30. package/src/scripts/refactor_2021/dataset/files/viewers/__tests__/__snapshots__/file-viewer-json.spec.jsx.snap +85 -60
  31. package/src/scripts/refactor_2021/dataset/files/viewers/__tests__/file-viewer-json.spec.jsx +5 -5
  32. package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/cancel-button.spec.tsx.snap +14 -6
  33. package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/edit-button.spec.tsx.snap +14 -6
  34. package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/save-button.spec.tsx.snap +14 -6
  35. package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/select-input.spec.tsx.snap +178 -105
  36. package/src/scripts/refactor_2021/dataset/fragments/__tests__/cancel-button.spec.tsx +3 -3
  37. package/src/scripts/refactor_2021/dataset/fragments/__tests__/edit-button.spec.tsx +3 -3
  38. package/src/scripts/refactor_2021/dataset/fragments/__tests__/edit-list.spec.jsx +0 -1
  39. package/src/scripts/refactor_2021/dataset/fragments/__tests__/save-button.spec.tsx +3 -3
  40. package/src/scripts/refactor_2021/dataset/fragments/__tests__/select-input.spec.tsx +9 -9
  41. package/src/scripts/refactor_2021/dataset/fragments/select-input.tsx +1 -1
  42. package/src/scripts/refactor_2021/dataset/mutations/__tests__/__snapshots__/description.spec.jsx.snap +3 -277
  43. package/src/scripts/refactor_2021/dataset/mutations/__tests__/description.spec.jsx +22 -9
  44. package/src/scripts/refactor_2021/dataset/mutations/update-file.jsx +15 -19
  45. package/src/scripts/refactor_2021/dataset/routes/__tests__/__snapshots__/publish.spec.jsx.snap +3 -0
  46. package/src/scripts/refactor_2021/dataset/routes/__tests__/publish.spec.jsx +13 -0
  47. package/src/scripts/refactor_2021/dataset/snapshot-container.tsx +4 -8
  48. package/src/scripts/refactor_2021/routes.tsx +9 -9
  49. package/src/scripts/refactor_2021/uploader/uploader-setup-routes.jsx +4 -24
  50. package/src/scripts/refactor_2021/uploader/uploader-status-routes.jsx +1 -6
  51. package/src/scripts/common/forms/__tests__/__snapshots__/input.spec.jsx.snap +0 -13
  52. package/src/scripts/common/forms/__tests__/input.spec.jsx +0 -25
  53. package/src/scripts/common/forms/input.jsx +0 -98
  54. package/src/scripts/datalad/routes/__tests__/__snapshots__/publish.spec.jsx.snap +0 -14
  55. package/src/scripts/datalad/routes/__tests__/publish.spec.jsx +0 -10
  56. package/src/scripts/datalad/routes/mobile-class.tsx +0 -16
  57. package/src/scripts/datalad/routes/publish.jsx +0 -50
@@ -1,98 +0,0 @@
1
- // dependencies -------------------------------------------------------
2
-
3
- import React, { Component } from 'react'
4
- import PropTypes from 'prop-types'
5
-
6
- // component setup ----------------------------------------------------
7
-
8
- class Input extends React.Component {
9
- // life cycle events --------------------------------------------------
10
-
11
- constructor(props) {
12
- super(props)
13
- this.state = {
14
- value: props.initialValue ? props.initialValue : '',
15
- }
16
- }
17
-
18
- static getDerivedStateFromProps(nextProps) {
19
- // Will reset value when prop changes
20
- if ('value' in nextProps) {
21
- return { value: nextProps.value }
22
- } else {
23
- return null
24
- }
25
- }
26
-
27
- render() {
28
- const placeholder = this.props.placeholder
29
- const type = this.props.type
30
- const name = this.props.name
31
- const value = this.state.value || this.props.value
32
-
33
- return (
34
- <div
35
- className={`form-group float-label-input ${
36
- this.props.containerClass || ''
37
- }`}>
38
- {value && value.length > 0 ? <label>{placeholder}</label> : null}
39
- {this._input(type, name, placeholder, value)}
40
- </div>
41
- )
42
- }
43
-
44
- // custom methods -----------------------------------------------------
45
-
46
- _input(type, name, placeholder, value) {
47
- if (type === 'textarea') {
48
- return (
49
- <textarea
50
- name={name}
51
- placeholder={placeholder}
52
- value={value}
53
- onChange={this._handleChange.bind(this)}
54
- />
55
- )
56
- } else {
57
- return (
58
- <input
59
- type={type}
60
- name={name}
61
- placeholder={placeholder}
62
- value={value}
63
- onChange={this._handleChange.bind(this)}
64
- disabled={this.props.disabled}
65
- />
66
- )
67
- }
68
- }
69
-
70
- _handleChange(event) {
71
- this.setState({ value: event.target.value })
72
-
73
- if (this.props.onChange) {
74
- this.props.onChange(event)
75
- }
76
- }
77
-
78
- _toggleCheckbox(event) {
79
- this.setState({ value: event.target.checked })
80
- if (this.props.onChange) {
81
- this.props.onChange(event)
82
- }
83
- }
84
- }
85
-
86
- Input.propTypes = {
87
- initialValue: PropTypes.string,
88
- placeholder: PropTypes.string,
89
- name: PropTypes.string,
90
- type: PropTypes.string,
91
- value: PropTypes.node,
92
- onChange: PropTypes.func,
93
- disabled: PropTypes.bool,
94
- checked: PropTypes.bool,
95
- containerClass: PropTypes.string,
96
- }
97
-
98
- export default Input
@@ -1,14 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Publish dataset route renders with common props 1`] = `
4
- <Redirect
5
- to={
6
- Object {
7
- "pathname": "/datasets/ds00001/metadata",
8
- "state": Object {
9
- "submitPath": "/datasets/ds00001/publish",
10
- },
11
- }
12
- }
13
- />
14
- `;
@@ -1,10 +0,0 @@
1
- import React from 'react'
2
- import { shallow } from 'enzyme'
3
- import Publish from '../publish.jsx'
4
-
5
- describe('Publish dataset route', () => {
6
- it('renders with common props', () => {
7
- const wrapper = shallow(<Publish datasetId="ds00001" />)
8
- expect(wrapper).toMatchSnapshot()
9
- })
10
- })
@@ -1,16 +0,0 @@
1
- import React, { FunctionComponent } from 'react'
2
- import { Media } from '../../styles/media'
3
-
4
- /**
5
- * This is janky but provided for backwards compatibility until new styling is ready
6
- */
7
- export const MobileClass: FunctionComponent = ({ children }) => (
8
- <>
9
- <Media at="small">
10
- <div className="mobile-class">{children}</div>
11
- </Media>
12
- <Media greaterThanOrEqual="medium">
13
- <div className="col-xs-6">{children}</div>
14
- </Media>
15
- </>
16
- )
@@ -1,50 +0,0 @@
1
- import React from 'react'
2
- import PropTypes from 'prop-types'
3
- import { Link, Redirect } from 'react-router-dom'
4
- import PublishDataset from '../mutations/publish.jsx'
5
-
6
- const hasExpectedMetadata = metadata =>
7
- typeof metadata === 'object' && metadata !== null
8
-
9
- const Publish = ({ datasetId, metadata }) =>
10
- hasExpectedMetadata(metadata) ? (
11
- <div className="dataset-form">
12
- <div className="col-xs-12 dataset-form-header">
13
- <div className="form-group">
14
- <label>Publish</label>
15
- </div>
16
- <hr />
17
- <div className="col-xs-12 dataset-form-body">
18
- <p className="text-danger">
19
- All existing and future snapshots of this dataset will be released
20
- publicly under a{' '}
21
- <a href="https://wiki.creativecommons.org/wiki/CC0">CC0 license</a>.
22
- </p>
23
- </div>
24
- <div className="col-xs-12 dataset-form-controls">
25
- <div className="col-xs-12 modal-actions">
26
- <Link to={`/datasets/${datasetId}`}>
27
- <button className="btn-admin-blue">Return to Dataset</button>
28
- </Link>
29
- <PublishDataset datasetId={datasetId} />
30
- </div>
31
- </div>
32
- </div>
33
- </div>
34
- ) : (
35
- <Redirect
36
- to={{
37
- pathname: `/datasets/${datasetId}/metadata`,
38
- state: {
39
- submitPath: `/datasets/${datasetId}/publish`,
40
- },
41
- }}
42
- />
43
- )
44
-
45
- Publish.propTypes = {
46
- datasetId: PropTypes.string,
47
- metadata: PropTypes.object,
48
- }
49
-
50
- export default Publish