@openneuro/app 4.7.1 → 4.8.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openneuro/app",
3
- "version": "4.7.1",
3
+ "version": "4.8.0",
4
4
  "description": "React JS web frontend for the OpenNeuro platform.",
5
5
  "license": "MIT",
6
6
  "main": "public/client.js",
@@ -20,8 +20,8 @@
20
20
  "@emotion/react": "11.6.0",
21
21
  "@emotion/styled": "11.6.0",
22
22
  "@niivue/niivue": "0.23.1",
23
- "@openneuro/client": "^4.7.1",
24
- "@openneuro/components": "^4.7.1",
23
+ "@openneuro/client": "^4.8.0",
24
+ "@openneuro/components": "^4.8.0",
25
25
  "babel-runtime": "^6.26.0",
26
26
  "bids-validator": "1.9.3",
27
27
  "bytes": "^3.0.0",
@@ -120,5 +120,5 @@
120
120
  "publishConfig": {
121
121
  "access": "public"
122
122
  },
123
- "gitHead": "f228526757b1b27473c99720bbddb2e64f3f51be"
123
+ "gitHead": "1c7a16517601ab4174427a5b2c0c8a78a930b0b5"
124
124
  }
package/src/index.html CHANGED
@@ -21,7 +21,7 @@
21
21
  <body>
22
22
  <div id="main">${react}</div>
23
23
  <script src="/client.jsx" type="module"></script>
24
- <script>window.__APOLLO_STATE__=atob("${apolloState}");</script>
24
+ <script>window.__APOLLO_STATE__=decodeURIComponent(atob("${apolloState}"));</script>
25
25
  </body>
26
26
 
27
27
  </html>
@@ -37,6 +37,7 @@ const Comment = ({ datasetId, data, children }) => {
37
37
  <Editor
38
38
  editorKey={data.id}
39
39
  editorState={editorState}
40
+ readOnly={true}
40
41
  onChange={() => {
41
42
  /* Not editable, this shouldn't fire */
42
43
  }}
@@ -57,6 +57,12 @@ export const getDatasetPage = gql`
57
57
  downloads
58
58
  views
59
59
  }
60
+ derivatives {
61
+ name
62
+ s3Url
63
+ dataladUrl
64
+ local
65
+ }
60
66
  onBrainlife
61
67
  }
62
68
  }
@@ -106,6 +112,12 @@ export const getDraftPage = gql`
106
112
  downloads
107
113
  views
108
114
  }
115
+ derivatives {
116
+ name
117
+ s3Url
118
+ dataladUrl
119
+ local
120
+ }
109
121
  }
110
122
  }
111
123
  ${DatasetQueryFragments.DRAFT_FRAGMENT}
@@ -0,0 +1,19 @@
1
+ import React from 'react'
2
+ import ShellExample from './shell-example.jsx'
3
+
4
+ interface DownloadDataLadDerivativesProps {
5
+ url: string
6
+ }
7
+
8
+ const DownloadDataLadDerivative = ({
9
+ url,
10
+ }: DownloadDataLadDerivativesProps): JSX.Element => (
11
+ <div>
12
+ <h4>
13
+ Download with <a href="https://www.datalad.org">DataLad</a>
14
+ </h4>
15
+ <ShellExample>datalad install {url}</ShellExample>
16
+ </div>
17
+ )
18
+
19
+ export default DownloadDataLadDerivative
@@ -0,0 +1,23 @@
1
+ import React from 'react'
2
+ import ShellExample from './shell-example.jsx'
3
+
4
+ interface DownloadS3DerivativesProps {
5
+ name: string
6
+ url: string
7
+ }
8
+
9
+ const DownloadS3Derivatives = ({
10
+ name,
11
+ url,
12
+ }: DownloadS3DerivativesProps): JSX.Element => (
13
+ <div>
14
+ <h4>
15
+ Download from <a href="https://aws.amazon.com/cli/">S3</a>
16
+ </h4>
17
+ <ShellExample>
18
+ aws s3 sync --no-sign-request {url} {name}
19
+ </ShellExample>
20
+ </div>
21
+ )
22
+
23
+ export default DownloadS3Derivatives
@@ -84,6 +84,7 @@ const DraftContainer: React.FC<DraftContainerProps> = ({ dataset }) => {
84
84
  const isDatasetAdmin =
85
85
  hasDatasetAdminPermissions(dataset.permissions, profile?.sub) || isAdmin
86
86
  const modality: string = summary?.modalities[0] || ''
87
+ const hasDerivatives = dataset?.derivatives.length > 0
87
88
 
88
89
  return (
89
90
  <>
@@ -183,6 +184,7 @@ const DraftContainer: React.FC<DraftContainerProps> = ({ dataset }) => {
183
184
  isAdmin={isAdmin}
184
185
  hasSnapshot={dataset.snapshots.length !== 0}
185
186
  isDatasetAdmin={isDatasetAdmin}
187
+ hasDerivatives={hasDerivatives}
186
188
  />
187
189
  <DatasetPageTabContainer>
188
190
  <TabRoutesDraft dataset={dataset} hasEdit={hasEdit} />
@@ -0,0 +1,77 @@
1
+ import React from 'react'
2
+ import DownloadS3Derivative from '../download/download-derivative-s3'
3
+ import DownloadDataLadDerivative from '../download/download-derivative-datalad'
4
+ import { DatasetPageBorder } from './styles/dataset-page-border'
5
+ import { HeaderRow3 } from './styles/header-row'
6
+
7
+ interface DerivativeElementProps {
8
+ name: string
9
+ s3Url: string
10
+ dataladUrl: string
11
+ local: boolean
12
+ }
13
+
14
+ const DerivativeElement = ({
15
+ name,
16
+ s3Url,
17
+ dataladUrl,
18
+ local,
19
+ }: DerivativeElementProps): JSX.Element => {
20
+ if (local) {
21
+ return null
22
+ } else {
23
+ return (
24
+ <>
25
+ <hr />
26
+ <h3>
27
+ <a href={dataladUrl}>{name}</a>
28
+ </h3>
29
+ {s3Url && <DownloadS3Derivative url={s3Url} name={name} />}
30
+ {dataladUrl && <DownloadDataLadDerivative url={dataladUrl} />}
31
+ </>
32
+ )
33
+ }
34
+ }
35
+
36
+ interface DerivativesProps {
37
+ derivatives: DerivativeElementProps[]
38
+ }
39
+
40
+ const Derivatives = ({ derivatives }: DerivativesProps): JSX.Element => {
41
+ return (
42
+ <DatasetPageBorder>
43
+ <HeaderRow3>Available Derivatives</HeaderRow3>
44
+ <h5>Acknowledgements</h5>
45
+ <p>
46
+ These derivatives were generated on the{' '}
47
+ <a href="https://www.tacc.utexas.edu/">
48
+ Texas Advanced Computing Center
49
+ </a>{' '}
50
+ Frontera computing system [1] through their{' '}
51
+ <a href="https://frontera-portal.tacc.utexas.edu/allocations/">
52
+ Pathways allocation
53
+ </a>
54
+ . This work was also funded by the{' '}
55
+ <a href="https://grantome.com/grant/NIH/R24-MH117179-03">
56
+ NIH BRAIN Initiative
57
+ </a>
58
+ .
59
+ </p>
60
+ <p>
61
+ [1]: Dan Stanzione, John West, R. Todd Evans, Tommy Minyard, Omar
62
+ Ghattas, and Dhabaleswar K. Panda. 2020. Frontera: The Evolution of
63
+ Leadership Computing at the National Science Foundation. In Practice and
64
+ Experience in Advanced Research Computing (PEARC ’20), July 26–30, 2020,
65
+ Portland, OR, USA. ACM, New York, NY, USA, 11 pages.
66
+ <a href="https://doi.org/10.1145/3311790.3396656">
67
+ https://doi.org/10.1145/3311790.3396656
68
+ </a>
69
+ </p>
70
+ {derivatives.map(derivative => (
71
+ <DerivativeElement key={derivative.name} {...derivative} />
72
+ ))}
73
+ </DatasetPageBorder>
74
+ )
75
+ }
76
+
77
+ export default Derivatives
@@ -8,6 +8,7 @@ import Publish from './publish'
8
8
  import Share from './manage-permissions'
9
9
  import Snapshot from './snapshot'
10
10
  import AddMetadata from './add-metadata'
11
+ import Derivatives from './derivatives'
11
12
  import FileDisplay from '../files/file-display'
12
13
 
13
14
  export const TabRoutesDraft = ({ dataset, hasEdit }) => {
@@ -28,6 +29,11 @@ export const TabRoutesDraft = ({ dataset, hasEdit }) => {
28
29
  />
29
30
  )}
30
31
  />
32
+ <Route
33
+ exact
34
+ path="/datasets/:datasetId/derivatives"
35
+ component={() => <Derivatives derivatives={dataset.derivatives} />}
36
+ />
31
37
  <Route
32
38
  exact
33
39
  path="/datasets/:datasetId/delete"
@@ -5,6 +5,7 @@ import DownloadDataset from './download-dataset'
5
5
  import { DeprecateSnapshotPage } from './deprecate-snapshot-page'
6
6
  import FileDisplay from '../files/file-display'
7
7
  import AddMetadata from './add-metadata'
8
+ import Derivatives from './derivatives'
8
9
 
9
10
  export const TabRoutesSnapshot = ({ dataset, snapshot }) => {
10
11
  return (
@@ -26,6 +27,11 @@ export const TabRoutesSnapshot = ({ dataset, snapshot }) => {
26
27
  />
27
28
  )}
28
29
  />
30
+ <Route
31
+ exact
32
+ path="/datasets/:datasetId/versions/:snapshotId/derivatives"
33
+ component={() => <Derivatives derivatives={dataset.derivatives} />}
34
+ />
29
35
  <Route
30
36
  exact
31
37
  path="/datasets/:datasetId/versions/:snapshotTag/deprecate"
@@ -86,6 +86,7 @@ const SnapshotContainer: React.FC<SnapshotContainerProps> = ({
86
86
  const isDatasetAdmin =
87
87
  hasDatasetAdminPermissions(dataset.permissions, profile?.sub) || isAdmin
88
88
  const modality: string = summary?.modalities[0] || ''
89
+ const hasDerivatives = dataset?.derivatives.length > 0
89
90
 
90
91
  return (
91
92
  <>
@@ -170,6 +171,7 @@ const SnapshotContainer: React.FC<SnapshotContainerProps> = ({
170
171
  snapshotId={snapshot.tag}
171
172
  isAdmin={isAdmin}
172
173
  isDatasetAdmin={isDatasetAdmin}
174
+ hasDerivatives={hasDerivatives}
173
175
  />
174
176
  </div>
175
177
  <DatasetPageTabContainer>
package/src/server.jsx CHANGED
@@ -57,9 +57,9 @@ export async function render(url, cookies) {
57
57
  const head = `${helmet.title.toString()}${helmet.meta.toString()}${helmet.style.toString()}`
58
58
 
59
59
  // Prevent <script> tags from strings
60
- const apolloState = Buffer.from(JSON.stringify(client.extract())).toString(
61
- 'base64',
62
- )
60
+ const apolloState = Buffer.from(
61
+ encodeURIComponent(JSON.stringify(client.extract())),
62
+ ).toString('base64')
63
63
 
64
64
  return { react, apolloState, head, css: redesignStyles }
65
65
  }