From ccd29bf97ee74f6498ce68b7a5b7685063034621 Mon Sep 17 00:00:00 2001 From: Jared Scheib Date: Wed, 17 Jan 2018 14:55:04 -0800 Subject: [PATCH] Fix OpsGenieConfig delete handlers & standardize with TagInput's --- ui/src/kapacitor/components/config/OpsGenieConfig.js | 4 ++-- ui/src/shared/components/TagInput.js | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ui/src/kapacitor/components/config/OpsGenieConfig.js b/ui/src/kapacitor/components/config/OpsGenieConfig.js index 986bf28cbc..e7f55b0ea6 100644 --- a/ui/src/kapacitor/components/config/OpsGenieConfig.js +++ b/ui/src/kapacitor/components/config/OpsGenieConfig.js @@ -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 diff --git a/ui/src/shared/components/TagInput.js b/ui/src/shared/components/TagInput.js index 6646bb5166..59b0250c6f 100644 --- a/ui/src/shared/components/TagInput.js +++ b/ui/src/shared/components/TagInput.js @@ -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 (
@@ -39,7 +43,7 @@ class TagInput extends Component { ref={r => (this.input = r)} onKeyDown={this.handleAddTag} /> - +
) }