diff --git a/ui/src/kapacitor/components/AlertOutputs.js b/ui/src/kapacitor/components/AlertOutputs.js index 00dc83eea..869c2ffd8 100644 --- a/ui/src/kapacitor/components/AlertOutputs.js +++ b/ui/src/kapacitor/components/AlertOutputs.js @@ -2,6 +2,7 @@ import React, {PropTypes} from 'react'; import _ from 'lodash'; import {getKapacitorConfig, updateKapacitorConfigSection, testAlertOutput} from 'shared/apis'; import AlertaConfig from './AlertaConfig'; +import PagerdutyConfig from './PagerdutyConfig'; import SlackConfig from './SlackConfig'; import SMTPConfig from './SMTPConfig'; import TelegramConfig from './TelegramConfig'; @@ -38,6 +39,7 @@ const AlertOutputs = React.createClass({ getKapacitorConfig(this.props.kapacitor).then(({data: {sections}}) => { this.setState({ alertaConfig: this.getSection(sections, 'alerta'), + pagerdutyConfig: this.getSection(sections, 'pagerduty'), slackConfig: this.getSection(sections, 'slack'), smtpConfig: this.getSection(sections, 'smtp'), telegramConfig: this.getSection(sections, 'telegram'), @@ -96,6 +98,7 @@ const AlertOutputs = React.createClass({ + @@ -131,6 +134,10 @@ const AlertOutputs = React.createClass({ return ; } + if (endpoint === 'pagerduty' && this.state.pagerdutyConfig) { + return ; + } + return
This endpoint is not supported yet!
; }, }); diff --git a/ui/src/kapacitor/components/PagerdutyConfig.js b/ui/src/kapacitor/components/PagerdutyConfig.js new file mode 100644 index 000000000..1ee39cbc5 --- /dev/null +++ b/ui/src/kapacitor/components/PagerdutyConfig.js @@ -0,0 +1,78 @@ +import React, {PropTypes} from 'react'; + +const PagerdutyConfig = React.createClass({ + propTypes: { + config: PropTypes.shape({ + options: PropTypes.shape({ + global: PropTypes.bool.isRequired, + 'service-key': PropTypes.bool.isRequired, + url: PropTypes.string.isRequired, + }).isRequired, + }).isRequired, + onSave: PropTypes.func.isRequired, + }, + + handleSaveAlert(e) { + e.preventDefault(); + + const properties = { + global: this.global.checked, + serviceKey: this.serviceKey.value, + url: this.url.value, + }; + + this.props.onSave(properties); + }, + + render() { + const {options} = this.props.config; + const {global, url} = options; + const serviceKey = options['service-key']; + + return ( +
+

PagerDuty Alert

+
+
+
+
+

+ You can have alerts sent to PagerDuty by entering info below. +

+ +
+ + this.serviceKey = r} defaultValue={serviceKey || ''}> + Note: a value of true indicates the PagerDuty service key has been set +
+ +
+ + this.url = r} defaultValue={url || ''}> +
+ +
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+
+ ); + }, +}); + +export default PagerdutyConfig;