diff --git a/ui/src/kapacitor/actions/view/index.js b/ui/src/kapacitor/actions/view/index.js index dfe45e9cb..1314fb335 100644 --- a/ui/src/kapacitor/actions/view/index.js +++ b/ui/src/kapacitor/actions/view/index.js @@ -169,16 +169,6 @@ export function updateAlertNodes(ruleID, alerts) { payload: {ruleID, alerts}, } } -// export function updateAlertNodes(ruleID, alertNodeName, alertNodesText) { -// return { -// type: 'UPDATE_RULE_ALERT_NODES', -// payload: { -// ruleID, -// alertNodeName, -// alertNodesText, -// }, -// } -// } export function updateRuleName(ruleID, name) { return { diff --git a/ui/src/kapacitor/components/RuleMessage.js b/ui/src/kapacitor/components/RuleMessage.js index 48f760cd2..496400891 100644 --- a/ui/src/kapacitor/components/RuleMessage.js +++ b/ui/src/kapacitor/components/RuleMessage.js @@ -57,11 +57,11 @@ class RuleMessage extends Component { handleAddEndpoint = selectedItem => { const {endpointsOnThisAlert, endpointsOfKind} = this.state - const newItemNumbering = _.get(endpointsOfKind, selectedItem.alias, 0) + 1 - const newItemName = selectedItem.alias + newItemNumbering + const newItemNumbering = _.get(endpointsOfKind, selectedItem.type, 0) + 1 + const newItemName = selectedItem.type + newItemNumbering const newEndpoint = { alias: newItemName, - type: selectedItem.alias, + type: selectedItem.type, ruleID: selectedItem.ruleID, } this.setState( diff --git a/ui/src/kapacitor/components/RuleMessageOptions.js b/ui/src/kapacitor/components/RuleMessageOptions.js index ec4a20061..0410003bc 100644 --- a/ui/src/kapacitor/components/RuleMessageOptions.js +++ b/ui/src/kapacitor/components/RuleMessageOptions.js @@ -1,4 +1,21 @@ import React, {Component, PropTypes} from 'react' +import { + HttpConfig, + TcpConfig, + ExecConfig, + LogConfig, + EmailConfig, + AlertaConfig, + HipchatConfig, + OpsgenieConfig, + PagerdutyConfig, + PushoverConfig, + SensuConfig, + SlackConfig, + TalkConfig, + TelegramConfig, + VictoropsConfig, +} from './configEP' import {RULE_ALERT_OPTIONS} from 'src/kapacitor/constants' @@ -7,118 +24,47 @@ class RuleMessageOptions extends Component { super(props) } - getAlertPropertyValue = name => { - const {rule} = this.props - const {properties} = rule.alertNodes[0] - - if (properties) { - const alertNodeProperty = properties.find( - property => property.name === name - ) - if (alertNodeProperty) { - return alertNodeProperty.args - } - } - return '' - } - - handleUpdateDetails = e => { - const {updateDetails, rule} = this.props - updateDetails(rule.id, e.target.value) - } - - handleUpdateAlertNodes = e => { - const {handleUpdateArg, selectedEndpoint} = this.props - handleUpdateArg(selectedEndpoint, e.target.value) - } - - handleUpdateAlertProperty = propertyName => e => { - const {updateAlertProperty, alertNode, rule} = this.props - updateAlertProperty(rule.id, alertNode, { - name: propertyName, - args: [e.target.value], - }) - } - render() { - const {rule, selectedEndpoint, handleEditAlert} = this.props - const {args, details, properties} = RULE_ALERT_OPTIONS[ - selectedEndpoint.type - ] - - return ( -
- {args - ?
-

Optional Alert Parameters:

-
-
- - -
-
-
- : null} - {properties && properties.length - ?
-

Optional Alert Parameters:

-
- {properties.map(({name: propertyName, label, placeholder}) => -
- - -
- )} -
-
- : null} - {details - ?
-