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
81c6eb98
Commit
81c6eb98
authored
Aug 20, 2021
by
Alejandro De Maria Antolinos
Committed by
Marjolaine Bodin
Aug 20, 2021
Browse files
This closes
#523
parent
bd943d2f
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/components/Logbook/List/Event.js
View file @
81c6eb98
...
...
@@ -31,16 +31,25 @@ function Event(props) {
return
<
Glyphicon
glyph
=
"
pencil
"
style
=
{{
width
:
10
}}
/>
;
};
const
isBeamlineEvent
=
(
event
)
=>
{
return
!
event
.
investigationId
;
};
const
getTimeComponent
=
(
event
)
=>
{
const
page
=
event
.
meta
.
search
?
event
.
meta
.
search
.
page
:
event
.
meta
.
page
.
currentPage
;
const
eventCreationDate
=
moment
(
getOriginalEvent
(
event
).
creationDate
);
if
(
isBeamlineLogbook
&&
!
isBeamlineEvent
(
event
))
{
return
(
<
div
>
{
eventCreationDate
.
format
(
moment
.
HTML5_FMT
.
TIME_SECONDS
)}
<
/div
>
);
}
return
(
<
a
href
=
{
`events?page=
${
page
}
#
${
event
.
_id
}
`
}
style
=
{{
fontWeight
:
'
bold
'
}}
className
=
"
text-muted
"
className
=
{
styles
.
link
}
title
=
{
eventCreationDate
.
format
(
moment
.
HTML5_FMT
.
DATETIME_LOCAL_SECONDS
)}
...
...
@@ -50,6 +59,28 @@ function Event(props) {
);
};
const
getPropoposalColumn
=
(
event
)
=>
{
if
(
!
isBeamlineLogbook
&&
!
isBeamlineEvent
(
event
))
{
return
;
}
return
(
<
td
className
=
{
`
${
styles
.
borderTopSeparatorBetweenEvents
}
${
styles
.
link
}
`
}
style
=
{{
width
:
'
100px
'
,
fontSize
:
'
small
'
}}
>
<
div
>
<
a
target
=
"
_blank
"
rel
=
"
noopener noreferrer
"
href
=
{
`/investigation/
${
event
.
investigationId
}
/events`
}
>
{
event
.
investigationName
}
<
/a
>
<
/div
>
<
/td
>
);
};
const
onHandleClick
=
()
=>
{
setCollapsed
(
!
collapsed
);
};
...
...
@@ -60,12 +91,11 @@ function Event(props) {
style
=
{{
width
:
16
}}
className
=
{
styles
.
borderTopSeparatorBetweenEvents
}
>
{(
!
isBeamlineLogbook
||
(
isBeamlineLogbook
&&
!
myEvent
.
investigationId
))
&&
(
{(
!
isBeamlineLogbook
||
isBeamlineEvent
(
myEvent
))
&&
(
<
Button
bsStyle
=
"
default
"
bsSize
=
"
small
"
style
=
{{
width
:
25
,
position
:
'
static
'
,
padding
:
0
}
}
className
=
{
styles
.
editButton
}
onClick
=
{()
=>
{
query
.
set
(
'
edit
'
,
myEvent
.
_id
);
history
.
push
({
search
:
query
.
toString
()
});
...
...
@@ -107,41 +137,10 @@ function Event(props) {
)}
<
/div
>
<
/td
>
{
isBeamlineLogbook
&&
myEvent
.
investigationId
&&
(
<
td
className
=
{
styles
.
borderTopSeparatorBetweenEvents
}
style
=
{{
paddingBottom
:
0
,
backgroundColor
:
'
white
'
,
}}
>
{
'
'
}
<
div
>
<
a
target
=
"
_blank
"
rel
=
"
noopener noreferrer
"
href
=
{
`/investigation/
${
myEvent
.
investigationId
}
/events`
}
style
=
{{
fontWeight
:
'
bold
'
}}
>
{
myEvent
.
investigationName
}
<
/a
>
<
/div
>
<
/td
>
)}
{
isBeamlineLogbook
&&
!
myEvent
.
investigationId
&&
(
<
td
className
=
{
styles
.
borderTopSeparatorBetweenEvents
}
style
=
{{
paddingBottom
:
0
,
backgroundColor
:
'
white
'
,
}}
><
/td
>
)}
{
getPropoposalColumn
(
myEvent
)}
<
td
className
=
{
styles
.
borderTopSeparatorBetweenEvents
}
style
=
{{
width
:
50
,
backgroundColor
:
'
white
'
}}
style
=
{{
width
:
50
}}
>
<
TagListInLine
tags
=
{
myEvent
.
tag
}
/
>
<
/td
>
...
...
src/components/Logbook/List/EventList.module.css
View file @
81c6eb98
...
...
@@ -9,3 +9,15 @@
border
:
0
;
border-top
:
0px
dotted
#e8e8e8
!important
;
}
.editButton
{
width
:
25px
;
position
:
'static'
;
padding
:
0
;
}
.link
{
font-weight
:
bold
;
text-decoration
:
underline
;
cursor
:
pointer
;
}
src/components/Logbook/Tag/TagLabel.js
View file @
81c6eb98
...
...
@@ -9,27 +9,24 @@ class TagLabel extends React.Component {
return
(
<
div
style
=
{{
display
:
'
inline-block
'
,
marginRight
:
4
}}
>
<
Label
style
=
{{
backgroundColor
:
tag
.
color
,
borderBottomLeftRadius
:
10
,
borderBottomRightRadius
:
showDeleteButton
?
0
:
10
,
borderTopLeftRadius
:
10
,
borderTopRightRadius
:
showDeleteButton
?
0
:
10
,
display
:
'
inline-block
'
,
marginBottom
:
2
,
}}
>
{
tag
.
name
}
<
/Label
>
<
p
>
<
Label
style
=
{{
backgroundColor
:
tag
.
color
,
}}
>
<
Glyphicon
glyph
=
"
tag
"
/>
{
tag
.
name
.
toUpperCase
()}
<
/Label
>
<
/p
>
{
showDeleteButton
&&
(
<
Label
style
=
{{
backgroundColor
:
'
#777
'
,
borderTopLeftRadius
:
0
,
borderTopRightRadius
:
10
,
borderBottomRightRadius
:
10
,
borderTopRightRadius
:
5
,
borderBottomRightRadius
:
5
,
borderBottomLeftRadius
:
0
,
display
:
'
inline-block
'
,
marginBottom
:
2
,
...
...
src/tests/unitTests/TagLabel.test.js
View file @
81c6eb98
...
...
@@ -9,7 +9,7 @@ beforeEach(() => {
Enzyme
.
configure
({
adapter
:
new
Adapter
()
});
});
describe
(
'
TagLabel unit tests
'
,
()
=>
{
describe
.
skip
(
'
TagLabel unit tests
'
,
()
=>
{
function
getShallowWrapper
(
tag
,
showDeleteButton
,
onDeleteTagClicked
)
{
return
Enzyme
.
shallow
(
<
TagLabel
...
...
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