Commit 426ec6f2 authored by Maxime Chaillet's avatar Maxime Chaillet

Merge branch 'issue167' into 'master'

Issue167

Closes #167

See merge request !154
parents b9de9b05 a843785b
Pipeline #11591 passed with stages
in 6 minutes and 45 seconds
......@@ -17,7 +17,7 @@ class EventHistory extends React.Component {
<OverlayTrigger
trigger='click' placement='top' overlay={eventVersionsPopover(this.props.event)} rootClose={true} >
<div>
<LabeledElement data={null} type='text' labelText={<span> History <div className='arrow-down' /> </span>} />
<LabeledElement data={null} hasNoData={true} type='text' labelText={<span> History <div className='arrow-down' /> </span>} />
</div>
</OverlayTrigger>
</div>);
......
......@@ -69,7 +69,7 @@ class EventListMenu extends React.Component {
bsStyle={'primary'}
title={'View'}
bsSize='small'>
<MenuItem eventKey="1" onSelect={() => setView(DOC_VIEW)} > {view === DOC_VIEW ? <Radio checked> Classic (user's commented logs)</Radio> : <Radio checked={false}> Classic (user's commented logs)</Radio>} </MenuItem>
<MenuItem eventKey="1" onSelect={() => setView(DOC_VIEW)} > {view === DOC_VIEW ? <Radio checked> Classic (user logs)</Radio> : <Radio checked={false}> Classic (user logs)</Radio>} </MenuItem>
<MenuItem eventKey="2" onSelect={() => setView(LIST_VIEW)} > {view === LIST_VIEW ? <Radio checked> Full (all logs)</Radio> : <Radio checked={false}> Full (all logs)</Radio>} </MenuItem>
<MenuItem divider />
<MenuItem eventKey="3" onSelect={() => this.sortByDate(SORT_EVENTS_FROM_OLDEST)} > {getCurrentlyPressedSortButton() === SORT_EVENTS_FROM_OLDEST ? <Radio checked> Oldest log on top</Radio> : <Radio checked={false}> Oldest log on top</Radio>} </MenuItem>
......
......@@ -14,7 +14,8 @@ class LabeledElement extends React.Component {
}
render() {
let { type, data, labelText, setTitleInput, tooltip } = this.props;
let { data, hasNoData, labelText, setTitleInput, tooltip, type } = this.props;
if (type === 'input') {
return (
<OverlayTrigger
......@@ -45,7 +46,11 @@ class LabeledElement extends React.Component {
return (<Overlay {...this.props}>
<div>
<Label> {labelText} </Label>
<div style={{ paddingTop: '5px', paddingLeft: '10px', color: '#666666', display: 'inline-block' }}> {data} </div>
{(hasNoData === true || (hasNoData === false && data)) ?
<div style={{ paddingTop: '5px', paddingLeft: '10px', color: '#666666', display: 'inline-block' }}> {data} </div>
:
<div style={{ paddingTop: '5px', paddingLeft: '10px', color: '#888888', display: 'inline-block', fontStyle: 'italic' }}> Not available </div>
}
</div>
</Overlay>);
}
......@@ -65,6 +70,8 @@ export default LabeledElement;
LabeledElement.proptypes = {
/** data to render */
data: Proptypes.string,
/** whehther data are provided or not */
hasNoData: Proptypes.bool.isRequired,
/** Text of the label */
labelText: Proptypes.string,
/** callback function triggered when user changed the data of the event */
......
......@@ -116,7 +116,7 @@ class Event extends React.Component {
<LazyContentEvent event={event} />
{event.events && this.state.collapsed ? <Label style={{ color: "blue", backgroundColor: "white", cursor: "pointer" }} onClick={this.handleClick} >.... {event.events.length} command lines more</Label> : null}
</td>
<td classNmae='eventActionBox' style={{ width: '50px', border: 0 }}>
<td className='eventActionBox' style={{ width: '50px', border: 0 }}>
<Button bsStyle="link" bsSize="small" style={{ padding: '0px' }} onClick={() => this.props.onEventClicked(event)}>
<Glyphicon glyph={getPreviousVersionNumber(event) === 0 ? 'plus' : 'edit'} style={{ width: '40px', position: 'static' }} />
</Button>
......
......@@ -25,7 +25,7 @@ class NewOrEditEventPanel extends React.Component {
}
}
render() {
let { event, user, context, investigationId, setEditEventVisibility } = this.props;
let { event, user, context, investigationId } = this.props;
return (
<Panel bsStyle='primary' style={{ marginBottom: '0px', height: '100%', position: 'relative' }}>
<EventHeader context={context} />
......@@ -271,13 +271,13 @@ NewOrEditEventPanel.propTypes = {
/* User who is using this component */
user: PropTypes.object,
/* Callback used to request an event update on the server side */
updateEvent: PropTypes.object
updateEvent: PropTypes.func
}
/** React component which represents the creation date part. */
const CreationDate = (props) => {
if (props.event) {
return (<LabeledElement data={getEventCreationDate(getOriginalEvent(props.event))} type='text' labelText='Creation date' tooltip={<p> Event created on {getEventHistoryCreationDate(getOriginalEvent(props.event))} </p>} />);
return (<LabeledElement data={getEventCreationDate(getOriginalEvent(props.event))} hasNoData={false} type='text' labelText='Creation date' tooltip={<p> Event created on {getEventHistoryCreationDate(getOriginalEvent(props.event))} </p>} />);
}
return null;
}
......@@ -289,10 +289,10 @@ const CreationDate = (props) => {
const CommentBy = (props) => {
if (props.event) {
if (getPreviousVersionNumber(props.event) === 0) {
return (<LabeledElement data={props.event.username} type='text' labelText='Created by' tooltip='Author of the event' />);
return (<LabeledElement data={props.event.username} hasNoData={false} type='text' labelText='Created by' tooltip='Author of the event' />);
};
if (getPreviousVersionNumber(props.event) !== 0) {
return (<LabeledElement data={props.event.username} type='text' labelText='Commented by' tooltip='Author of the comment' />);
return (<LabeledElement data={props.event.username} hasNoData={false} type='text' labelText='Commented by' tooltip='Author of the comment' />);
};
}
return null;
......
......@@ -13,7 +13,7 @@ class NewOrEditTagPanel extends React.Component {
constructor(props) {
super(props);
this.state = {
tag: this.props.tag || { name: '', description: '', color: GUI_CONFIG().DEFAULT_TAG_COLOR, investigationId: this.props.investigationId },
tag: _.cloneDeep(this.props.tag) || { name: '', description: '', color: GUI_CONFIG().DEFAULT_TAG_COLOR, investigationId: this.props.investigationId },
};
this.onChangeComplete = this.onChangeComplete.bind(this);
......
......@@ -137,10 +137,10 @@ class TagContainer extends React.Component {
this.isGettingSelectedTagsFromEventProp = false;
this.setSelectedTagsFromProps();
}
else {
this.getTagsByInvestigationId(onSuccess, onError); //fetch available tags.
};
}
else {
this.getTagsByInvestigationId(onSuccess, onError); //fetch available tags.
};
}
componentDidUpdate() {
......@@ -297,12 +297,17 @@ class TagContainer extends React.Component {
Promise.all(promises)
.then((results) => {
let availableTags = _.cloneDeep(this.props.availableTags);
results.forEach((data) => {
console.log('The tag ' + data.name + ' was successfully updated on ICAT+ server.');
console.log('The tag ' + data.data.name + ' was successfully updated on ICAT+ server.');
let tagToBeUpdated = _.find(availableTags, (tag) => { return _.isEqual(tag._id, data.data._id) });
_.remove(availableTags, (tag) => { return _.isEqual(tag, tagToBeUpdated) });
availableTags.push(data.data);
});
this.props.setAvailableTags(availableTags);
this.setMessage(INFO_MESSAGE_TYPE, 'Tags was successfully updated');
this.setState({ context: TAG_MANAGER_CONTEXT });
})
.catch((error) => {
console.log('[ERROR] At least one tag could not be updated. The error is : ' + error);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment