@openneuro/app 4.29.2 → 4.29.4
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 +3 -3
- package/src/scripts/dataset/download/download-native.js +1 -1
- package/src/scripts/dataset/files/__tests__/file-types.spec.ts +15 -0
- package/src/scripts/dataset/files/file-types.ts +10 -0
- package/src/scripts/dataset/files/file-view.jsx +7 -1
- package/src/scripts/dataset/files/file-viewer-type.jsx +2 -4
- package/src/scripts/scss/dataset/dataset-tool.scss +8 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openneuro/app",
|
|
3
|
-
"version": "4.29.
|
|
3
|
+
"version": "4.29.4",
|
|
4
4
|
"description": "React JS web frontend for the OpenNeuro platform.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "public/client.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@emotion/react": "11.11.1",
|
|
21
21
|
"@emotion/styled": "11.11.0",
|
|
22
22
|
"@niivue/niivue": "0.45.1",
|
|
23
|
-
"@openneuro/components": "^4.29.
|
|
23
|
+
"@openneuro/components": "^4.29.4",
|
|
24
24
|
"@sentry/react": "^8.25.0",
|
|
25
25
|
"@tanstack/react-table": "^8.9.3",
|
|
26
26
|
"buffer": "^6.0.3",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "7268dbdc85fafd76416270c82851707778ea7710"
|
|
78
78
|
}
|
|
@@ -82,7 +82,7 @@ const downloadTree = async (
|
|
|
82
82
|
// Skip files which are already complete
|
|
83
83
|
if (fileHandle.size == file.size) continue
|
|
84
84
|
const writable = await fileHandle.createWritable()
|
|
85
|
-
const { body, status, statusText } = await fetch(file.urls
|
|
85
|
+
const { body, status, statusText } = await fetch(file.urls[0])
|
|
86
86
|
let loaded = 0
|
|
87
87
|
const progress = new TransformStream({
|
|
88
88
|
transform(chunk, controller) {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { isNifti, isNwb } from "../file-types"
|
|
2
|
+
|
|
3
|
+
describe("isNifti()", () => {
|
|
4
|
+
it("detects nifti files", () => {
|
|
5
|
+
expect(isNifti("sub-01/anat/sub-01_T1w.nii.gz")).toBeTruthy()
|
|
6
|
+
expect(isNifti("dataset_description.json")).toBeFalsy()
|
|
7
|
+
})
|
|
8
|
+
})
|
|
9
|
+
describe("isNwb()", () => {
|
|
10
|
+
it("detects nwb/edf files", () => {
|
|
11
|
+
expect(isNwb("eeg/sub-5_task-oa_eeg.edf")).toBeTruthy()
|
|
12
|
+
expect(isNwb("eeg/sub-cbm009_task-protmap_eeg.edf")).toBeTruthy()
|
|
13
|
+
expect(isNwb("sub-01/anat/sub-01_T1w.nii.gz")).toBeFalsy()
|
|
14
|
+
})
|
|
15
|
+
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react"
|
|
2
2
|
import { Loading } from "@openneuro/components/loading"
|
|
3
3
|
import FileViewerType from "./file-viewer-type.jsx"
|
|
4
|
+
import { isNifti, isNwb } from "./file-types"
|
|
4
5
|
|
|
5
6
|
const FileView = ({ url, path }) => {
|
|
6
7
|
const [data, setData] = useState(new ArrayBuffer(0))
|
|
@@ -15,7 +16,12 @@ const FileView = ({ url, path }) => {
|
|
|
15
16
|
|
|
16
17
|
useEffect(() => {
|
|
17
18
|
if (loading) {
|
|
18
|
-
|
|
19
|
+
// These viewers load their own data
|
|
20
|
+
if (isNifti(path) || isNwb(path)) {
|
|
21
|
+
setLoading(false)
|
|
22
|
+
} else {
|
|
23
|
+
fetchUrl()
|
|
24
|
+
}
|
|
19
25
|
}
|
|
20
26
|
})
|
|
21
27
|
|
|
@@ -7,6 +7,7 @@ import FileViewerTsv from "./viewers/file-viewer-tsv.jsx"
|
|
|
7
7
|
import FileViewerCsv from "./viewers/file-viewer-csv.jsx"
|
|
8
8
|
import FileViewerHtml from "./viewers/file-viewer-html.jsx"
|
|
9
9
|
import { FileViewerNeurosift } from "./viewers/file-viewer-neurosift"
|
|
10
|
+
import { isNifti } from "./file-types"
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Choose the right viewer for each file type
|
|
@@ -21,10 +22,7 @@ const FileViewerType = ({ path, url, data }) => {
|
|
|
21
22
|
) {
|
|
22
23
|
return <FileViewerText data={data} />
|
|
23
24
|
} else if (
|
|
24
|
-
path
|
|
25
|
-
path.endsWith(".nii") ||
|
|
26
|
-
path.endsWith(".mgh") ||
|
|
27
|
-
path.endsWith(".mgz")
|
|
25
|
+
isNifti(path)
|
|
28
26
|
) {
|
|
29
27
|
return <FileViewerNifti imageUrl={url} />
|
|
30
28
|
} else if (path.endsWith(".json")) {
|
|
@@ -49,18 +49,22 @@
|
|
|
49
49
|
display: flex;
|
|
50
50
|
justify-content: space-between;
|
|
51
51
|
align-content: center;
|
|
52
|
-
@media (max-width:
|
|
52
|
+
@media (max-width: 990px) {
|
|
53
53
|
flex-wrap: wrap;
|
|
54
54
|
}
|
|
55
55
|
> span {
|
|
56
56
|
display: block;
|
|
57
|
-
min-width:
|
|
57
|
+
min-width: 23.333333%;
|
|
58
58
|
margin-bottom: 11px;
|
|
59
|
+
&:nth-child(2){
|
|
60
|
+
min-width: 30%;
|
|
61
|
+
word-wrap: break-word;
|
|
62
|
+
}
|
|
59
63
|
label {
|
|
60
64
|
font-weight: bold;
|
|
61
65
|
font-size: 14px;
|
|
62
66
|
display: none;
|
|
63
|
-
@media (max-width:
|
|
67
|
+
@media (max-width: 990px) {
|
|
64
68
|
display: block;
|
|
65
69
|
}
|
|
66
70
|
}
|
|
@@ -75,7 +79,7 @@
|
|
|
75
79
|
.data-table-header {
|
|
76
80
|
font-weight: bold;
|
|
77
81
|
font-size: 14px;
|
|
78
|
-
@media (max-width:
|
|
82
|
+
@media (max-width: 990px) {
|
|
79
83
|
display: none;
|
|
80
84
|
}
|
|
81
85
|
}
|