Merge pull request #3225 from influxdata/dashboard-error-handling

Add error handling to dashboard components
pull/3226/head
Brandon Farmer 2018-04-17 13:12:44 -07:00 committed by GitHub
commit 4a65ba2693
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 43 additions and 0 deletions

View File

@ -7,9 +7,11 @@ import {Link} from 'react-router'
import uuid from 'uuid' import uuid from 'uuid'
import InfiniteScroll from 'shared/components/InfiniteScroll' import InfiniteScroll from 'shared/components/InfiniteScroll'
import {ErrorHandling} from 'src/shared/decorators/errors'
import {ALERTS_TABLE} from 'src/alerts/constants/tableSizing' import {ALERTS_TABLE} from 'src/alerts/constants/tableSizing'
@ErrorHandling
class AlertsTable extends Component { class AlertsTable extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
@ -239,6 +241,7 @@ class AlertsTable extends Component {
} }
} }
@ErrorHandling
class SearchBar extends Component { class SearchBar extends Component {
constructor(props) { constructor(props) {
super(props) super(props)

View File

@ -5,6 +5,7 @@ import SourceIndicator from 'shared/components/SourceIndicator'
import AlertsTable from 'src/alerts/components/AlertsTable' import AlertsTable from 'src/alerts/components/AlertsTable'
import NoKapacitorError from 'shared/components/NoKapacitorError' import NoKapacitorError from 'shared/components/NoKapacitorError'
import CustomTimeRangeDropdown from 'shared/components/CustomTimeRangeDropdown' import CustomTimeRangeDropdown from 'shared/components/CustomTimeRangeDropdown'
import {ErrorHandling} from 'src/shared/decorators/errors'
import {getAlerts} from 'src/alerts/apis' import {getAlerts} from 'src/alerts/apis'
import AJAX from 'utils/ajax' import AJAX from 'utils/ajax'
@ -14,6 +15,7 @@ import moment from 'moment'
import {timeRanges} from 'shared/data/timeRanges' import {timeRanges} from 'shared/data/timeRanges'
@ErrorHandling
class AlertsApp extends Component { class AlertsApp extends Component {
constructor(props) { constructor(props) {
super(props) super(props)

View File

@ -16,10 +16,12 @@ import {
import {GRAPH_TYPES} from 'src/dashboards/graphics/graph' import {GRAPH_TYPES} from 'src/dashboards/graphics/graph'
import {updateAxes} from 'src/dashboards/actions/cellEditorOverlay' import {updateAxes} from 'src/dashboards/actions/cellEditorOverlay'
import {ErrorHandling} from 'src/shared/decorators/errors'
const {LINEAR, LOG, BASE_2, BASE_10} = AXES_SCALE_OPTIONS const {LINEAR, LOG, BASE_2, BASE_10} = AXES_SCALE_OPTIONS
const getInputMin = scale => (scale === LOG ? '0' : null) const getInputMin = scale => (scale === LOG ? '0' : null)
@ErrorHandling
class AxesOptions extends Component { class AxesOptions extends Component {
handleSetPrefixSuffix = e => { handleSetPrefixSuffix = e => {
const {handleUpdateAxes, axes} = this.props const {handleUpdateAxes, axes} = this.props

View File

@ -30,6 +30,7 @@ import {getCellTypeColors} from 'src/dashboards/constants/cellEditor'
import {TimeRange, Source, Query} from 'src/types' import {TimeRange, Source, Query} from 'src/types'
import {Status} from 'src/types/query' import {Status} from 'src/types/query'
import {Cell, CellQuery, Legend} from 'src/types/dashboard' import {Cell, CellQuery, Legend} from 'src/types/dashboard'
import {ErrorHandling} from 'src/shared/decorators/errors'
const staticLegend: Legend = { const staticLegend: Legend = {
type: 'static', type: 'static',
@ -86,6 +87,7 @@ const createWorkingDrafts = (source: string, queries: CellQuery[]): Query[] =>
queries.map((query: CellQuery) => createWorkingDraft(source, query)) queries.map((query: CellQuery) => createWorkingDraft(source, query))
) )
@ErrorHandling
class CellEditorOverlay extends Component<Props, State> { class CellEditorOverlay extends Component<Props, State> {
private overlayRef: HTMLDivElement private overlayRef: HTMLDivElement

View File

@ -4,7 +4,9 @@ import {
DASHBOARD_NAME_MAX_LENGTH, DASHBOARD_NAME_MAX_LENGTH,
NEW_DASHBOARD, NEW_DASHBOARD,
} from 'src/dashboards/constants/index' } from 'src/dashboards/constants/index'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class DashboardEditHeader extends Component { class DashboardEditHeader extends Component {
constructor(props) { constructor(props) {
super(props) super(props)

View File

@ -4,7 +4,9 @@ import {Link} from 'react-router'
import _ from 'lodash' import _ from 'lodash'
import classnames from 'classnames' import classnames from 'classnames'
import OnClickOutside from 'shared/components/OnClickOutside' import OnClickOutside from 'shared/components/OnClickOutside'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class DashboardSwitcher extends Component { class DashboardSwitcher extends Component {
constructor(props) { constructor(props) {
super(props) super(props)

View File

@ -6,7 +6,9 @@ import Authorized, {EDITOR_ROLE} from 'src/auth/Authorized'
import DashboardsTable from 'src/dashboards/components/DashboardsTable' import DashboardsTable from 'src/dashboards/components/DashboardsTable'
import SearchBar from 'src/hosts/components/SearchBar' import SearchBar from 'src/hosts/components/SearchBar'
import FancyScrollbar from 'shared/components/FancyScrollbar' import FancyScrollbar from 'shared/components/FancyScrollbar'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class DashboardsPageContents extends Component { class DashboardsPageContents extends Component {
constructor(props) { constructor(props) {
super(props) super(props)

View File

@ -9,7 +9,9 @@ import AxesOptions from 'src/dashboards/components/AxesOptions'
import TableOptions from 'src/dashboards/components/TableOptions' import TableOptions from 'src/dashboards/components/TableOptions'
import {buildDefaultYLabel} from 'shared/presenters' import {buildDefaultYLabel} from 'shared/presenters'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class DisplayOptions extends Component { class DisplayOptions extends Component {
constructor(props) { constructor(props) {
super(props) super(props)

View File

@ -21,7 +21,9 @@ import {
updateAxes, updateAxes,
} from 'src/dashboards/actions/cellEditorOverlay' } from 'src/dashboards/actions/cellEditorOverlay'
import {colorsNumberSchema} from 'shared/schemas' import {colorsNumberSchema} from 'shared/schemas'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class GaugeOptions extends Component { class GaugeOptions extends Component {
handleAddThreshold = () => { handleAddThreshold = () => {
const {gaugeColors, handleUpdateGaugeColors, onResetFocus} = this.props const {gaugeColors, handleUpdateGaugeColors, onResetFocus} = this.props

View File

@ -11,6 +11,7 @@ import {
ConnectDropTarget, ConnectDropTarget,
ConnectDragPreview, ConnectDragPreview,
} from 'react-dnd' } from 'react-dnd'
import {ErrorHandling} from 'src/shared/decorators/errors'
const fieldType = 'field' const fieldType = 'field'
@ -98,6 +99,7 @@ function MyDragSource(dragv1, dragv2, dragfunc1) {
return target => DragSource(dragv1, dragv2, dragfunc1)(target) as any return target => DragSource(dragv1, dragv2, dragfunc1)(target) as any
} }
@ErrorHandling
@MyDropTarget(fieldType, fieldTarget, (connect: DropTargetConnector) => ({ @MyDropTarget(fieldType, fieldTarget, (connect: DropTargetConnector) => ({
connectDropTarget: connect.dropTarget(), connectDropTarget: connect.dropTarget(),
})) }))

View File

@ -7,6 +7,7 @@ import {
TIME_FORMAT_DEFAULT, TIME_FORMAT_DEFAULT,
TIME_FORMAT_TOOLTIP_LINK, TIME_FORMAT_TOOLTIP_LINK,
} from 'src/shared/constants/tableGraph' } from 'src/shared/constants/tableGraph'
import {ErrorHandling} from 'src/shared/decorators/errors'
interface TimeFormatOptions { interface TimeFormatOptions {
text: string text: string
@ -22,6 +23,7 @@ interface State {
format: string format: string
} }
@ErrorHandling
class GraphOptionsTimeFormat extends PureComponent<Props, State> { class GraphOptionsTimeFormat extends PureComponent<Props, State> {
constructor(props: Props) { constructor(props: Props) {
super(props) super(props)

View File

@ -4,8 +4,10 @@ import PropTypes from 'prop-types'
import Dropdown from 'shared/components/Dropdown' import Dropdown from 'shared/components/Dropdown'
import {showMeasurements} from 'shared/apis/metaQuery' import {showMeasurements} from 'shared/apis/metaQuery'
import parsers from 'shared/parsing' import parsers from 'shared/parsing'
import {ErrorHandling} from 'src/shared/decorators/errors'
const {measurements: showMeasurementsParser} = parsers const {measurements: showMeasurementsParser} = parsers
@ErrorHandling
class MeasurementDropdown extends Component { class MeasurementDropdown extends Component {
constructor(props) { constructor(props) {
super(props) super(props)

View File

@ -5,6 +5,7 @@ import classnames from 'classnames'
import TemplateDrawer from 'shared/components/TemplateDrawer' import TemplateDrawer from 'shared/components/TemplateDrawer'
import QueryStatus from 'shared/components/QueryStatus' import QueryStatus from 'shared/components/QueryStatus'
import {ErrorHandling} from 'src/shared/decorators/errors'
import { import {
MATCH_INCOMPLETE_TEMPLATES, MATCH_INCOMPLETE_TEMPLATES,
@ -13,6 +14,7 @@ import {
unMask, unMask,
} from 'src/dashboards/constants' } from 'src/dashboards/constants'
@ErrorHandling
class QueryTextArea extends Component { class QueryTextArea extends Component {
constructor(props) { constructor(props) {
super(props) super(props)

View File

@ -8,7 +8,9 @@ import ThresholdsList from 'shared/components/ThresholdsList'
import ThresholdsListTypeToggle from 'shared/components/ThresholdsListTypeToggle' import ThresholdsListTypeToggle from 'shared/components/ThresholdsListTypeToggle'
import {updateAxes} from 'src/dashboards/actions/cellEditorOverlay' import {updateAxes} from 'src/dashboards/actions/cellEditorOverlay'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class SingleStatOptions extends Component { class SingleStatOptions extends Component {
handleUpdatePrefix = e => { handleUpdatePrefix = e => {
const {handleUpdateAxes, axes} = this.props const {handleUpdateAxes, axes} = this.props

View File

@ -17,6 +17,7 @@ import ThresholdsListTypeToggle from 'src/shared/components/ThresholdsListTypeTo
import {updateTableOptions} from 'src/dashboards/actions/cellEditorOverlay' import {updateTableOptions} from 'src/dashboards/actions/cellEditorOverlay'
import {TIME_FIELD_DEFAULT} from 'src/shared/constants/tableGraph' import {TIME_FIELD_DEFAULT} from 'src/shared/constants/tableGraph'
import {QueryConfig} from 'src/types/query' import {QueryConfig} from 'src/types/query'
import {ErrorHandling} from 'src/shared/decorators/errors'
interface Option { interface Option {
text: string text: string
@ -44,6 +45,7 @@ interface Props {
onResetFocus: () => void onResetFocus: () => void
} }
@ErrorHandling
export class TableOptions extends PureComponent<Props, {}> { export class TableOptions extends PureComponent<Props, {}> {
constructor(props) { constructor(props) {
super(props) super(props)

View File

@ -4,8 +4,10 @@ import PropTypes from 'prop-types'
import Dropdown from 'shared/components/Dropdown' import Dropdown from 'shared/components/Dropdown'
import {showTagKeys} from 'shared/apis/metaQuery' import {showTagKeys} from 'shared/apis/metaQuery'
import parsers from 'shared/parsing' import parsers from 'shared/parsing'
import {ErrorHandling} from 'src/shared/decorators/errors'
const {tagKeys: showTagKeysParser} = parsers const {tagKeys: showTagKeysParser} = parsers
@ErrorHandling
class TagKeyDropdown extends Component { class TagKeyDropdown extends Component {
constructor(props) { constructor(props) {
super(props) super(props)

View File

@ -2,6 +2,7 @@ import React, {PureComponent, ChangeEvent, KeyboardEvent} from 'react'
import ColorDropdown from 'src/shared/components/ColorDropdown' import ColorDropdown from 'src/shared/components/ColorDropdown'
import {THRESHOLD_COLORS} from 'src/shared/constants/thresholds' import {THRESHOLD_COLORS} from 'src/shared/constants/thresholds'
import {ErrorHandling} from 'src/shared/decorators/errors'
interface SelectedColor { interface SelectedColor {
hex: string hex: string
@ -35,6 +36,7 @@ interface State {
valid: boolean valid: boolean
} }
@ErrorHandling
class Threshold extends PureComponent<Props, State> { class Threshold extends PureComponent<Props, State> {
private thresholdInputRef: HTMLInputElement private thresholdInputRef: HTMLInputElement

View File

@ -4,7 +4,9 @@ import {connect} from 'react-redux'
import {bindActionCreators} from 'redux' import {bindActionCreators} from 'redux'
import {renameCell} from 'src/dashboards/actions/cellEditorOverlay' import {renameCell} from 'src/dashboards/actions/cellEditorOverlay'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class VisualizationName extends Component { class VisualizationName extends Component {
constructor(props) { constructor(props) {
super(props) super(props)

View File

@ -25,6 +25,7 @@ import {errorThrown as errorThrownAction} from 'shared/actions/errors'
import {notify as notifyAction} from 'shared/actions/notifications' import {notify as notifyAction} from 'shared/actions/notifications'
import {notifyTempVarAlreadyExists} from 'shared/copy/notifications' import {notifyTempVarAlreadyExists} from 'shared/copy/notifications'
import {ErrorHandling} from 'src/shared/decorators/errors'
const compact = values => uniq(values).filter(value => /\S/.test(value)) const compact = values => uniq(values).filter(value => /\S/.test(value))
@ -124,6 +125,7 @@ const TemplateVariableRow = ({
</form> </form>
) )
@ErrorHandling
class RowWrapper extends Component { class RowWrapper extends Component {
constructor(props) { constructor(props) {
super(props) super(props)

View File

@ -38,6 +38,7 @@ import {presentationButtonDispatcher} from 'shared/dispatchers'
import {interval, DASHBOARD_LAYOUT_ROW_HEIGHT} from 'shared/constants' import {interval, DASHBOARD_LAYOUT_ROW_HEIGHT} from 'shared/constants'
import {notifyDashboardNotFound} from 'shared/copy/notifications' import {notifyDashboardNotFound} from 'shared/copy/notifications'
import {colorsStringSchema, colorsNumberSchema} from 'shared/schemas' import {colorsStringSchema, colorsNumberSchema} from 'shared/schemas'
import {ErrorHandling} from 'src/shared/decorators/errors'
const FORMAT_INFLUXQL = 'influxql' const FORMAT_INFLUXQL = 'influxql'
const defaultTimeRange = { const defaultTimeRange = {
@ -47,6 +48,7 @@ const defaultTimeRange = {
format: FORMAT_INFLUXQL, format: FORMAT_INFLUXQL,
} }
@ErrorHandling
class DashboardPage extends Component { class DashboardPage extends Component {
constructor(props) { constructor(props) {
super(props) super(props)

View File

@ -11,7 +11,9 @@ import {createDashboard} from 'src/dashboards/apis'
import {getDashboardsAsync, deleteDashboardAsync} from 'src/dashboards/actions' import {getDashboardsAsync, deleteDashboardAsync} from 'src/dashboards/actions'
import {NEW_DASHBOARD} from 'src/dashboards/constants' import {NEW_DASHBOARD} from 'src/dashboards/constants'
import {ErrorHandling} from 'src/shared/decorators/errors'
@ErrorHandling
class DashboardsPage extends Component { class DashboardsPage extends Component {
componentDidMount() { componentDidMount() {
this.props.handleGetDashboards() this.props.handleGetDashboards()