Add error handling to kapacitor components

pull/10616/head
Brandon Farmer 2018-04-17 14:28:21 -07:00
parent f0645996da
commit 7c40496e2d
28 changed files with 66 additions and 10 deletions

View File

@ -31,7 +31,9 @@ import {
notifyTestAlertSent,
notifyTestAlertFailed,
} from 'shared/copy/notifications'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class AlertTabs extends Component {
constructor(props) {
super(props)

View File

@ -16,8 +16,10 @@ import {
TalkHandler,
TelegramHandler,
VictoropsHandler,
} from './handlers'
} from 'src/kapacitor/components/handlers'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class HandlerOptions extends Component {
constructor(props) {
super(props)

View File

@ -25,7 +25,9 @@ import {
notifyAlertRuleRequiresConditionValue,
notifyAlertRuleDeadmanInvalid,
} from 'shared/copy/notifications'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class KapacitorRule extends Component {
constructor(props) {
super(props)

View File

@ -1,7 +1,9 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import {DEFAULT_RULE_ID} from 'src/kapacitor/constants'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class NameSection extends Component {
constructor(props) {
super(props)

View File

@ -1,6 +1,8 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class RuleDetailsText extends Component {
constructor(props) {
super(props)

View File

@ -8,7 +8,9 @@ import Dropdown from 'shared/components/Dropdown'
import {parseHandlersFromRule} from 'src/shared/parsing/parseHandlersFromRule'
import {DEFAULT_HANDLERS} from 'src/kapacitor/constants'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class RuleHandlers extends Component {
constructor(props) {
super(props)

View File

@ -1,7 +1,9 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import RuleHeaderSave from 'src/kapacitor/components/RuleHeaderSave'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class RuleHeader extends Component {
constructor(props) {
super(props)

View File

@ -3,7 +3,9 @@ import PropTypes from 'prop-types'
import RuleMessageText from 'src/kapacitor/components/RuleMessageText'
import RuleMessageTemplates from 'src/kapacitor/components/RuleMessageTemplates'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class RuleMessage extends Component {
constructor(props) {
super(props)

View File

@ -6,8 +6,10 @@ import ReactTooltip from 'react-tooltip'
import CodeData from 'src/kapacitor/components/CodeData'
import {RULE_MESSAGE_TEMPLATES} from 'src/kapacitor/constants'
import {ErrorHandling} from 'src/shared/decorators/errors'
// needs to be React Component for CodeData click handler to work
@ErrorHandling
class RuleMessageTemplates extends Component {
constructor(props) {
super(props)

View File

@ -2,7 +2,9 @@ import React, {Component} from 'react'
import PropTypes from 'prop-types'
import {Controlled as CodeMirror} from 'react-codemirror2'
import 'src/external/codemirror'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class TickscriptEditor extends Component {
constructor(props) {
super(props)

View File

@ -1,6 +1,8 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class TickscriptID extends Component {
constructor(props) {
super(props)

View File

@ -1,5 +1,6 @@
import React, {PureComponent} from 'react'
import {DBRP} from 'src/types/kapacitor'
import {ErrorHandling} from 'src/shared/decorators/errors'
export interface Task {
dbrps: DBRP[]
@ -13,6 +14,7 @@ interface SaveProps {
unsavedChanges: boolean
}
@ErrorHandling
class TickscriptSave extends PureComponent<SaveProps> {
public render() {
const {onSave} = this.props

View File

@ -1,6 +1,7 @@
import React, {PureComponent} from 'react'
import RedactedInput from './RedactedInput'
import RedactedInput from 'src/kapacitor/components/config/RedactedInput'
import {ErrorHandling} from 'src/shared/decorators/errors'
interface Properties {
environment: string
@ -29,6 +30,7 @@ interface State {
testEnabled: boolean
}
@ErrorHandling
class AlertaConfig extends PureComponent<Props, State> {
private environment: HTMLInputElement
private origin: HTMLInputElement

View File

@ -2,7 +2,8 @@ import React, {PureComponent} from 'react'
import QuestionMarkTooltip from 'src/shared/components/QuestionMarkTooltip'
import {HIPCHAT_TOKEN_TIP} from 'src/kapacitor/copy'
import RedactedInput from './RedactedInput'
import RedactedInput from 'src/kapacitor/components/config/RedactedInput'
import {ErrorHandling} from 'src/shared/decorators/errors'
interface Properties {
room: string
@ -29,6 +30,7 @@ interface State {
testEnabled: boolean
}
@ErrorHandling
class HipchatConfig extends PureComponent<Props, State> {
private room: HTMLInputElement
private token: HTMLInputElement

View File

@ -1,7 +1,8 @@
import React, {PureComponent} from 'react'
import RedactedInput from './RedactedInput'
import RedactedInput from 'src/kapacitor/components/config/RedactedInput'
import TagInput from 'src/shared/components/TagInput'
import {ErrorHandling} from 'src/shared/decorators/errors'
interface Properties {
'api-key': string
@ -34,6 +35,7 @@ interface State {
testEnabled: boolean
}
@ErrorHandling
class OpsGenieConfig extends PureComponent<Props, State> {
private apiKey: HTMLInputElement

View File

@ -1,5 +1,6 @@
import React, {PureComponent} from 'react'
import RedactedInput from './RedactedInput'
import RedactedInput from 'src/kapacitor/components/config/RedactedInput'
import {ErrorHandling} from 'src/shared/decorators/errors'
interface Properties {
'service-key': string
@ -24,6 +25,7 @@ interface State {
testEnabled: boolean
}
@ErrorHandling
class PagerDutyConfig extends PureComponent<Props, State> {
private serviceKey: HTMLInputElement
private url: HTMLInputElement

View File

@ -1,7 +1,8 @@
import React, {PureComponent} from 'react'
import QuestionMarkTooltip from 'src/shared/components/QuestionMarkTooltip'
import RedactedInput from './RedactedInput'
import RedactedInput from 'src/kapacitor/components/config/RedactedInput'
import {ErrorHandling} from 'src/shared/decorators/errors'
import {PUSHOVER_DOCS_LINK} from 'src/kapacitor/copy'
@ -30,6 +31,7 @@ interface State {
testEnabled: boolean
}
@ErrorHandling
class PushoverConfig extends PureComponent<Props, State> {
private token: HTMLInputElement
private url: HTMLInputElement

View File

@ -1,4 +1,5 @@
import React, {PureComponent} from 'react'
import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props {
id: string
@ -11,6 +12,7 @@ interface State {
editing: boolean
}
@ErrorHandling
class RedactedInput extends PureComponent<Props, State> {
constructor(props) {
super(props)

View File

@ -1,4 +1,5 @@
import React, {PureComponent} from 'react'
import {ErrorHandling} from 'src/shared/decorators/errors'
interface Properties {
host: string
@ -31,6 +32,7 @@ interface State {
testEnabled: boolean
}
@ErrorHandling
class SMTPConfig extends PureComponent<Props, State> {
private host: HTMLInputElement
private port: HTMLInputElement

View File

@ -1,4 +1,5 @@
import React, {PureComponent} from 'react'
import {ErrorHandling} from 'src/shared/decorators/errors'
interface Properties {
source: string
@ -23,6 +24,7 @@ interface State {
testEnabled: boolean
}
@ErrorHandling
class SensuConfig extends PureComponent<Props, State> {
private source: HTMLInputElement
private addr: HTMLInputElement

View File

@ -1,5 +1,6 @@
import React, {PureComponent} from 'react'
import RedactedInput from './RedactedInput'
import RedactedInput from 'src/kapacitor/components/config/RedactedInput'
import {ErrorHandling} from 'src/shared/decorators/errors'
interface Properties {
channel: string
@ -24,6 +25,7 @@ interface State {
testEnabled: boolean
}
@ErrorHandling
class SlackConfig extends PureComponent<Props, State> {
private url: HTMLInputElement
private channel: HTMLInputElement

View File

@ -1,6 +1,7 @@
import React, {PureComponent} from 'react'
import RedactedInput from './RedactedInput'
import RedactedInput from 'src/kapacitor/components/config/RedactedInput'
import {ErrorHandling} from 'src/shared/decorators/errors'
interface Properties {
url: string
@ -25,6 +26,7 @@ interface Props {
enabled: boolean
}
@ErrorHandling
class TalkConfig extends PureComponent<Props, State> {
private url: HTMLInputElement
private author: HTMLInputElement

View File

@ -2,7 +2,8 @@ import React, {PureComponent} from 'react'
import QuestionMarkTooltip from 'src/shared/components/QuestionMarkTooltip'
import {TELEGRAM_CHAT_ID_TIP, TELEGRAM_TOKEN_TIP} from 'src/kapacitor/copy'
import RedactedInput from './RedactedInput'
import RedactedInput from 'src/kapacitor/components/config/RedactedInput'
import {ErrorHandling} from 'src/shared/decorators/errors'
interface Properties {
'chat-id': string
@ -33,6 +34,7 @@ interface State {
testEnabled: boolean
}
@ErrorHandling
class TelegramConfig extends PureComponent<Props, State> {
private parseModeHTML: HTMLInputElement
private parseModeMarkdown: HTMLInputElement

View File

@ -1,6 +1,7 @@
import React, {PureComponent} from 'react'
import RedactedInput from './RedactedInput'
import RedactedInput from 'src/kapacitor/components/config/RedactedInput'
import {ErrorHandling} from 'src/shared/decorators/errors'
interface Properties {
'api-key': string
@ -27,6 +28,7 @@ interface State {
testEnabled: boolean
}
@ErrorHandling
class VictorOpsConfig extends PureComponent<Props, State> {
private apiKey: HTMLInputElement
private routingKey: HTMLInputElement

View File

@ -24,6 +24,7 @@ import {
notifyKapacitorUpdateFailed,
notifyKapacitorUpdated,
} from 'src/shared/copy/notifications'
import {ErrorHandling} from 'src/shared/decorators/errors'
export const defaultName = 'My Kapacitor'
export const kapacitorPort = '9092'
@ -64,6 +65,7 @@ interface State {
exists: boolean
}
@ErrorHandling
export class KapacitorPage extends PureComponent<Props, State> {
constructor(props) {
super(props)

View File

@ -16,7 +16,9 @@ import {
notifyKapacitorCreateFailed,
notifyCouldNotFindKapacitor,
} from 'shared/copy/notifications'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class KapacitorRulePage extends Component {
constructor(props) {
super(props)

View File

@ -12,6 +12,7 @@ import FancyScrollbar from 'src/shared/components/FancyScrollbar'
import QuestionMarkTooltip from 'src/shared/components/QuestionMarkTooltip'
import {Source, Kapacitor, AlertRule} from 'src/types'
import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props {
source: Source
@ -29,6 +30,7 @@ interface State {
loading: boolean
}
@ErrorHandling
export class KapacitorRulesPage extends PureComponent<Props, State> {
constructor(props) {
super(props)

View File

@ -17,6 +17,7 @@ import {
notifyTickscriptLoggingError,
notifyKapacitorNotFound,
} from 'src/shared/copy/notifications'
import {ErrorHandling} from 'src/shared/decorators/errors'
interface ErrorActions {
errorThrown: (notify: string | object) => void
@ -69,6 +70,7 @@ interface State {
unsavedChanges: boolean
}
@ErrorHandling
export class TickscriptPage extends PureComponent<Props, State> {
constructor(props) {
super(props)