Commit 53f43f83 authored by Maxime Chaillet's avatar Maxime Chaillet

Fix a bug when user edit and then create a new tag. Clean TagContainer.It...

Fix a bug when user edit and then create a new tag. Clean TagContainer.It fixes #176.
parent e19e9ffb
......@@ -46,7 +46,6 @@ class TagContainer extends React.Component {
}
render() {
let { investigationId } = this.props;
let userMessage = null;
if (this.state.message) {
......@@ -59,16 +58,6 @@ class TagContainer extends React.Component {
}
if (this.props.availableTagsReceptionStatus === FETCHED_STATUS) {
// if (this.state.context === BASIC_EVENT_CONTEXT) {
// return (<div>
// {userMessage}
// <TagList
// selectedTags={this.state.selectedTags}
// context={BASIC_EVENT_CONTEXT}
// />
// </div>);
// }
if (this.state.context === EDIT_EVENT_CONTEXT || this.state.context === NEW_EVENT_CONTEXT) {
return (
<div style={{ display: 'flex' }}>
......@@ -97,29 +86,28 @@ class TagContainer extends React.Component {
</div>);
}
if (this.state.context === EDIT_TAG_CONTEXT || this.state.context === NEW_TAG_CONTEXT) {
// if (this.state.selectedTags && this.state.selectedTags.length != 0) {
if (this.state.context === EDIT_TAG_CONTEXT) {
return (<div>
{userMessage}
<NewOrEditTagPanel
createNewTag={this.createNewTag}
panelHeaderText={this.state.context === NEW_TAG_CONTEXT ? 'New tag' : 'Editing tag'}
panelHeaderText={'Editing tag'}
showAvailableTags={this.showAvailableTags}
tag={this.state.selectedTags.length !== 0 ? this.state.selectedTags[0] : null}
updateTags={this.updateTags}
/>
</div>);
// } else {
// return (<div>
// {errorMessage}
// <TagList
// availableTags={this.props.availableTags}
// context={TAG_MANAGER_CONTEXT}
// investigationId={investigationId}
// updateTags={this.updateTags}
// />
// </div>)
// }
}
if (this.state.context === NEW_TAG_CONTEXT) {
return (<div>
{userMessage}
<NewOrEditTagPanel
createNewTag={this.createNewTag}
panelHeaderText={'New tag'}
showAvailableTags={this.showAvailableTags}
tag={null}
/>
</div>);
}
};
......@@ -160,10 +148,6 @@ class TagContainer extends React.Component {
};
};
};
// if (this.props.context === BASIC_EVENT_CONTEXT) {
// this.setSelectedTagsFromProps();
// };
}
/**
......@@ -180,27 +164,16 @@ class TagContainer extends React.Component {
};
}
/** callBack function triggered when an error occurs.
/** CallBack function triggered when an error occurs.
* @param {string} type type of error
* @param {string} text text of the message
* @param {string} context the context in which the container should enter (if provided)
*/
setMessage(type, message, context) {
if (context) {
this.setState({
message: {
type: type,
text: message,
context: context,
}
});
this.setState({ message: { type: type, text: message, context: context } });
} else {
this.setState({
message: {
type: type,
text: message
}
});
this.setState({ message: { type: type, text: message } });
};
}
......@@ -387,7 +360,4 @@ TagContainer.propTypes = {
setTagContainer: PropTypes.func,
};
export default connect(
mapStateToProps,
mapDispatchToProps,
)(TagContainer);
\ No newline at end of file
export default connect(mapStateToProps, mapDispatchToProps)(TagContainer);
\ No newline at end of file
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