Add error handling to kapacitor components

pull/3227/head
Brandon Farmer 2018-04-17 14:28:21 -07:00
parent b0356dd60b
commit 6b2aa08106
28 changed files with 66 additions and 10 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
import React, {PureComponent} from 'react' 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 { interface Properties {
environment: string environment: string
@ -29,6 +30,7 @@ interface State {
testEnabled: boolean testEnabled: boolean
} }
@ErrorHandling
class AlertaConfig extends PureComponent<Props, State> { class AlertaConfig extends PureComponent<Props, State> {
private environment: HTMLInputElement private environment: HTMLInputElement
private origin: HTMLInputElement private origin: HTMLInputElement

View File

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

View File

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

View File

@ -1,5 +1,6 @@
import React, {PureComponent} from 'react' 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 { interface Properties {
'service-key': string 'service-key': string
@ -24,6 +25,7 @@ interface State {
testEnabled: boolean testEnabled: boolean
} }
@ErrorHandling
class PagerDutyConfig extends PureComponent<Props, State> { class PagerDutyConfig extends PureComponent<Props, State> {
private serviceKey: HTMLInputElement private serviceKey: HTMLInputElement
private url: HTMLInputElement private url: HTMLInputElement

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,6 @@
import React, {PureComponent} from 'react' 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 { interface Properties {
channel: string channel: string
@ -24,6 +25,7 @@ interface State {
testEnabled: boolean testEnabled: boolean
} }
@ErrorHandling
class SlackConfig extends PureComponent<Props, State> { class SlackConfig extends PureComponent<Props, State> {
private url: HTMLInputElement private url: HTMLInputElement
private channel: HTMLInputElement private channel: HTMLInputElement

View File

@ -1,6 +1,7 @@
import React, {PureComponent} from 'react' 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 { interface Properties {
url: string url: string
@ -25,6 +26,7 @@ interface Props {
enabled: boolean enabled: boolean
} }
@ErrorHandling
class TalkConfig extends PureComponent<Props, State> { class TalkConfig extends PureComponent<Props, State> {
private url: HTMLInputElement private url: HTMLInputElement
private author: HTMLInputElement private author: HTMLInputElement

View File

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

View File

@ -1,6 +1,7 @@
import React, {PureComponent} from 'react' 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 { interface Properties {
'api-key': string 'api-key': string
@ -27,6 +28,7 @@ interface State {
testEnabled: boolean testEnabled: boolean
} }
@ErrorHandling
class VictorOpsConfig extends PureComponent<Props, State> { class VictorOpsConfig extends PureComponent<Props, State> {
private apiKey: HTMLInputElement private apiKey: HTMLInputElement
private routingKey: HTMLInputElement private routingKey: HTMLInputElement

View File

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

View File

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

View File

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

View File

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