@openneuro/app 4.5.1 → 4.6.0-alpha.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 +4 -4
- package/src/scripts/datalad/dataset/dataset-query-fragments.js +2 -0
- package/src/scripts/dataset/dataset-routes.jsx +2 -126
- package/src/scripts/dataset/draft-container.tsx +14 -52
- package/src/scripts/dataset/fragments/dataset-history.jsx +38 -42
- package/src/scripts/dataset/mutations/admin-exports.jsx +70 -0
- package/src/scripts/dataset/mutations/create-anonymous-reviewer.tsx +0 -3
- package/src/scripts/dataset/mutations/dataset-relations.tsx +4 -15
- package/src/scripts/dataset/mutations/metadata-form.jsx +1 -1
- package/src/scripts/dataset/mutations/remove-annex-object.jsx +0 -1
- package/src/scripts/dataset/mutations/snapshot.tsx +16 -2
- package/src/scripts/dataset/routes/add-metadata.jsx +20 -24
- package/src/scripts/dataset/routes/admin-datalad.jsx +26 -33
- package/src/scripts/dataset/routes/dataset-default.tsx +54 -0
- package/src/scripts/dataset/routes/delete-page.tsx +5 -9
- package/src/scripts/dataset/routes/deprecate-snapshot-page.tsx +6 -7
- package/src/scripts/dataset/routes/download-dataset.tsx +24 -47
- package/src/scripts/dataset/routes/manage-anonymous-reviewers.tsx +9 -3
- package/src/scripts/dataset/routes/manage-permissions.jsx +7 -10
- package/src/scripts/dataset/routes/publish.jsx +10 -12
- package/src/scripts/dataset/routes/snapshot-default.tsx +44 -0
- package/src/scripts/dataset/routes/snapshot.jsx +84 -75
- package/src/scripts/dataset/routes/styles/dataset-page-border.tsx +8 -0
- package/src/scripts/dataset/routes/styles/dataset-page-tab-container.tsx +8 -0
- package/src/scripts/dataset/routes/styles/draft-background.tsx +7 -0
- package/src/scripts/dataset/routes/styles/header-row.tsx +12 -0
- package/src/scripts/dataset/routes/tab-routes-draft.tsx +88 -0
- package/src/scripts/dataset/routes/tab-routes-snapshot.tsx +57 -0
- package/src/scripts/dataset/snapshot-container.tsx +6 -39
- package/src/scripts/search/use-search-results.tsx +1 -0
- package/src/scripts/dataset/routes/admin-exports.jsx +0 -130
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import styled from '@emotion/styled'
|
|
2
|
+
|
|
3
|
+
const headerRowStyle = `
|
|
4
|
+
margin-top: 0;
|
|
5
|
+
margin-bottom: 1.3em;
|
|
6
|
+
`
|
|
7
|
+
|
|
8
|
+
export const HeaderRow2 = styled.h2(headerRowStyle)
|
|
9
|
+
|
|
10
|
+
export const HeaderRow3 = styled.h3(headerRowStyle)
|
|
11
|
+
|
|
12
|
+
export const HeaderRow4 = styled.h4(headerRowStyle)
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Route, Switch } from 'react-router-dom'
|
|
3
|
+
import { DatasetDefault } from './dataset-default'
|
|
4
|
+
import AdminDataset from './admin-datalad'
|
|
5
|
+
import DeletePage from './delete-page'
|
|
6
|
+
import DownloadDataset from './download-dataset'
|
|
7
|
+
import Publish from './publish'
|
|
8
|
+
import Share from './manage-permissions'
|
|
9
|
+
import Snapshot from './snapshot'
|
|
10
|
+
import AddMetadata from './add-metadata'
|
|
11
|
+
import FileDisplay from '../files/file-display'
|
|
12
|
+
|
|
13
|
+
export const TabRoutesDraft = ({ dataset, hasEdit }) => {
|
|
14
|
+
return (
|
|
15
|
+
<Switch>
|
|
16
|
+
<Route
|
|
17
|
+
exact
|
|
18
|
+
path="/datasets/:datasetId"
|
|
19
|
+
component={() => <DatasetDefault dataset={dataset} hasEdit={hasEdit} />}
|
|
20
|
+
/>
|
|
21
|
+
<Route
|
|
22
|
+
exact
|
|
23
|
+
path="/datasets/:datasetId/download"
|
|
24
|
+
component={() => (
|
|
25
|
+
<DownloadDataset
|
|
26
|
+
worker={dataset.worker}
|
|
27
|
+
datasetPermissions={dataset.permissions}
|
|
28
|
+
/>
|
|
29
|
+
)}
|
|
30
|
+
/>
|
|
31
|
+
<Route
|
|
32
|
+
exact
|
|
33
|
+
path="/datasets/:datasetId/delete"
|
|
34
|
+
component={() => <DeletePage dataset={dataset} />}
|
|
35
|
+
/>
|
|
36
|
+
<Route
|
|
37
|
+
exact
|
|
38
|
+
path="/datasets/:datasetId/admin"
|
|
39
|
+
component={() => <AdminDataset dataset={dataset} />}
|
|
40
|
+
/>
|
|
41
|
+
<Route
|
|
42
|
+
exact
|
|
43
|
+
path="/datasets/:datasetId/publish"
|
|
44
|
+
component={() => (
|
|
45
|
+
<Publish datasetId={dataset.id} metadata={dataset.metadata} />
|
|
46
|
+
)}
|
|
47
|
+
/>
|
|
48
|
+
<Route
|
|
49
|
+
exact
|
|
50
|
+
path="/datasets/:datasetId/snapshot"
|
|
51
|
+
component={() => (
|
|
52
|
+
<Snapshot
|
|
53
|
+
datasetId={dataset.id}
|
|
54
|
+
snapshots={dataset.snapshots}
|
|
55
|
+
issues={dataset.draft.issues}
|
|
56
|
+
description={dataset.draft.description}
|
|
57
|
+
/>
|
|
58
|
+
)}
|
|
59
|
+
/>
|
|
60
|
+
<Route
|
|
61
|
+
exact
|
|
62
|
+
path="/datasets/:datasetId/share"
|
|
63
|
+
component={() => (
|
|
64
|
+
<Share
|
|
65
|
+
datasetId={dataset.id}
|
|
66
|
+
permissions={dataset.permissions}
|
|
67
|
+
reviewers={dataset.reviewers}
|
|
68
|
+
/>
|
|
69
|
+
)}
|
|
70
|
+
/>
|
|
71
|
+
<Route
|
|
72
|
+
path="/datasets/:datasetId/file-display/:filePath"
|
|
73
|
+
render={({
|
|
74
|
+
match: {
|
|
75
|
+
params: { datasetId, filePath },
|
|
76
|
+
},
|
|
77
|
+
}) => {
|
|
78
|
+
return <FileDisplay datasetId={datasetId} filePath={filePath} />
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
81
|
+
<Route
|
|
82
|
+
exact
|
|
83
|
+
path="/datasets/:datasetId/metadata"
|
|
84
|
+
component={() => <AddMetadata dataset={dataset} />}
|
|
85
|
+
/>
|
|
86
|
+
</Switch>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Route, Switch } from 'react-router-dom'
|
|
3
|
+
import { SnapshotDefault } from './snapshot-default'
|
|
4
|
+
import DownloadDataset from './download-dataset'
|
|
5
|
+
import { DeprecateSnapshotPage } from './deprecate-snapshot-page'
|
|
6
|
+
import FileDisplay from '../files/file-display'
|
|
7
|
+
import AddMetadata from './add-metadata'
|
|
8
|
+
|
|
9
|
+
export const TabRoutesSnapshot = ({ dataset, snapshot }) => {
|
|
10
|
+
return (
|
|
11
|
+
<Switch>
|
|
12
|
+
<Route
|
|
13
|
+
exact
|
|
14
|
+
path="/datasets/:datasetId/versions/:snapshotId"
|
|
15
|
+
component={() => (
|
|
16
|
+
<SnapshotDefault dataset={dataset} snapshot={snapshot} />
|
|
17
|
+
)}
|
|
18
|
+
/>
|
|
19
|
+
<Route
|
|
20
|
+
exact
|
|
21
|
+
path="/datasets/:datasetId/versions/:snapshotId/download"
|
|
22
|
+
component={() => (
|
|
23
|
+
<DownloadDataset
|
|
24
|
+
worker={dataset.worker}
|
|
25
|
+
datasetPermissions={dataset.permissions}
|
|
26
|
+
/>
|
|
27
|
+
)}
|
|
28
|
+
/>
|
|
29
|
+
<Route
|
|
30
|
+
exact
|
|
31
|
+
path="/datasets/:datasetId/versions/:snapshotTag/deprecate"
|
|
32
|
+
component={() => <DeprecateSnapshotPage />}
|
|
33
|
+
/>
|
|
34
|
+
<Route
|
|
35
|
+
path="/datasets/:datasetId/versions/:snapshotTag/file-display/:filePath"
|
|
36
|
+
render={({
|
|
37
|
+
match: {
|
|
38
|
+
params: { datasetId, filePath, snapshotTag },
|
|
39
|
+
},
|
|
40
|
+
}) => {
|
|
41
|
+
return (
|
|
42
|
+
<FileDisplay
|
|
43
|
+
datasetId={datasetId}
|
|
44
|
+
snapshotTag={snapshotTag}
|
|
45
|
+
filePath={filePath}
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
50
|
+
<Route
|
|
51
|
+
exact
|
|
52
|
+
path="/datasets/:datasetId/versions/:snapshotTag/metadata"
|
|
53
|
+
component={() => <AddMetadata dataset={dataset} />}
|
|
54
|
+
/>
|
|
55
|
+
</Switch>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { gql, useQuery } from '@apollo/client'
|
|
3
|
+
import { DatasetPageTabContainer } from './routes/styles/dataset-page-tab-container'
|
|
3
4
|
import DatasetQueryContext from '../datalad/dataset/dataset-query-context.js'
|
|
4
|
-
import Markdown from 'markdown-to-jsx'
|
|
5
5
|
import { Link, useLocation } from 'react-router-dom'
|
|
6
6
|
import pluralize from 'pluralize'
|
|
7
7
|
import formatDistanceToNow from 'date-fns/formatDistanceToNow'
|
|
8
8
|
import parseISO from 'date-fns/parseISO'
|
|
9
9
|
|
|
10
|
-
import Files from './files'
|
|
11
10
|
import Validation from '../validation/validation.jsx'
|
|
12
11
|
import { config } from '../config'
|
|
13
|
-
import Comments from './comments/comments.jsx'
|
|
14
12
|
import DatasetCitation from './fragments/dataset-citation.jsx'
|
|
15
13
|
import { DatasetAlertVersion } from './fragments/dataset-alert-version'
|
|
16
14
|
|
|
@@ -35,13 +33,12 @@ import {
|
|
|
35
33
|
} from '../authentication/profile'
|
|
36
34
|
import { useCookies } from 'react-cookie'
|
|
37
35
|
|
|
38
|
-
import { ReadMore } from '@openneuro/components/read-more'
|
|
39
|
-
|
|
40
36
|
import { FollowDataset } from './mutations/follow'
|
|
41
37
|
import { StarDataset } from './mutations/star'
|
|
42
38
|
|
|
43
39
|
import { SNAPSHOT_FIELDS } from '../datalad/dataset/dataset-query-fragments.js'
|
|
44
40
|
import { DOILink } from './fragments/doi-link'
|
|
41
|
+
import { TabRoutesSnapshot } from './routes/tab-routes-snapshot'
|
|
45
42
|
|
|
46
43
|
const formatDate = dateObject =>
|
|
47
44
|
new Date(dateObject).toISOString().split('T')[0]
|
|
@@ -111,7 +108,7 @@ const SnapshotContainer: React.FC<SnapshotContainerProps> = ({
|
|
|
111
108
|
<div className="col col-8 col-lg">
|
|
112
109
|
{summary && (
|
|
113
110
|
<DatasetHeaderMeta
|
|
114
|
-
size={
|
|
111
|
+
size={snapshot.size}
|
|
115
112
|
totalFiles={summary.totalFiles}
|
|
116
113
|
datasetId={datasetId}
|
|
117
114
|
/>
|
|
@@ -168,39 +165,9 @@ const SnapshotContainer: React.FC<SnapshotContainerProps> = ({
|
|
|
168
165
|
isDatasetAdmin={isDatasetAdmin}
|
|
169
166
|
/>
|
|
170
167
|
</div>
|
|
171
|
-
<
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
expandLabel="Read More"
|
|
175
|
-
collapseLabel="Collapse">
|
|
176
|
-
<Files
|
|
177
|
-
datasetId={datasetId}
|
|
178
|
-
snapshotTag={snapshot.tag}
|
|
179
|
-
datasetName={description.Name}
|
|
180
|
-
files={snapshot.files}
|
|
181
|
-
editMode={false}
|
|
182
|
-
datasetPermissions={dataset.permissions}
|
|
183
|
-
/>
|
|
184
|
-
</ReadMore>
|
|
185
|
-
<MetaDataBlock
|
|
186
|
-
heading="README"
|
|
187
|
-
item={
|
|
188
|
-
<ReadMore
|
|
189
|
-
id="readme"
|
|
190
|
-
expandLabel="Read More"
|
|
191
|
-
collapseLabel="Collapse">
|
|
192
|
-
<Markdown>
|
|
193
|
-
{snapshot.readme == null ? 'N/A' : snapshot.readme}
|
|
194
|
-
</Markdown>
|
|
195
|
-
</ReadMore>
|
|
196
|
-
}
|
|
197
|
-
className="dataset-readme markdown-body"
|
|
198
|
-
/>
|
|
199
|
-
<Comments
|
|
200
|
-
datasetId={dataset.id}
|
|
201
|
-
uploader={dataset.uploader}
|
|
202
|
-
comments={dataset.comments}
|
|
203
|
-
/>
|
|
168
|
+
<DatasetPageTabContainer>
|
|
169
|
+
<TabRoutesSnapshot dataset={dataset} snapshot={snapshot} />
|
|
170
|
+
</DatasetPageTabContainer>
|
|
204
171
|
</div>
|
|
205
172
|
<div className="col sidebar">
|
|
206
173
|
<MetaDataBlock
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
// dependencies -------------------------------------------------------
|
|
2
|
-
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import { gql, useMutation } from '@apollo/client'
|
|
5
|
-
import Helmet from 'react-helmet'
|
|
6
|
-
import { Link } from 'react-router-dom'
|
|
7
|
-
import PropTypes from 'prop-types'
|
|
8
|
-
import { reexporterLogsURL } from '../../resources/kibana'
|
|
9
|
-
import styled from '@emotion/styled'
|
|
10
|
-
|
|
11
|
-
const ButtonsContainer = styled.div({
|
|
12
|
-
display: 'flex',
|
|
13
|
-
flexDirection: 'column',
|
|
14
|
-
alignItems: 'center',
|
|
15
|
-
minWidth: '300px',
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
const NormalizedButton = styled.button({
|
|
19
|
-
margin: 0,
|
|
20
|
-
fontWeight: 400,
|
|
21
|
-
fontSize: '12pt',
|
|
22
|
-
textAlign: 'center',
|
|
23
|
-
padding: '9px 12px',
|
|
24
|
-
width: '100%',
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
const SuccessMessage = styled.p({
|
|
28
|
-
color: 'rgb(92, 184, 92)',
|
|
29
|
-
})
|
|
30
|
-
const InProgressMessage = styled.p({
|
|
31
|
-
color: 'orange',
|
|
32
|
-
})
|
|
33
|
-
const ErrorMessage = styled.p({
|
|
34
|
-
color: 'red',
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
const DividerContainer = styled.div({
|
|
38
|
-
display: 'flex',
|
|
39
|
-
justifyContent: 'center',
|
|
40
|
-
alignItems: 'center',
|
|
41
|
-
width: '100%',
|
|
42
|
-
})
|
|
43
|
-
const HBar = styled.div({
|
|
44
|
-
height: '2px',
|
|
45
|
-
backgroundColor: 'lightgrey',
|
|
46
|
-
flexGrow: 1,
|
|
47
|
-
})
|
|
48
|
-
const DividerText = styled.p({
|
|
49
|
-
padding: '19px 1rem',
|
|
50
|
-
margin: 0,
|
|
51
|
-
fontWeight: 400,
|
|
52
|
-
fontSize: '14pt',
|
|
53
|
-
textAlign: 'center',
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
const Divider = ({ text }) => (
|
|
57
|
-
<DividerContainer>
|
|
58
|
-
<HBar />
|
|
59
|
-
<DividerText>{text}</DividerText>
|
|
60
|
-
<HBar />
|
|
61
|
-
</DividerContainer>
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
Divider.propTypes = {
|
|
65
|
-
text: PropTypes.string,
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const REEXPORT_REMOTES = gql`
|
|
69
|
-
mutation reexportRemotes($datasetId: ID!) {
|
|
70
|
-
reexportRemotes(datasetId: $datasetId)
|
|
71
|
-
}
|
|
72
|
-
`
|
|
73
|
-
|
|
74
|
-
const AdminExports = ({ dataset }) => {
|
|
75
|
-
const [reexportRemotes, { data, loading, error }] =
|
|
76
|
-
useMutation(REEXPORT_REMOTES)
|
|
77
|
-
const success = data && data.reexportRemotes
|
|
78
|
-
return (
|
|
79
|
-
<>
|
|
80
|
-
<Helmet>
|
|
81
|
-
<title>Admin Dashboard - OpenNeuro</title>
|
|
82
|
-
</Helmet>
|
|
83
|
-
<div className="dataset-form container">
|
|
84
|
-
<div className="grid">
|
|
85
|
-
<div className="col col-12 grid m-t-10 m-b-20">
|
|
86
|
-
<h3>Admin: Remote Exports</h3>
|
|
87
|
-
</div>
|
|
88
|
-
|
|
89
|
-
<div className="col col-4">
|
|
90
|
-
<ButtonsContainer>
|
|
91
|
-
{loading && (
|
|
92
|
-
<InProgressMessage>Your export is starting.</InProgressMessage>
|
|
93
|
-
)}
|
|
94
|
-
{error && <ErrorMessage>An error has occurred.</ErrorMessage>}
|
|
95
|
-
{success && (
|
|
96
|
-
<SuccessMessage>Your export has begun.</SuccessMessage>
|
|
97
|
-
)}
|
|
98
|
-
<NormalizedButton
|
|
99
|
-
className="n-button on-button--primary"
|
|
100
|
-
onClick={() =>
|
|
101
|
-
reexportRemotes({ variables: { datasetId: dataset.id } })
|
|
102
|
-
}>
|
|
103
|
-
Run Export
|
|
104
|
-
</NormalizedButton>
|
|
105
|
-
<Divider text="or" />
|
|
106
|
-
<NormalizedButton
|
|
107
|
-
className="on-button on-button--nobg"
|
|
108
|
-
onClick={() => {
|
|
109
|
-
window.open(reexporterLogsURL, '_blank')
|
|
110
|
-
}}>
|
|
111
|
-
View Export Logs
|
|
112
|
-
</NormalizedButton>
|
|
113
|
-
</ButtonsContainer>
|
|
114
|
-
</div>
|
|
115
|
-
<div className="col col-12 m-t-20">
|
|
116
|
-
<Link className="return-link m-l-0 " to={`/datasets/${dataset.id}`}>
|
|
117
|
-
Return to Dataset
|
|
118
|
-
</Link>
|
|
119
|
-
</div>
|
|
120
|
-
</div>
|
|
121
|
-
</div>
|
|
122
|
-
</>
|
|
123
|
-
)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
AdminExports.propTypes = {
|
|
127
|
-
dataset: PropTypes.object,
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export default AdminExports
|