@openneuro/app 4.45.3 → 4.45.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openneuro/app",
|
|
3
|
-
"version": "4.45.
|
|
3
|
+
"version": "4.45.4",
|
|
4
4
|
"description": "React JS web frontend for the OpenNeuro platform.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "public/client.js",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "9566f3c8776dd550a0fe690f8e979a2d042dd0aa"
|
|
82
82
|
}
|
|
@@ -1,54 +1,70 @@
|
|
|
1
|
-
import React from "react"
|
|
1
|
+
import React, { Suspense } from "react"
|
|
2
2
|
import PropTypes from "prop-types"
|
|
3
|
-
import
|
|
4
|
-
import FileViewerNifti from "./viewers/file-viewer-nifti"
|
|
5
|
-
import FileViewerJson from "./viewers/file-viewer-json.jsx"
|
|
6
|
-
import FileViewerTsv from "./viewers/file-viewer-tsv.jsx"
|
|
7
|
-
import FileViewerCsv from "./viewers/file-viewer-csv.jsx"
|
|
8
|
-
import FileViewerHtml from "./viewers/file-viewer-html.jsx"
|
|
9
|
-
import { FileViewerNeurosift } from "./viewers/file-viewer-neurosift"
|
|
3
|
+
import { Loading } from "../../components/loading/Loading"
|
|
10
4
|
import { isNifti } from "./file-types"
|
|
11
|
-
|
|
5
|
+
|
|
6
|
+
const FileViewerText = React.lazy(() =>
|
|
7
|
+
import("./viewers/file-viewer-text.jsx")
|
|
8
|
+
)
|
|
9
|
+
const FileViewerNifti = React.lazy(() => import("./viewers/file-viewer-nifti"))
|
|
10
|
+
const FileViewerJson = React.lazy(() =>
|
|
11
|
+
import("./viewers/file-viewer-json.jsx")
|
|
12
|
+
)
|
|
13
|
+
const FileViewerTsv = React.lazy(() => import("./viewers/file-viewer-tsv.jsx"))
|
|
14
|
+
const FileViewerCsv = React.lazy(() => import("./viewers/file-viewer-csv.jsx"))
|
|
15
|
+
const FileViewerHtml = React.lazy(() =>
|
|
16
|
+
import("./viewers/file-viewer-html.jsx")
|
|
17
|
+
)
|
|
18
|
+
const FileViewerMarkdown = React.lazy(() =>
|
|
19
|
+
import("./viewers/file-viewer-markdown")
|
|
20
|
+
)
|
|
21
|
+
const FileViewerNeurosift = React.lazy(() =>
|
|
22
|
+
import("./viewers/file-viewer-neurosift").then((module) => ({
|
|
23
|
+
default: module.FileViewerNeurosift,
|
|
24
|
+
}))
|
|
25
|
+
)
|
|
12
26
|
|
|
13
27
|
/**
|
|
14
28
|
* Choose the right viewer for each file type
|
|
15
29
|
*/
|
|
16
30
|
const FileViewerType = ({ path, url, data }) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
31
|
+
const viewer = (() => {
|
|
32
|
+
if (
|
|
33
|
+
path.endsWith("README") ||
|
|
34
|
+
path.endsWith("CHANGES") ||
|
|
35
|
+
path.endsWith(".bidsignore") ||
|
|
36
|
+
path.endsWith(".gitignore") ||
|
|
37
|
+
path.endsWith(".txt") ||
|
|
38
|
+
path.endsWith(".rst") ||
|
|
39
|
+
path.endsWith(".yml") ||
|
|
40
|
+
path.endsWith(".yaml")
|
|
41
|
+
) {
|
|
42
|
+
return <FileViewerText data={data} />
|
|
43
|
+
} else if (isNifti(path)) {
|
|
44
|
+
return <FileViewerNifti imageUrl={url} />
|
|
45
|
+
} else if (path.endsWith(".md")) {
|
|
46
|
+
return <FileViewerMarkdown data={data} />
|
|
47
|
+
} else if (path.endsWith(".json")) {
|
|
48
|
+
return <FileViewerJson data={data} />
|
|
49
|
+
} else if (path.endsWith(".tsv")) {
|
|
50
|
+
return <FileViewerTsv data={data} />
|
|
51
|
+
} else if (path.endsWith(".csv")) {
|
|
52
|
+
return <FileViewerCsv data={data} />
|
|
53
|
+
} else if (path.endsWith(".html")) {
|
|
54
|
+
return <FileViewerHtml data={data} />
|
|
55
|
+
} else if (path.endsWith(".edf")) {
|
|
56
|
+
return <FileViewerNeurosift url={url} filetype="edf" />
|
|
57
|
+
} else if (path.endsWith(".nwb")) {
|
|
58
|
+
return <FileViewerNeurosift url={url} filetype="nwb" />
|
|
59
|
+
} else {
|
|
60
|
+
return (
|
|
61
|
+
<div className="file-viewer-fallback">
|
|
62
|
+
This file must be downloaded to view it.
|
|
63
|
+
</div>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
})()
|
|
67
|
+
return <Suspense fallback={<Loading />}>{viewer}</Suspense>
|
|
52
68
|
}
|
|
53
69
|
|
|
54
70
|
FileViewerType.propTypes = {
|
package/src/scripts/routes.tsx
CHANGED
|
@@ -1,61 +1,83 @@
|
|
|
1
|
-
import React from "react"
|
|
1
|
+
import React, { lazy, Suspense } from "react"
|
|
2
2
|
import { Navigate, Route, Routes } from "react-router-dom"
|
|
3
|
-
|
|
4
|
-
// TODO - Re-enable code splitting these when we can
|
|
5
|
-
import DatasetQuery from "./dataset/dataset-query"
|
|
6
|
-
//import PreRefactorDatasetProps from './dataset/dataset-pre-refactor-container'
|
|
3
|
+
import { Loading } from "./components/loading/Loading"
|
|
7
4
|
import { isAdmin } from "./authentication/admin-user.jsx"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
5
|
+
|
|
6
|
+
const DatasetQuery = lazy(() => import("./dataset/dataset-query"))
|
|
7
|
+
const FaqPage = lazy(() => import("./pages/faq/faq"))
|
|
8
|
+
const FrontPageContainer = lazy(() => import("./pages/front-page/front-page"))
|
|
9
|
+
const Admin = lazy(() => import("./pages/admin/admin"))
|
|
10
|
+
const SearchRoutes = lazy(() => import("./search/search-routes"))
|
|
11
|
+
const APIKey = lazy(() => import("./pages/api"))
|
|
12
|
+
const ErrorRoute = lazy(() => import("./errors/errorRoute"))
|
|
13
|
+
const PETRedirect = lazy(() =>
|
|
14
|
+
import("./pages/pet-redirect").then((module) => ({
|
|
15
|
+
default: module.PETRedirect,
|
|
16
|
+
}))
|
|
17
|
+
)
|
|
18
|
+
const Citation = lazy(() => import("./pages/citation-page"))
|
|
19
|
+
const FourOFourPage = lazy(() => import("./errors/404page"))
|
|
20
|
+
const ImportDataset = lazy(() =>
|
|
21
|
+
import("./pages/import-dataset").then((module) => ({
|
|
22
|
+
default: module.ImportDataset,
|
|
23
|
+
}))
|
|
24
|
+
)
|
|
25
|
+
const DatasetMetadata = lazy(() =>
|
|
26
|
+
import("./pages/metadata/dataset-metadata").then((module) => ({
|
|
27
|
+
default: module.DatasetMetadata,
|
|
28
|
+
}))
|
|
29
|
+
)
|
|
30
|
+
const TermsPage = lazy(() =>
|
|
31
|
+
import("./pages/terms").then((module) => ({ default: module.TermsPage }))
|
|
32
|
+
)
|
|
33
|
+
const ImageAttribution = lazy(() =>
|
|
34
|
+
import("./pages/image-attribution").then((module) => ({
|
|
35
|
+
default: module.ImageAttribution,
|
|
36
|
+
}))
|
|
37
|
+
)
|
|
38
|
+
const UserQuery = lazy(() =>
|
|
39
|
+
import("./users/user-query").then((module) => ({ default: module.UserQuery }))
|
|
40
|
+
)
|
|
41
|
+
const OrcidLinkPage = lazy(() =>
|
|
42
|
+
import("./pages/orcid-link").then((module) => ({
|
|
43
|
+
default: module.OrcidLinkPage,
|
|
44
|
+
}))
|
|
45
|
+
)
|
|
46
|
+
const FourOThreePage = lazy(() => import("./errors/403page"))
|
|
24
47
|
|
|
25
48
|
const AppRoutes: React.VoidFunctionComponent = () => (
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
path="/user/:orcid/*"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
</Routes>
|
|
49
|
+
<Suspense fallback={<Loading />}>
|
|
50
|
+
<Routes>
|
|
51
|
+
<Route path="/" element={<FrontPageContainer />} />
|
|
52
|
+
<Route path="/faq" element={<FaqPage />} />
|
|
53
|
+
<Route path="/keygen" element={<APIKey />} />
|
|
54
|
+
<Route path="/datasets/:datasetId/*" element={<DatasetQuery />} />
|
|
55
|
+
<Route path="/search/*" element={<SearchRoutes />} />
|
|
56
|
+
<Route
|
|
57
|
+
path="/admin/*"
|
|
58
|
+
element={isAdmin() ? <Admin /> : <FourOThreePage />}
|
|
59
|
+
/>
|
|
60
|
+
<Route path="/error/*" element={<ErrorRoute />} />
|
|
61
|
+
<Route path="/pet" element={<PETRedirect />} />
|
|
62
|
+
<Route path="/cite" element={<Citation />} />
|
|
63
|
+
<Route path="/terms" element={<TermsPage />} />
|
|
64
|
+
<Route path="/image-attribution" element={<ImageAttribution />} />
|
|
65
|
+
<Route path="/import" element={<ImportDataset />} />
|
|
66
|
+
<Route path="/metadata" element={<DatasetMetadata />} />
|
|
67
|
+
<Route path="/public" element={<Navigate to="/search" replace />} />
|
|
68
|
+
<Route path="/orcid-link" element={<OrcidLinkPage />} />
|
|
69
|
+
<Route path="/user/:orcid/*" element={<UserQuery />} />
|
|
70
|
+
<Route
|
|
71
|
+
path="/saved"
|
|
72
|
+
element={<Navigate to="/search?bookmarks" replace />}
|
|
73
|
+
/>
|
|
74
|
+
<Route
|
|
75
|
+
path="/dashboard"
|
|
76
|
+
element={<Navigate to="/search?mydatasets" replace />}
|
|
77
|
+
/>
|
|
78
|
+
<Route path="/*" element={<FourOFourPage />} />
|
|
79
|
+
</Routes>
|
|
80
|
+
</Suspense>
|
|
59
81
|
)
|
|
60
82
|
|
|
61
83
|
export default AppRoutes
|
|
@@ -3,7 +3,6 @@ import pluralize from "pluralize"
|
|
|
3
3
|
import { Loading } from "../components/loading/Loading"
|
|
4
4
|
import { ValidationResultsDisplay } from "../validation/validation-results"
|
|
5
5
|
import UploaderContext from "./uploader-context.js"
|
|
6
|
-
import { validation } from "../workers/schema.js"
|
|
7
6
|
import type { ValidationResult } from "@bids/validator/main"
|
|
8
7
|
import { DatasetIssues } from "@bids/validator/issues"
|
|
9
8
|
|
|
@@ -80,12 +79,17 @@ class UploadValidator
|
|
|
80
79
|
extends React.Component<UploadValidatorProps, UploadValidatorState> {
|
|
81
80
|
constructor(props) {
|
|
82
81
|
super(props)
|
|
82
|
+
const schemaValidator = import("../workers/schema.js")
|
|
83
83
|
this.state = {
|
|
84
84
|
validating: true,
|
|
85
85
|
issues: new DatasetIssues(),
|
|
86
86
|
summary: {},
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
schemaValidator.then((schemaValidatorModule) => {
|
|
89
|
+
schemaValidatorModule.validation(Array.from(this.props.files)).then(
|
|
90
|
+
this.done,
|
|
91
|
+
)
|
|
92
|
+
})
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
/**
|