Fix OpsGenieConfig delete handlers & standardize with TagInput's

pull/10616/head
Jared Scheib 2018-01-17 14:55:04 -08:00
parent 81eea19400
commit ccd29bf97e
2 changed files with 8 additions and 4 deletions

View File

@ -37,13 +37,13 @@ class OpsGenieConfig extends Component {
})
}
handleDeleteTeam = team => () => {
handleDeleteTeam = team => {
this.setState({
currentTeams: this.state.currentTeams.filter(t => t !== team),
})
}
handleDeleteRecipient = recipient => () => {
handleDeleteRecipient = recipient => {
this.setState({
currentRecipients: this.state.currentRecipients.filter(
r => r !== recipient

View File

@ -18,12 +18,16 @@ class TagInput extends Component {
}
}
handleDeleteTag = item => {
this.props.onDeleteTag(item)
}
shouldAddToList(item, tags) {
return !_.isEmpty(item) && !tags.find(l => l === item)
}
render() {
const {title, tags, onDeleteTag} = this.props
const {title, tags} = this.props
return (
<div className="form-group col-xs-12">
@ -39,7 +43,7 @@ class TagInput extends Component {
ref={r => (this.input = r)}
onKeyDown={this.handleAddTag}
/>
<Tags tags={tags} onDeleteTag={onDeleteTag} />
<Tags tags={tags} onDeleteTag={this.handleDeleteTag} />
</div>
)
}