diff --git a/ui/src/kapacitor/components/ValuesSection.js b/ui/src/kapacitor/components/ValuesSection.js index 2aa49a93c..eed2cc582 100644 --- a/ui/src/kapacitor/components/ValuesSection.js +++ b/ui/src/kapacitor/components/ValuesSection.js @@ -12,113 +12,104 @@ import {Tab, TabList, TabPanels, TabPanel, Tabs} from 'shared/components/Tabs' const TABS = ['Threshold', 'Relative', 'Deadman'] -export const ValuesSection = React.createClass({ - propTypes: { - rule: PropTypes.shape({ - id: PropTypes.string, - }).isRequired, - onChooseTrigger: PropTypes.func.isRequired, - onUpdateValues: PropTypes.func.isRequired, - query: PropTypes.shape({}).isRequired, - onDeadmanChange: PropTypes.func.isRequired, - onRuleTypeDropdownChange: PropTypes.func.isRequired, - onRuleTypeInputChange: PropTypes.func.isRequired, - onAddEvery: PropTypes.func.isRequired, - onRemoveEvery: PropTypes.func.isRequired, - timeRange: PropTypes.shape({}).isRequired, - queryConfigActions: PropTypes.shape({}).isRequired, - source: PropTypes.shape({}).isRequired, - }, +const handleChooseTrigger = (rule, onChooseTrigger) => { + if (TABS[triggerIndex] === rule.trigger) { + return + } + return onChooseTrigger(rule.id, TABS[triggerIndex]) +} +const initialIndex = rule => TABS.indexOf(_.startCase(rule.trigger)) +const isDeadman = rule => rule.trigger === 'deadman' - render() { - const { - rule, - query, - source, - timeRange, - onAddEvery, - onRemoveEvery, - onDeadmanChange, - queryConfigActions, - onRuleTypeInputChange, - onRuleTypeDropdownChange, - } = this.props - const initialIndex = TABS.indexOf(_.startCase(rule.trigger)) - const isDeadman = rule.trigger === 'deadman' - - return ( -