Revert "WIP add test buttons to alert handler config sections"
This reverts commit dce542c74f
.
pull/10616/head
parent
dce542c74f
commit
6d62350400
|
@ -2,11 +2,7 @@ import React, {Component, PropTypes} from 'react'
|
|||
import _ from 'lodash'
|
||||
|
||||
import {Tab, Tabs, TabPanel, TabPanels, TabList} from 'shared/components/Tabs'
|
||||
import {
|
||||
getKapacitorConfig,
|
||||
updateKapacitorConfigSection,
|
||||
testAlertOutput,
|
||||
} from 'shared/apis'
|
||||
import {getKapacitorConfig, updateKapacitorConfigSection} from 'shared/apis'
|
||||
|
||||
import {
|
||||
AlertaConfig,
|
||||
|
@ -92,22 +88,6 @@ class AlertTabs extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleTestConfig = section => () => {
|
||||
testAlertOutput(this.props.kapacitor, section, {})
|
||||
.then(() => {
|
||||
this.props.addFlashMessage({
|
||||
type: 'success',
|
||||
text: `Successfully relayed an alert to ${section}.`,
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
this.props.addFlashMessage({
|
||||
type: 'error',
|
||||
text: `There was an error relaying an alert to ${section}.`,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
sanitizeProperties = (section, properties) => {
|
||||
const cleanProps = {...properties, enabled: true}
|
||||
const {redacted} = this.getSection(this.state.configSections, section)
|
||||
|
@ -136,7 +116,6 @@ class AlertTabs extends Component {
|
|||
<AlertaConfig
|
||||
onSave={this.handleSaveConfig('alerta')}
|
||||
config={this.getSection(configSections, 'alerta')}
|
||||
onTest={this.handleTestConfig('alerta')}
|
||||
/>,
|
||||
},
|
||||
hipchat: {
|
||||
|
@ -146,7 +125,6 @@ class AlertTabs extends Component {
|
|||
<HipChatConfig
|
||||
onSave={this.handleSaveConfig('hipchat')}
|
||||
config={this.getSection(configSections, 'hipchat')}
|
||||
onTest={this.handleTestConfig('hipchat')}
|
||||
/>,
|
||||
},
|
||||
opsgenie: {
|
||||
|
@ -156,7 +134,6 @@ class AlertTabs extends Component {
|
|||
<OpsGenieConfig
|
||||
onSave={this.handleSaveConfig('opsgenie')}
|
||||
config={this.getSection(configSections, 'opsgenie')}
|
||||
onTest={this.handleTestConfig('opsgenie')}
|
||||
/>,
|
||||
},
|
||||
pagerduty: {
|
||||
|
@ -166,7 +143,6 @@ class AlertTabs extends Component {
|
|||
<PagerDutyConfig
|
||||
onSave={this.handleSaveConfig('pagerduty')}
|
||||
config={this.getSection(configSections, 'pagerduty')}
|
||||
onTest={this.handleTestConfig('pagerduty')}
|
||||
/>,
|
||||
},
|
||||
pushover: {
|
||||
|
@ -176,7 +152,6 @@ class AlertTabs extends Component {
|
|||
<PushoverConfig
|
||||
onSave={this.handleSaveConfig('pushover')}
|
||||
config={this.getSection(configSections, 'pushover')}
|
||||
onTest={this.handleTestConfig('pushover')}
|
||||
/>,
|
||||
},
|
||||
sensu: {
|
||||
|
@ -186,7 +161,6 @@ class AlertTabs extends Component {
|
|||
<SensuConfig
|
||||
onSave={this.handleSaveConfig('sensu')}
|
||||
config={this.getSection(configSections, 'sensu')}
|
||||
onTest={this.handleTestConfig('sensu')}
|
||||
/>,
|
||||
},
|
||||
slack: {
|
||||
|
@ -196,7 +170,6 @@ class AlertTabs extends Component {
|
|||
<SlackConfig
|
||||
onSave={this.handleSaveConfig('slack')}
|
||||
config={this.getSection(configSections, 'slack')}
|
||||
onTest={this.handleTestConfig('slack')}
|
||||
/>,
|
||||
},
|
||||
smtp: {
|
||||
|
@ -206,7 +179,6 @@ class AlertTabs extends Component {
|
|||
<SMTPConfig
|
||||
onSave={this.handleSaveConfig('smtp')}
|
||||
config={this.getSection(configSections, 'smtp')}
|
||||
onTest={this.handleTestConfig('smtp')}
|
||||
/>,
|
||||
},
|
||||
talk: {
|
||||
|
@ -216,7 +188,6 @@ class AlertTabs extends Component {
|
|||
<TalkConfig
|
||||
onSave={this.handleSaveConfig('talk')}
|
||||
config={this.getSection(configSections, 'talk')}
|
||||
onTest={this.handleTestConfig('talk')}
|
||||
/>,
|
||||
},
|
||||
telegram: {
|
||||
|
@ -226,7 +197,6 @@ class AlertTabs extends Component {
|
|||
<TelegramConfig
|
||||
onSave={this.handleSaveConfig('telegram')}
|
||||
config={this.getSection(configSections, 'telegram')}
|
||||
onTest={this.handleTestConfig('telegram')}
|
||||
/>,
|
||||
},
|
||||
victorops: {
|
||||
|
@ -236,7 +206,6 @@ class AlertTabs extends Component {
|
|||
<VictorOpsConfig
|
||||
onSave={this.handleSaveConfig('victorops')}
|
||||
config={this.getSection(configSections, 'victorops')}
|
||||
onTest={this.handleTestConfig('victorops')}
|
||||
/>,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -66,11 +66,6 @@ class SlackConfig extends Component {
|
|||
Update Slack Config
|
||||
</button>
|
||||
</div>
|
||||
<br />
|
||||
<br />
|
||||
<div className="col-xs-12 text-center" onClick={this.props.onTest}>
|
||||
❤️❤️❤️❤️Test Slack Config❤️❤️❤️❤️
|
||||
</div>
|
||||
</form>
|
||||
)
|
||||
}
|
||||
|
@ -86,7 +81,6 @@ SlackConfig.propTypes = {
|
|||
}).isRequired,
|
||||
}).isRequired,
|
||||
onSave: func.isRequired,
|
||||
onTest: func,
|
||||
}
|
||||
|
||||
export default SlackConfig
|
||||
|
|
|
@ -159,7 +159,12 @@ export function testAlertOutput(kapacitor, outputName, properties) {
|
|||
'/kapacitor/v1/service-tests'
|
||||
).then(({data: {services}}) => {
|
||||
const service = services.find(s => s.name === outputName)
|
||||
return kapacitorProxy(kapacitor, 'POST', service.link.href, {})
|
||||
return kapacitorProxy(
|
||||
kapacitor,
|
||||
'POST',
|
||||
service.link.href,
|
||||
Object.assign({}, service.options, properties)
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue