take onSave out of render and rename to handleSave

pull/10616/head
deniz kusefoglu 2018-02-08 12:27:04 -08:00
parent cc4b3c1bbc
commit 95c24ef14b
1 changed files with 10 additions and 9 deletions

View File

@ -75,6 +75,15 @@ class KapacitorRule extends Component {
})
}
handleSave = () => {
const {rule} = this.props
if (rule.id === DEFAULT_RULE_ID) {
this.handleCreate()
} else {
this.handleEdit()
}
}
handleSaveToConfig = configName => () => {
const {rule, configLink, router} = this.props
const pathname = `${configLink}#${configName}`
@ -161,19 +170,11 @@ class KapacitorRule extends Component {
const {chooseTrigger, updateRuleValues} = ruleActions
const {timeRange} = this.state
const onSave = () => {
if (rule.id === DEFAULT_RULE_ID) {
this.handleCreate()
} else {
this.handleEdit()
}
}
return (
<div className="page">
<RuleHeader
source={source}
onSave={onSave}
onSave={this.handleSave}
validationError={this.validationError()}
/>
<FancyScrollbar className="page-contents fancy-scroll--kapacitor">