@openneuro/app 4.28.0 → 4.28.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 +4 -4
- package/src/scripts/dataset/files/file-display.jsx +55 -25
- package/src/scripts/dataset/files/file-view.jsx +1 -3
- package/src/scripts/dataset/routes/snapshot.tsx +2 -2
- package/src/scripts/dataset/routes/tab-routes-draft.tsx +1 -1
- package/src/scripts/dataset/routes/tab-routes-snapshot.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openneuro/app",
|
|
3
|
-
"version": "4.28.
|
|
3
|
+
"version": "4.28.2",
|
|
4
4
|
"description": "React JS web frontend for the OpenNeuro platform.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "public/client.js",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"@emotion/react": "11.11.1",
|
|
20
20
|
"@emotion/styled": "11.11.0",
|
|
21
21
|
"@niivue/niivue": "0.34.0",
|
|
22
|
-
"@openneuro/client": "^4.28.
|
|
23
|
-
"@openneuro/components": "^4.28.
|
|
22
|
+
"@openneuro/client": "^4.28.2",
|
|
23
|
+
"@openneuro/components": "^4.28.2",
|
|
24
24
|
"@sentry/react": "^8.25.0",
|
|
25
25
|
"@tanstack/react-table": "^8.9.3",
|
|
26
26
|
"bids-validator": "1.14.8",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "d9daaef8662914c49acf452df0f020e992923b72"
|
|
79
79
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react"
|
|
1
|
+
import React, { useContext } from "react"
|
|
2
2
|
import PropTypes from "prop-types"
|
|
3
3
|
import { useParams } from "react-router-dom"
|
|
4
4
|
import FileView from "./file-view.jsx"
|
|
@@ -6,6 +6,9 @@ import { apiPath } from "./file"
|
|
|
6
6
|
import styled from "@emotion/styled"
|
|
7
7
|
import { Media } from "../../styles/media"
|
|
8
8
|
import { DatasetPageBorder } from "../routes/styles/dataset-page-border"
|
|
9
|
+
import DatasetQueryContext from "../../datalad/dataset/dataset-query-context"
|
|
10
|
+
import { fetchMoreDirectory } from "./file-tree-unloaded-directory.jsx"
|
|
11
|
+
import { Loading } from "@openneuro/components/loading"
|
|
9
12
|
|
|
10
13
|
const PathBreadcrumb = styled.div`
|
|
11
14
|
font-size: 14px;
|
|
@@ -52,29 +55,56 @@ FileDisplayBreadcrumb.propTypes = {
|
|
|
52
55
|
filePath: PropTypes.string,
|
|
53
56
|
}
|
|
54
57
|
|
|
55
|
-
const FileDisplay = ({
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
const FileDisplay = ({ dataset, snapshotTag = null, filePath }) => {
|
|
59
|
+
const { fetchMore } = useContext(DatasetQueryContext)
|
|
60
|
+
const files = snapshotTag ? dataset.files : dataset.draft.files
|
|
61
|
+
const datasetFile = files.find((file) => file.filename === filePath)
|
|
62
|
+
// If no file matches, we are missing data, load the next missing parent
|
|
63
|
+
if (!datasetFile) {
|
|
64
|
+
const components = filePath.split(":")
|
|
65
|
+
for (let i = components.length; i > 0; i--) {
|
|
66
|
+
const path = components.slice(0, i).join(":")
|
|
67
|
+
const file = files.find((file) => file.filename === path)
|
|
68
|
+
if (file && file.directory) {
|
|
69
|
+
fetchMoreDirectory(fetchMore, dataset.id, snapshotTag, file)
|
|
70
|
+
break
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return (
|
|
74
|
+
<DatasetPageBorder className="dataset-form display-file">
|
|
75
|
+
<PathBreadcrumb>
|
|
76
|
+
<FileDisplayBreadcrumb filePath={filePath} />
|
|
77
|
+
</PathBreadcrumb>
|
|
78
|
+
<Loading />
|
|
79
|
+
</DatasetPageBorder>
|
|
80
|
+
)
|
|
81
|
+
} else {
|
|
82
|
+
const url = datasetFile?.urls?.[0] ||
|
|
83
|
+
apiPath(dataset.id, snapshotTag, filePath)
|
|
84
|
+
return (
|
|
85
|
+
<DatasetPageBorder className="dataset-form display-file">
|
|
86
|
+
<PathBreadcrumb>
|
|
87
|
+
<FileDisplayBreadcrumb filePath={filePath} />
|
|
88
|
+
</PathBreadcrumb>
|
|
89
|
+
<div className="display-file-body">
|
|
90
|
+
<FileView
|
|
91
|
+
url={url}
|
|
92
|
+
path={filePath}
|
|
93
|
+
/>
|
|
94
|
+
</div>
|
|
67
95
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
)
|
|
96
|
+
<Media greaterThanOrEqual="medium">
|
|
97
|
+
<hr />
|
|
98
|
+
<div className="modal-download btn-admin-blue">
|
|
99
|
+
<a href={url} download>
|
|
100
|
+
<i className="fa fa-download" /> Download
|
|
101
|
+
</a>
|
|
102
|
+
</div>
|
|
103
|
+
</Media>
|
|
104
|
+
</DatasetPageBorder>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
78
108
|
|
|
79
109
|
FileDisplay.propTypes = {
|
|
80
110
|
datasetId: PropTypes.string,
|
|
@@ -82,10 +112,10 @@ FileDisplay.propTypes = {
|
|
|
82
112
|
snapshotTag: PropTypes.string,
|
|
83
113
|
}
|
|
84
114
|
|
|
85
|
-
export const FileDisplayRoute = ({
|
|
115
|
+
export const FileDisplayRoute = ({ dataset, snapshotTag }) => {
|
|
86
116
|
return (
|
|
87
117
|
<FileDisplay
|
|
88
|
-
|
|
118
|
+
dataset={dataset}
|
|
89
119
|
snapshotTag={snapshotTag}
|
|
90
120
|
{...useParams()}
|
|
91
121
|
/>
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react"
|
|
2
2
|
import { Loading } from "@openneuro/components/loading"
|
|
3
|
-
import { apiPath } from "./file"
|
|
4
3
|
import FileViewerType from "./file-viewer-type.jsx"
|
|
5
4
|
|
|
6
|
-
const FileView = ({
|
|
7
|
-
const url = apiPath(datasetId, snapshotTag, path)
|
|
5
|
+
const FileView = ({ url, path }) => {
|
|
8
6
|
const [data, setData] = useState(new ArrayBuffer(0))
|
|
9
7
|
const [loading, setLoading] = useState(true)
|
|
10
8
|
|
|
@@ -7,6 +7,7 @@ import { DatasetPageBorder } from "./styles/dataset-page-border"
|
|
|
7
7
|
import { HeaderRow4 } from "./styles/header-row"
|
|
8
8
|
import FileView from "../files/file-view"
|
|
9
9
|
import styled from "@emotion/styled"
|
|
10
|
+
import { apiPath } from "../files/file"
|
|
10
11
|
|
|
11
12
|
const FormRow = styled.div`
|
|
12
13
|
margin-top: 0;
|
|
@@ -108,8 +109,7 @@ const SnapshotRoute = ({
|
|
|
108
109
|
<FormRow>
|
|
109
110
|
<HeaderRow4>Current Changelog</HeaderRow4>
|
|
110
111
|
<FileView
|
|
111
|
-
|
|
112
|
-
snapshotTag={latestSnapshot.tag}
|
|
112
|
+
url={apiPath(datasetId, latestSnapshot.tag, "CHANGES")}
|
|
113
113
|
path="CHANGES"
|
|
114
114
|
/>
|
|
115
115
|
</FormRow>
|
|
@@ -61,7 +61,7 @@ export const TabRoutesDraft = ({ dataset, hasEdit }) => {
|
|
|
61
61
|
/>
|
|
62
62
|
<Route
|
|
63
63
|
path="file-display/:filePath"
|
|
64
|
-
element={<FileDisplayRoute
|
|
64
|
+
element={<FileDisplayRoute dataset={dataset} />}
|
|
65
65
|
/>
|
|
66
66
|
<Route path="metadata" element={<AddMetadata dataset={dataset} />} />
|
|
67
67
|
</Routes>
|
|
@@ -39,7 +39,7 @@ export const TabRoutesSnapshot = ({ dataset, snapshot }) => {
|
|
|
39
39
|
<Route
|
|
40
40
|
path="file-display/:filePath"
|
|
41
41
|
element={
|
|
42
|
-
<FileDisplayRoute
|
|
42
|
+
<FileDisplayRoute dataset={snapshot} snapshotTag={snapshot.tag} />
|
|
43
43
|
}
|
|
44
44
|
/>
|
|
45
45
|
<Route path="metadata" element={<AddMetadata dataset={dataset} />} />
|