Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ICAT
Datahub
Commits
ac453f01
Commit
ac453f01
authored
Jul 22, 2021
by
Alejandro De Maria Antolinos
Browse files
Merge branch 'issue_518' into 'master'
It fixes
#518
Closes
#518
See merge request
!536
parents
67701d7c
51ce8acf
Pipeline
#51124
passed with stages
in 14 minutes and 29 seconds
Changes
7
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/components/Investigation/InvestigationTable.js
View file @
ac453f01
...
...
@@ -12,6 +12,7 @@ import {
datasetCountFormatter
,
fileCountFormatter
,
dateFormatter
,
userPortalLinkFormatter
,
}
from
'
./utils
'
;
import
InvestigationDateFilter
from
'
./InvestigationDateFilter
'
;
import
styles
from
'
./InvestigationTable.module.css
'
;
...
...
@@ -29,7 +30,12 @@ function getLgHeaderStyle(width, hidden) {
};
}
function
getColumns
({
showProposalLinks
,
showInvestigationStats
,
showFiles
})
{
function
getColumns
({
showProposalLinks
,
showInvestigationStats
,
showFiles
,
withUserPortalLink
,
})
{
return
[
{
text
:
'
id
'
,
...
...
@@ -66,6 +72,7 @@ function getColumns({ showProposalLinks, showInvestigationStats, showFiles }) {
lg
:
{
width
:
140
,
textAlign
:
'
center
'
},
},
},
{
text
:
'
Beamline
'
,
dataField
:
'
visitId
'
,
...
...
@@ -90,12 +97,6 @@ function getColumns({ showProposalLinks, showInvestigationStats, showFiles }) {
sort
:
true
,
responsiveHeaderStyle
:
getLgHeaderStyle
(
110
,
false
),
},
{
text
:
'
Summary
'
,
dataField
:
'
summary
'
,
sort
:
true
,
hidden
:
true
,
},
// See https://gitlab.esrf.fr/icat/E-DataPortal/-/issues/439
{
text
:
'
Title
'
,
...
...
@@ -110,6 +111,21 @@ function getColumns({ showProposalLinks, showInvestigationStats, showFiles }) {
sm
:
{
hidden
:
true
},
},
},
{
text
:
'
A-Form
'
,
dataField
:
'
userPortal
'
,
formatter
:
(
_
,
investigation
)
=>
{
return
userPortalLinkFormatter
(
investigation
,
120
);
},
sort
:
true
,
headerStyle
:
()
=>
({
width
:
'
50%
'
,
textAlign
:
'
center
'
}),
responsiveHeaderStyle
:
{
xs
:
{
hidden
:
!
withUserPortalLink
},
sm
:
{
hidden
:
!
withUserPortalLink
},
md
:
{
width
:
140
,
textAlign
:
'
center
'
,
hidden
:
!
withUserPortalLink
},
lg
:
{
width
:
140
,
textAlign
:
'
center
'
,
hidden
:
!
withUserPortalLink
},
},
},
{
text
:
'
Datasets
'
,
dataField
:
'
datasets
'
,
...
...
@@ -153,6 +169,7 @@ function InvestigationTable(props) {
withInvestigationStats
=
false
,
showStatisticsMenu
=
false
,
instrumentName
,
withUserPortalLink
=
false
,
}
=
props
;
const
user
=
useSelector
((
state
)
=>
state
.
user
);
...
...
@@ -257,6 +274,7 @@ function InvestigationTable(props) {
showProposalLinks
:
withProposalLinks
||
isAdministrator
,
showInvestigationStats
:
withInvestigationStats
||
isAdministrator
,
showFiles
:
isAdministrator
,
withUserPortalLink
:
withUserPortalLink
||
isAdministrator
,
})}
expandRow
=
{
expandRow
}
/
>
...
...
src/components/Investigation/utils.js
View file @
ac453f01
...
...
@@ -21,6 +21,7 @@ import {
}
from
'
../../constants
'
;
import
DOIBadge
from
'
../doi/DOIBadge
'
;
import
{
stringifyBytesSize
}
from
'
../../helpers
'
;
import
UI
from
'
../../config/ui
'
;
export
function
startDateFormatter
(
investigation
)
{
function
getDateFormat
(
date
,
dateFormat
,
timeFormat
,
title
)
{
...
...
@@ -84,6 +85,27 @@ export function dateFormatter(date, format, hasIcon) {
);
}
/**
* This method checks if there is a pk to the user portal and a link then it will return a link to the user portal
* @param {*} investigation
* @param {*} link
*/
export
function
userPortalLinkFormatter
(
investigation
,
width
)
{
if
(
investigation
?.
parameters
?.[
UI
.
userPortal
.
investigationParameterPkName
])
{
const
link
=
UI
.
userPortal
.
link
+
investigation
.
parameters
[
UI
.
userPortal
.
investigationParameterPkName
];
return
(
<
Button
style
=
{{
width
,
textAlign
:
'
left
'
}}
bsSize
=
"
xsmall
"
>
<
a
href
=
{
link
}
target
=
"
_blank
"
rel
=
"
noopener noreferrer
"
>
<
Glyphicon
glyph
=
"
list-alt
"
/>
<
span
style
=
{{
marginLeft
:
10
}}
>
{
investigation
.
name
}
<
/span
>
<
/a
>
<
/Button
>
);
}
}
export
function
beamlineFormatter
(
investigation
)
{
try
{
return
(
investigation
?.
instrument
?.
name
||
''
).
toUpperCase
();
...
...
src/components/Parcels/ParcelTable.js
View file @
ac453f01
...
...
@@ -182,7 +182,6 @@ function ParcelTable(props) {
columns
=
{
columnsWithHandles
}
search
=
{{
defaultSearch
:
searchFilter
,
searchFormatted
:
true
}}
onSearch
=
{
handleSearchFilterChange
}
rowEvents
=
{{
onClick
:
(
_
,
parcel
)
=>
handleView
(
parcel
)
}}
rowClasses
=
{
styles
.
clickable
}
pageOptions
=
{{
showTotal
:
true
,
...
...
src/components/Shipping/ParcelColumns.js
View file @
ac453f01
import
React
from
'
react
'
;
import
ParcelCondensedView
from
'
../Parcels/ParcelCondensedView
'
;
import
{
beamlineFormatter
,
startDateFormatter
}
from
'
../Investigation/utils
'
;
import
{
userPortalLinkFormatter
,
beamlineFormatter
,
startDateFormatter
,
nameFormatter
,
}
from
'
../Investigation/utils
'
;
import
styles
from
'
./ParcelSection.module.css
'
;
import
{
STATUS_DEFS
}
from
'
../../constants/parcelStatuses
'
;
import
{
itemsFormatter
}
from
'
../../helpers
'
;
import
UI
from
'
../../config/ui
'
;
const
ParcelColumns
=
[
{
text
:
''
,
dataField
:
'
_id
'
,
hidden
:
true
,
searchable
:
false
},
...
...
@@ -32,15 +38,30 @@ const ParcelColumns = [
},
{
text
:
'
Proposal
'
,
dataField
:
'
investigationName
'
,
dataField
:
'
experiment
'
,
formatter
:
(
_
,
parcel
)
=>
nameFormatter
(
parcel
.
investigation
,
true
),
sort
:
true
,
responsiveHeaderStyle
:
{
xs
:
{
hidden
:
true
},
sm
:
{
hidden
:
true
},
md
:
{
width
:
150
},
lg
:
{
width
:
150
},
xs
:
{
width
:
150
,
hidden
:
UI
.
userPortal
.
isLinkEnabled
},
sm
:
{
width
:
150
,
hidden
:
UI
.
userPortal
.
isLinkEnabled
},
md
:
{
width
:
150
,
hidden
:
UI
.
userPortal
.
isLinkEnabled
},
lg
:
{
width
:
150
,
hidden
:
UI
.
userPortal
.
isLinkEnabled
},
},
},
{
text
:
'
A-Form
'
,
dataField
:
'
userPortal
'
,
width
:
150
,
formatter
:
(
_
,
parcel
)
=>
userPortalLinkFormatter
(
parcel
.
investigation
,
120
),
responsiveHeaderStyle
:
{
xs
:
{
width
:
140
,
hidden
:
!
UI
.
userPortal
.
isLinkEnabled
},
sm
:
{
width
:
140
,
hidden
:
!
UI
.
userPortal
.
isLinkEnabled
},
md
:
{
width
:
140
,
hidden
:
!
UI
.
userPortal
.
isLinkEnabled
},
lg
:
{
width
:
140
,
hidden
:
!
UI
.
userPortal
.
isLinkEnabled
},
},
},
{
text
:
'
Beamline
'
,
dataField
:
'
beamline
'
,
...
...
src/config/ui.js
View file @
ac453f01
...
...
@@ -23,6 +23,13 @@ const UI = {
usernameLabel
:
'
Username
'
,
ssoBtnLabel
:
'
Sign in with ESRF SSO
'
,
},
userPortal
:
{
isLinkEnabled
:
true
,
/** This is the name of the investigationParameter where it is stored the pk of the investigation in the User Portal */
investigationParameterPkName
:
'
Id
'
,
link
:
'
https://smis.esrf.fr/misapps/SMISWebClient/protected/aform/manageAForm.do?action=view&expSessionVO.pk=
'
,
},
investigationContainer
:
{
isDatasetListVisible
:
true
,
},
...
...
src/containers/BeamlineData/BeamlineDataTable.js
View file @
ac453f01
...
...
@@ -18,6 +18,7 @@ function BeamlineDataTable(props) {
withProposalLinks
showStatisticsMenu
=
{
showStatisticsMenu
}
instrumentName
=
{
name
}
withUserPortalLink
=
{
true
}
/
>
);
}
...
...
src/containers/MyData/MyInvestigationsTable.js
View file @
ac453f01
...
...
@@ -18,6 +18,7 @@ function MyInvestigationsTable() {
investigations
=
{
mySessions
}
withInvestigationStats
withProposalLinks
withUserPortalLink
=
{
true
}
/
>
);
}
...
...
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