Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Datahub
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
93
Issues
93
List
Boards
Labels
Service Desk
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ICAT
Datahub
Commits
d5538e06
Commit
d5538e06
authored
Sep 02, 2020
by
Axel Bocciarelli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Load data collections from Open Data page and remove badge
parent
667d1d51
Pipeline
#32593
passed with stage
in 4 minutes and 50 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
76 deletions
+51
-76
src/App.js
src/App.js
+0
-2
src/actions/datacollections.js
src/actions/datacollections.js
+1
-2
src/api/icat-plus/catalogue.js
src/api/icat-plus/catalogue.js
+2
-1
src/components/DataCollection/DataCollectionTable.js
src/components/DataCollection/DataCollectionTable.js
+15
-22
src/components/Menu/Menu.js
src/components/Menu/Menu.js
+0
-12
src/containers/DataCollectionsContainer.js
src/containers/DataCollectionsContainer.js
+0
-21
src/containers/OpenDataPage.js
src/containers/OpenDataPage.js
+33
-16
No files found.
src/App.js
View file @
d5538e06
...
...
@@ -28,7 +28,6 @@ import { doLogOut, doSilentRefreshFromSSO } from './actions/login';
import
keycloak
from
'
./keycloak
'
;
import
Menu
from
'
./components/Menu/Menu
'
;
import
{
fetchAllInvestigations
}
from
'
./actions/investigations
'
;
import
{
fetchDataCollections
}
from
'
./actions/datacollections
'
;
import
{
useQuery
}
from
'
./helpers/hooks
'
;
import
PageNotFound
from
'
./containers/PageNotFound
'
;
import
LoadingBoundary
from
'
./components/LoadingBoundary
'
;
...
...
@@ -47,7 +46,6 @@ function App() {
useEffect
(()
=>
{
if
(
user
.
sessionId
)
{
dispatch
(
fetchAllInvestigations
(
user
.
sessionId
));
dispatch
(
fetchDataCollections
(
user
.
sessionId
));
}
},
[
dispatch
,
user
.
sessionId
]);
...
...
src/actions/datacollections.js
View file @
d5538e06
import
axios
from
'
axios
'
;
import
{
getDataCollections
}
from
'
../api/icat-plus/catalogue
'
;
import
{
FETCH_DATACOLLECTIONS
}
from
'
../constants/actionTypes
'
;
export
function
fetchDataCollections
(
sessionId
)
{
return
{
type
:
FETCH_DATACOLLECTIONS
,
payload
:
axios
.
get
(
getDataCollections
(
sessionId
)
),
payload
:
getDataCollections
(
sessionId
),
};
}
src/api/icat-plus/catalogue.js
View file @
d5538e06
import
axios
from
'
axios
'
;
import
ICATPLUS
from
'
../../config/icatPlus
'
;
export
function
getFilesByDatasetId
(
sessionId
,
datasetIds
)
{
...
...
@@ -45,7 +46,7 @@ export function getDatasetStatus(sessionId, datasetIds) {
}
export
function
getDataCollections
(
sessionId
)
{
return
`
${
ICATPLUS
.
server
}
/catalogue/
${
sessionId
}
/datacollection`
;
return
axios
.
get
(
`
${
ICATPLUS
.
server
}
/catalogue/
${
sessionId
}
/datacollection`
)
;
}
export
function
getInvestigationUsersByInvestigationId
(
...
...
src/components/DataCollection/DataCollectionTable.js
View file @
d5538e06
...
...
@@ -15,15 +15,15 @@ class DataCollectionTable extends React.Component {
return
<
DOIBadge
doi
=
{
cell
}
/>
;
}
titleFormatter
(
cell
,
data
collection
)
{
const
title
=
data
collection
.
parameters
.
find
((
o
)
=>
o
.
name
===
TITLE
);
titleFormatter
(
_
,
collection
)
{
const
title
=
collection
.
parameters
.
find
((
o
)
=>
o
.
name
===
TITLE
);
if
(
title
&&
title
.
value
)
{
return
title
.
value
;
}
}
nameFormatter
(
cell
,
data
collection
)
{
const
names
=
data
collection
.
parameters
.
find
(
nameFormatter
(
_
,
collection
)
{
const
names
=
collection
.
parameters
.
find
(
(
o
)
=>
o
.
name
===
INVESTIGATION_NAMES
);
if
(
names
&&
names
.
value
)
{
...
...
@@ -38,7 +38,7 @@ class DataCollectionTable extends React.Component {
}
return
(
<
Link
to
=
{
`/public/
${
data
collection
.
doi
}
`
}
>
<
Link
to
=
{
`/public/
${
collection
.
doi
}
`
}
>
<
Button
bsSize
=
"
xsmall
"
style
=
{{
width
:
120
,
textAlign
:
'
left
'
}}
>
<
Glyphicon
glyph
=
"
circle-arrow-right
"
/>
<
span
style
=
{{
marginLeft
:
10
}}
>
{
short
}
<
/span
>
...
...
@@ -48,8 +48,8 @@ class DataCollectionTable extends React.Component {
}
}
beamlineFormatter
(
cell
,
data
collection
)
{
const
names
=
data
collection
.
parameters
.
find
(
beamlineFormatter
(
_
,
collection
)
{
const
names
=
collection
.
parameters
.
find
(
(
o
)
=>
o
.
name
===
INSTRUMENT_NAMES
);
if
(
names
&&
names
.
value
)
{
...
...
@@ -61,39 +61,35 @@ class DataCollectionTable extends React.Component {
return
<
Label
bsStyle
=
"
primary
"
>
RELEASED
<
/Label>
;
}
datasetCountFormmater
(
cell
,
datacolle
tion
)
{
return
datacolle
tion
.
dataCollectionDatasets
.
length
;
datasetCountFormmater
(
_
,
collec
tion
)
{
return
collec
tion
.
dataCollectionDatasets
.
length
;
}
dataCollectionFormatter
(
cell
,
datacolletion
,
rowIndex
,
extraData
)
{
dataCollectionFormatter
(
cell
,
collection
,
_
,
extraData
)
{
return
(
<
Grid
style
=
{{
textAlign
:
'
center
'
}}
>
<
Row
className
=
"
show-grid
"
>
<
Col
xs
=
{
12
}
md
=
{
12
}
>
{
extraData
.
nameFormatter
(
cell
,
datacolle
tion
,
extraData
)}
{
extraData
.
nameFormatter
(
cell
,
collec
tion
,
extraData
)}
<
/Col
>
<
/Row
>
<
Row
className
=
"
show-grid
"
>
<
Col
xs
=
{
12
}
md
=
{
12
}
>
{
extraData
.
beamlineFormatter
(
cell
,
datacolle
tion
,
extraData
)}
{
extraData
.
beamlineFormatter
(
cell
,
collec
tion
,
extraData
)}
<
/Col
>
<
/Row
>
<
Row
className
=
"
show-grid
"
>
<
Col
xs
=
{
12
}
>
<
div
style
=
{{
color
:
'
gray
'
,
fontStyle
:
'
italic
'
}}
>
{
'
'
}
{
extraData
.
titleFormatter
(
cell
,
datacolle
tion
,
extraData
)}
{
extraData
.
titleFormatter
(
cell
,
collec
tion
,
extraData
)}
<
/div
>
<
/Col
>
<
/Row
>
<
Row
className
=
"
show-grid
"
style
=
{{
fontSize
:
10
}}
>
<
Col
xs
=
{
12
}
>
<
span
>
{
extraData
.
doiFormatter
(
datacolletion
.
doi
,
datacolletion
,
extraData
)}
{
extraData
.
doiFormatter
(
collection
.
doi
,
collection
,
extraData
)}
<
/span
>
<
/Col
>
<
/Row
>
...
...
@@ -192,10 +188,7 @@ class DataCollectionTable extends React.Component {
render
()
{
return
(
<
ResponsiveTable
data
=
{
this
.
props
.
datacollections
}
columns
=
{
this
.
getColumns
()}
/
>
<
ResponsiveTable
data
=
{
this
.
props
.
data
}
columns
=
{
this
.
getColumns
()}
/
>
);
}
}
...
...
src/components/Menu/Menu.js
View file @
d5538e06
...
...
@@ -14,7 +14,6 @@ import styles from './Menu.module.css';
function
Menu
()
{
const
user
=
useSelector
((
state
)
=>
state
.
user
);
const
myInvestigations
=
useSelector
((
state
)
=>
state
.
myInvestigations
);
const
datacollections
=
useSelector
((
state
)
=>
state
.
datacollections
);
const
investigations
=
useSelector
((
state
)
=>
state
.
investigations
);
const
selection
=
useSelector
((
state
)
=>
state
.
selection
);
const
scientistInstrumentInvestigations
=
useSelector
(
...
...
@@ -86,17 +85,6 @@ function Menu() {
<
LinkContainer
to
=
"
/public
"
>
<
NavItem
eventKey
=
{
3
}
href
=
"
/public
"
>
Open
Data
{
datacollections
.
fetching
?
(
<
Glyphicon
style
=
{{
marginLeft
:
10
}}
className
=
"
spin
"
glyph
=
"
repeat
"
/>
)
:
(
<
span
className
=
"
badge
"
style
=
{{
marginLeft
:
10
}}
>
{
datacollections
.
data
.
length
}
<
/span
>
)}
<
/NavItem
>
<
/LinkContainer
>
)}
...
...
src/containers/DataCollectionsContainer.js
deleted
100644 → 0
View file @
667d1d51
import
React
from
'
react
'
;
import
{
useSelector
}
from
'
react-redux
'
;
import
DataCollectionTable
from
'
../components/DataCollection/DataCollectionTable
'
;
import
Loader
from
'
../components/Loader
'
;
function
DataCollectionsContainer
(
props
)
{
const
{
filterFunction
}
=
props
;
const
{
data
,
fetching
}
=
useSelector
((
state
)
=>
state
.
datacollections
);
if
(
fetching
)
{
return
<
Loader
inPanel
/>
;
}
return
(
<
DataCollectionTable
datacollections
=
{
filterFunction
?
filterFunction
(
data
)
:
data
}
/
>
);
}
export
default
DataCollectionsContainer
;
src/containers/OpenDataPage.js
View file @
d5538e06
import
React
,
{
useEffect
}
from
'
react
'
;
import
{
Panel
,
Glyphicon
}
from
'
react-bootstrap
'
;
import
InvestigationsContainer
from
'
./InvestigationsContainer
'
;
import
DataCollectionsContainer
from
'
./DataCollectionsContainer
'
;
import
{
useSelector
,
useDispatch
}
from
'
react-redux
'
;
import
{
setBreadCrumbs
}
from
'
../actions/breadcrumbs
'
;
import
Loader
from
'
../components/Loader
'
;
import
DataCollectionTable
from
'
../components/DataCollection/DataCollectionTable
'
;
import
{
fetchDataCollections
}
from
'
../actions/datacollections
'
;
function
OpenDataPage
()
{
const
sessionId
=
useSelector
((
state
)
=>
state
.
user
.
sessionId
);
const
{
data
,
fetching
,
fetched
}
=
useSelector
(
(
state
)
=>
state
.
datacollections
);
const
releasedInvestigations
=
useSelector
(
(
state
)
=>
state
.
releasedInvestigations
);
...
...
@@ -13,20 +19,23 @@ function OpenDataPage() {
useEffect
(()
=>
{
dispatch
(
setBreadCrumbs
([{
name
:
'
Open Data
'
}]));
},
[
dispatch
]);
const
filterPublications
=
(
data
)
=>
data
.
filter
((
o
)
=>
o
.
parameters
.
some
(
(
p
)
=>
p
.
name
===
'
instrumentNames
'
&&
p
.
value
!==
'
PUBLISHER
'
)
);
const
filterNotPublications
=
(
data
)
=>
data
.
filter
((
o
)
=>
o
.
parameters
.
some
(
(
p
)
=>
p
.
name
===
'
instrumentNames
'
&&
p
.
value
===
'
PUBLISHER
'
)
);
if
(
sessionId
&&
!
fetched
)
{
dispatch
(
fetchDataCollections
(
sessionId
));
}
},
[
dispatch
,
fetched
,
sessionId
]);
const
publications
=
data
?.
filter
((
collection
)
=>
collection
.
parameters
.
some
(
(
p
)
=>
p
.
name
===
'
instrumentNames
'
&&
p
.
value
!==
'
PUBLISHER
'
)
);
const
documents
=
data
?.
filter
((
collection
)
=>
collection
.
parameters
.
some
(
(
p
)
=>
p
.
name
===
'
instrumentNames
'
&&
p
.
value
===
'
PUBLISHER
'
)
);
return
(
<
div
className
=
"
app__inner
"
>
...
...
@@ -39,7 +48,11 @@ function OpenDataPage() {
<
/Panel.Heading
>
<
Panel
.
Body
>
<
DataCollectionsContainer
filterFunction
=
{
filterPublications
}
/
>
{
fetching
?
(
<
Loader
inPanel
message
=
"
Loading collections...
"
/>
)
:
(
<
DataCollectionTable
data
=
{
publications
}
/
>
)}
<
/Panel.Body
>
<
/Panel
>
...
...
@@ -52,7 +65,11 @@ function OpenDataPage() {
<
/Panel.Heading
>
<
Panel
.
Body
>
<
DataCollectionsContainer
filterFunction
=
{
filterNotPublications
}
/
>
{
fetching
?
(
<
Loader
inPanel
message
=
"
Loading documents...
"
/>
)
:
(
<
DataCollectionTable
data
=
{
documents
}
/
>
)}
<
/Panel.Body
>
<
/Panel
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment