Merge pull request #2757 from influxdata/bugfix/kapacitor-test-button-errors-SMTP
Bugfix/kapacitor test button errors smtppull/10616/head
commit
66f2a48540
|
@ -16,6 +16,7 @@
|
|||
### Bug Fixes
|
||||
1. [#2684](https://github.com/influxdata/chronograf/pull/2684): Fix TICKscript Sensu alerts when no group by tags selected
|
||||
1. [#2735](https://github.com/influxdata/chronograf/pull/2735): Remove cli options from systemd service file
|
||||
1. [#2757](https://github.com/influxdata/chronograf/pull/2757): Added "TO" field to kapacitor SMTP config, and improved error messages for config saving and testing
|
||||
1. [#2761](https://github.com/influxdata/chronograf/pull/2761): Remove cli options from sysvinit service file
|
||||
|
||||
## v1.4.0.1 [2017-1-9]
|
||||
|
|
|
@ -84,11 +84,14 @@ class AlertTabs extends Component {
|
|||
type: 'success',
|
||||
text: `Alert configuration for ${section} successfully saved.`,
|
||||
})
|
||||
} catch (error) {
|
||||
return true
|
||||
} catch ({data: {error}}) {
|
||||
const errorMsg = _.join(_.drop(_.split(error, ': '), 2), ': ')
|
||||
this.props.addFlashMessage({
|
||||
type: 'error',
|
||||
text: `There was an error saving the alert configuration for ${section}.`,
|
||||
text: `There was an error saving the alert configuration for ${section}. ${errorMsg}`,
|
||||
})
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,11 +100,18 @@ class AlertTabs extends Component {
|
|||
e.preventDefault()
|
||||
|
||||
try {
|
||||
await testAlertOutput(this.props.kapacitor, section)
|
||||
const {data} = await testAlertOutput(this.props.kapacitor, section)
|
||||
if (data.success) {
|
||||
this.props.addFlashMessage({
|
||||
type: 'success',
|
||||
text: `Successfully triggered an alert to ${section}. If the alert does not reach its destination, please check your configuration settings.`,
|
||||
})
|
||||
} else {
|
||||
this.props.addFlashMessage({
|
||||
type: 'error',
|
||||
text: `There was an error sending an alert to ${section}: ${data.message}`,
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
this.props.addFlashMessage({
|
||||
type: 'error',
|
||||
|
|
|
@ -10,7 +10,7 @@ class AlertaConfig extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleSubmit = e => {
|
||||
handleSubmit = async e => {
|
||||
e.preventDefault()
|
||||
|
||||
const properties = {
|
||||
|
@ -20,9 +20,11 @@ class AlertaConfig extends Component {
|
|||
url: this.url.value,
|
||||
}
|
||||
|
||||
this.props.onSave(properties)
|
||||
const success = await this.props.onSave(properties)
|
||||
if (success) {
|
||||
this.setState({testEnabled: true})
|
||||
}
|
||||
}
|
||||
|
||||
disableTest = () => {
|
||||
this.setState({testEnabled: false})
|
||||
|
|
|
@ -12,7 +12,7 @@ class HipchatConfig extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleSubmit = e => {
|
||||
handleSubmit = async e => {
|
||||
e.preventDefault()
|
||||
|
||||
const properties = {
|
||||
|
@ -21,9 +21,11 @@ class HipchatConfig extends Component {
|
|||
token: this.token.value,
|
||||
}
|
||||
|
||||
this.props.onSave(properties)
|
||||
const success = await this.props.onSave(properties)
|
||||
if (success) {
|
||||
this.setState({testEnabled: true})
|
||||
}
|
||||
}
|
||||
|
||||
disableTest = () => {
|
||||
this.setState({testEnabled: false})
|
||||
|
|
|
@ -16,7 +16,7 @@ class OpsGenieConfig extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleSubmit = e => {
|
||||
handleSubmit = async e => {
|
||||
e.preventDefault()
|
||||
|
||||
const properties = {
|
||||
|
@ -25,9 +25,11 @@ class OpsGenieConfig extends Component {
|
|||
recipients: this.state.currentRecipients,
|
||||
}
|
||||
|
||||
this.props.onSave(properties)
|
||||
const success = await this.props.onSave(properties)
|
||||
if (success) {
|
||||
this.setState({testEnabled: true})
|
||||
}
|
||||
}
|
||||
|
||||
disableTest = () => {
|
||||
this.setState({testEnabled: false})
|
||||
|
|
|
@ -9,7 +9,7 @@ class PagerDutyConfig extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleSubmit = e => {
|
||||
handleSubmit = async e => {
|
||||
e.preventDefault()
|
||||
|
||||
const properties = {
|
||||
|
@ -17,9 +17,11 @@ class PagerDutyConfig extends Component {
|
|||
url: this.url.value,
|
||||
}
|
||||
|
||||
this.props.onSave(properties)
|
||||
const success = await this.props.onSave(properties)
|
||||
if (success) {
|
||||
this.setState({testEnabled: true})
|
||||
}
|
||||
}
|
||||
|
||||
disableTest = () => {
|
||||
this.setState({testEnabled: false})
|
||||
|
|
|
@ -13,7 +13,7 @@ class PushoverConfig extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleSubmit = e => {
|
||||
handleSubmit = async e => {
|
||||
e.preventDefault()
|
||||
|
||||
const properties = {
|
||||
|
@ -22,9 +22,11 @@ class PushoverConfig extends Component {
|
|||
'user-key': this.userKey.value,
|
||||
}
|
||||
|
||||
this.props.onSave(properties)
|
||||
const success = await this.props.onSave(properties)
|
||||
if (success) {
|
||||
this.setState({testEnabled: true})
|
||||
}
|
||||
}
|
||||
|
||||
disableTest = () => {
|
||||
this.setState({testEnabled: false})
|
||||
|
|
|
@ -8,27 +8,29 @@ class SMTPConfig extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleSubmit = e => {
|
||||
handleSubmit = async e => {
|
||||
e.preventDefault()
|
||||
|
||||
const properties = {
|
||||
host: this.host.value,
|
||||
port: this.port.value,
|
||||
from: this.from.value,
|
||||
to: this.to.value ? [this.to.value] : [],
|
||||
username: this.username.value,
|
||||
password: this.password.value,
|
||||
}
|
||||
|
||||
this.props.onSave(properties)
|
||||
const success = await this.props.onSave(properties)
|
||||
if (success) {
|
||||
this.setState({testEnabled: true})
|
||||
}
|
||||
}
|
||||
|
||||
disableTest = () => {
|
||||
this.setState({testEnabled: false})
|
||||
}
|
||||
|
||||
render() {
|
||||
const {host, port, from, username, password} = this.props.config.options
|
||||
const {host, port, from, username, password, to} = this.props.config.options
|
||||
|
||||
return (
|
||||
<form onSubmit={this.handleSubmit}>
|
||||
|
@ -56,7 +58,7 @@ class SMTPConfig extends Component {
|
|||
/>
|
||||
</div>
|
||||
|
||||
<div className="form-group col-xs-12">
|
||||
<div className="form-group col-xs-6">
|
||||
<label htmlFor="smtp-from">From Email</label>
|
||||
<input
|
||||
className="form-control"
|
||||
|
@ -69,6 +71,18 @@ class SMTPConfig extends Component {
|
|||
/>
|
||||
</div>
|
||||
|
||||
<div className="form-group col-xs-12 col-md-6">
|
||||
<label htmlFor="smtp-to">To Email</label>
|
||||
<input
|
||||
className="form-control"
|
||||
id="smtp-to"
|
||||
type="text"
|
||||
ref={r => (this.to = r)}
|
||||
defaultValue={to || ''}
|
||||
onChange={this.disableTest}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="form-group col-xs-12 col-md-6">
|
||||
<label htmlFor="smtp-user">User</label>
|
||||
<input
|
||||
|
|
|
@ -8,7 +8,7 @@ class SensuConfig extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleSubmit = e => {
|
||||
handleSubmit = async e => {
|
||||
e.preventDefault()
|
||||
|
||||
const properties = {
|
||||
|
@ -16,9 +16,11 @@ class SensuConfig extends Component {
|
|||
addr: this.addr.value,
|
||||
}
|
||||
|
||||
this.props.onSave(properties)
|
||||
const success = await this.props.onSave(properties)
|
||||
if (success) {
|
||||
this.setState({testEnabled: true})
|
||||
}
|
||||
}
|
||||
|
||||
disableTest = () => {
|
||||
this.setState({testEnabled: false})
|
||||
|
|
|
@ -10,15 +10,17 @@ class SlackConfig extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleSubmit = e => {
|
||||
handleSubmit = async e => {
|
||||
e.preventDefault()
|
||||
const properties = {
|
||||
url: this.url.value,
|
||||
channel: this.channel.value,
|
||||
}
|
||||
this.props.onSave(properties)
|
||||
const success = await this.props.onSave(properties)
|
||||
if (success) {
|
||||
this.setState({testEnabled: true})
|
||||
}
|
||||
}
|
||||
disableTest = () => {
|
||||
this.setState({testEnabled: false})
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ class TalkConfig extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleSubmit = e => {
|
||||
handleSubmit = async e => {
|
||||
e.preventDefault()
|
||||
|
||||
const properties = {
|
||||
|
@ -18,9 +18,11 @@ class TalkConfig extends Component {
|
|||
author_name: this.author.value,
|
||||
}
|
||||
|
||||
this.props.onSave(properties)
|
||||
const success = await this.props.onSave(properties)
|
||||
if (success) {
|
||||
this.setState({testEnabled: true})
|
||||
}
|
||||
}
|
||||
|
||||
disableTest = () => {
|
||||
this.setState({testEnabled: false})
|
||||
|
|
|
@ -12,7 +12,7 @@ class TelegramConfig extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleSubmit = e => {
|
||||
handleSubmit = async e => {
|
||||
e.preventDefault()
|
||||
|
||||
let parseMode
|
||||
|
@ -31,9 +31,11 @@ class TelegramConfig extends Component {
|
|||
token: this.token.value,
|
||||
}
|
||||
|
||||
this.props.onSave(properties)
|
||||
const success = await this.props.onSave(properties)
|
||||
if (success) {
|
||||
this.setState({testEnabled: true})
|
||||
}
|
||||
}
|
||||
|
||||
disableTest = () => {
|
||||
this.setState({testEnabled: false})
|
||||
|
|
|
@ -10,7 +10,7 @@ class VictorOpsConfig extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleSubmit = e => {
|
||||
handleSubmit = async e => {
|
||||
e.preventDefault()
|
||||
|
||||
const properties = {
|
||||
|
@ -19,9 +19,11 @@ class VictorOpsConfig extends Component {
|
|||
url: this.url.value,
|
||||
}
|
||||
|
||||
this.props.onSave(properties)
|
||||
const success = await this.props.onSave(properties)
|
||||
if (success) {
|
||||
this.setState({testEnabled: true})
|
||||
}
|
||||
}
|
||||
|
||||
disableTest = () => {
|
||||
this.setState({testEnabled: false})
|
||||
|
|
Loading…
Reference in New Issue