Add email support for kapacitor alert config.

pull/10616/head
Hunter Trujillo 2017-02-09 22:30:50 -07:00
parent 54f66b43de
commit b962c5b4c5
2 changed files with 6 additions and 13 deletions

View File

@ -4,16 +4,18 @@ import ReactTooltip from 'react-tooltip';
import _ from 'lodash';
import {RULE_MESSAGE_TEMPLATES as templates} from '../constants/index.js';
const DEFAULT_ALERTS = ['http', 'tcp', 'exec'];
const DEFAULT_ALERTS = ['http', 'tcp', 'exec', 'smtp'];
const DEFAULT_ALERT_PLACEHOLDERS = {
http: 'URL',
tcp: 'Address',
exec: 'Add command with arguments separated by spaces',
smtp: 'Add email addresses separated by spaces',
};
const ALERT_NODES_ACCESSORS = {
http: (rule) => _.get(rule, 'alertNodes[0].args[0]', ''),
tcp: (rule) => _.get(rule, 'alertNodes[0].args[0]', ''),
exec: (rule) => _.get(rule, 'alertNodes[0].args', []).join(' '),
smtp: (rule) => _.get(rule, 'alertNodes[0].args', []).join(' '),
};
const {

View File

@ -79,20 +79,10 @@ export default function rules(state = {}, action) {
switch (alertType) {
case 'http':
alertNodesByType = [
{
name: 'http',
args: [
alertNodesText,
],
properties: [],
},
];
break;
case 'tcp':
alertNodesByType = [
{
name: 'tcp',
name: alertType,
args: [
alertNodesText,
],
@ -101,9 +91,10 @@ export default function rules(state = {}, action) {
];
break;
case 'exec':
case 'smtp':
alertNodesByType = [
{
name: 'exec',
name: alertType,
args: alertNodesText.split(' '),
properties: [],
},