Update RuleMessage to remove anyonymous functions from props
parent
f29db011e5
commit
a70014352e
|
@ -12,9 +12,12 @@ class RuleMessageTemplates extends Component {
|
||||||
super(props)
|
super(props)
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
handleClickTemplate = template => () => {
|
||||||
const {rule, updateMessage} = this.props
|
const {updateMessage, rule} = this.props
|
||||||
|
updateMessage(rule.id, `${rule.message} ${template.label}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="rule-section--row rule-section--row-last rule-section--border-top">
|
<div className="rule-section--row rule-section--row-last rule-section--border-top">
|
||||||
<p>Templates:</p>
|
<p>Templates:</p>
|
||||||
|
@ -23,8 +26,7 @@ class RuleMessageTemplates extends Component {
|
||||||
<CodeData
|
<CodeData
|
||||||
key={key}
|
key={key}
|
||||||
template={template}
|
template={template}
|
||||||
onClickTemplate={() =>
|
onClickTemplate={this.handleClickTemplate(template)}
|
||||||
updateMessage(rule.id, `${rule.message} ${template.label}`)}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
|
|
|
@ -5,14 +5,18 @@ class RuleMessageText extends Component {
|
||||||
super(props)
|
super(props)
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
handleChange = e => {
|
||||||
const {rule, updateMessage} = this.props
|
const {rule, updateMessage} = this.props
|
||||||
|
updateMessage(rule, e.targe.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {rule} = this.props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<textarea
|
<textarea
|
||||||
className="form-control form-malachite monotype rule-builder--message"
|
className="form-control form-malachite monotype rule-builder--message"
|
||||||
ref={r => (this.message = r)}
|
onChange={this.handleChange}
|
||||||
onChange={() => updateMessage(rule.id, this.message.value)}
|
|
||||||
placeholder="Example: {{ .ID }} is {{ .Level }} value: {{ index .Fields "value" }}"
|
placeholder="Example: {{ .ID }} is {{ .Level }} value: {{ index .Fields "value" }}"
|
||||||
value={rule.message}
|
value={rule.message}
|
||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
|
|
Loading…
Reference in New Issue