chore(ui): remove Partial<Props> (#12956)

* chore(ui): add default props to ThresholdItem

* chore(ui): remove Partial<Props> pattern

* chore(ui): remove Partial<Props> pattern from Dygraphs

* chore(ui): remove DefaultProp interface

* test: update snapshots
pull/12964/head
Andrew Watkins 2019-03-27 17:12:54 -07:00 committed by GitHub
parent 0cfc048c7b
commit b9c933a429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
70 changed files with 293 additions and 374 deletions

View File

@ -6,17 +6,17 @@ import ProtoboardIcon from 'src/clockface/components/card_select/ProtoboardIcon'
interface Props { interface Props {
id: string id: string
name?: string
label: string label: string
image?: StatelessComponent
checked?: boolean
disabled?: boolean
onClick: () => void onClick: () => void
name?: string
image?: StatelessComponent
checked: boolean
disabled: boolean
} }
@ErrorHandling @ErrorHandling
class CardSelectCard extends PureComponent<Props> { class CardSelectCard extends PureComponent<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
checked: false, checked: false,
disabled: false, disabled: false,
} }

View File

@ -2,11 +2,11 @@
import React, {PureComponent} from 'react' import React, {PureComponent} from 'react'
interface Props { interface Props {
displayText?: string displayText: string
} }
class ProtoboardIcon extends PureComponent<Props> { class ProtoboardIcon extends PureComponent<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
displayText: '', displayText: '',
} }

View File

@ -22,24 +22,19 @@ import {validateHexCode} from 'src/configuration/utils/labels'
// Styles // Styles
import 'src/clockface/components/color_picker/ColorPicker.scss' import 'src/clockface/components/color_picker/ColorPicker.scss'
interface PassedProps { interface Props {
color: string color: string
onChange: (color: string, status?: ComponentStatus) => void onChange: (color: string, status?: ComponentStatus) => void
testID: string
maintainInputFocus: boolean
} }
interface DefaultProps {
maintainInputFocus?: boolean
testID?: string
}
type Props = PassedProps & DefaultProps
interface State { interface State {
errorMessage: string errorMessage: string
} }
export default class ColorPicker extends Component<Props, State> { export default class ColorPicker extends Component<Props, State> {
public static defaultProps: DefaultProps = { public static defaultProps = {
maintainInputFocus: false, maintainInputFocus: false,
testID: 'color-picker', testID: 'color-picker',
} }

View File

@ -24,16 +24,16 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props { interface Props {
confirmText: string confirmText: string
onConfirm: (returnValue?: any) => void onConfirm: (returnValue?: any) => void
size: ComponentSize
shape: ButtonShape
testID: string
status: ComponentStatus
returnValue?: any returnValue?: any
text?: string text?: string
size?: ComponentSize
shape?: ButtonShape
icon?: IconFont icon?: IconFont
status?: ComponentStatus
titleText?: string titleText?: string
tabIndex?: number tabIndex?: number
className?: string className?: string
testID?: string
} }
interface State { interface State {
@ -42,7 +42,7 @@ interface State {
@ErrorHandling @ErrorHandling
class ConfirmationButton extends Component<Props, State> { class ConfirmationButton extends Component<Props, State> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
size: ComponentSize.Small, size: ComponentSize.Small,
shape: ButtonShape.Default, shape: ButtonShape.Default,
status: ComponentStatus.Default, status: ComponentStatus.Default,

View File

@ -16,7 +16,7 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props { interface Props {
children: JSX.Element | JSX.Element[] children: JSX.Element | JSX.Element[]
align?: Alignment align: Alignment
className?: string className?: string
} }
@ -26,7 +26,7 @@ interface State {
@ErrorHandling @ErrorHandling
class Context extends PureComponent<Props, State> { class Context extends PureComponent<Props, State> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
align: Alignment.Right, align: Alignment.Right,
} }

View File

@ -17,28 +17,23 @@ import {
import {ErrorHandling} from 'src/shared/decorators/errors' import {ErrorHandling} from 'src/shared/decorators/errors'
interface PassedProps { interface Props {
children: JSX.Element | JSX.Element[] children: JSX.Element | JSX.Element[]
icon: IconFont icon: IconFont
onBoostZIndex?: (boostZIndex: boolean) => void onBoostZIndex?: (boostZIndex: boolean) => void
text: string
color: ComponentColor
shape: ButtonShape
testID: string
} }
interface DefaultProps {
text?: string
color?: ComponentColor
shape?: ButtonShape
testID?: string
}
type Props = PassedProps & DefaultProps
interface State { interface State {
isExpanded: boolean isExpanded: boolean
} }
@ErrorHandling @ErrorHandling
class ContextMenu extends Component<Props, State> { class ContextMenu extends Component<Props, State> {
public static defaultProps: DefaultProps = { public static defaultProps = {
color: ComponentColor.Primary, color: ComponentColor.Primary,
shape: ButtonShape.Square, shape: ButtonShape.Square,
text: '', text: '',

View File

@ -2,24 +2,19 @@
import React, {Component} from 'react' import React, {Component} from 'react'
import classnames from 'classnames' import classnames from 'classnames'
interface PassedProps { interface Props {
label: string label: string
action: (value?: any) => void action: (value?: any) => void
description: string
testID: string
value?: any value?: any
onCollapseMenu?: () => void
disabled?: boolean disabled?: boolean
onCollapseMenu?: () => void
} }
interface DefaultProps {
description?: string
testID?: string
}
type Props = PassedProps & DefaultProps
class ContextMenuItem extends Component<Props> { class ContextMenuItem extends Component<Props> {
public static defaultProps: DefaultProps = { public static defaultProps = {
description: null, description: '',
testID: 'context-menu-item', testID: 'context-menu-item',
} }

View File

@ -6,13 +6,13 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props { interface Props {
children: JSX.Element children: JSX.Element
minSizePixels?: number minSizePixels: number
sizePercent?: number sizePercent?: number
} }
@ErrorHandling @ErrorHandling
class DraggableResizerPanel extends Component<Props> { class DraggableResizerPanel extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
minSizePixels: 0, minSizePixels: 0,
} }

View File

@ -26,9 +26,13 @@ export enum DropdownMode {
Radio = 'radio', Radio = 'radio',
} }
export interface Props { interface OwnProps {
children: JSX.Element[] children: JSX.Element[]
onChange: (value: any) => void onChange: (value: any) => void
}
interface DefaultProps {
buttonTestID?: string
selectedID?: string selectedID?: string
buttonColor?: ComponentColor buttonColor?: ComponentColor
buttonSize?: ComponentSize buttonSize?: ComponentSize
@ -42,17 +46,18 @@ export interface Props {
mode?: DropdownMode mode?: DropdownMode
titleText?: string titleText?: string
menuHeader?: JSX.Element menuHeader?: JSX.Element
testID: string testID?: string
buttonTestID: string
} }
export type Props = OwnProps & DefaultProps
interface State { interface State {
expanded: boolean expanded: boolean
} }
@ErrorHandling @ErrorHandling
class Dropdown extends Component<Props, State> { class Dropdown extends Component<Props, State> {
public static defaultProps: Partial<Props> = { public static defaultProps: DefaultProps = {
buttonColor: ComponentColor.Default, buttonColor: ComponentColor.Default,
buttonSize: ComponentSize.Small, buttonSize: ComponentSize.Small,
status: ComponentStatus.Default, status: ComponentStatus.Default,
@ -61,6 +66,8 @@ class Dropdown extends Component<Props, State> {
menuColor: DropdownMenuColors.Sapphire, menuColor: DropdownMenuColors.Sapphire,
mode: DropdownMode.Radio, mode: DropdownMode.Radio,
titleText: '', titleText: '',
testID: 'dropdown',
buttonTestID: 'dropdown-button',
} }
public static Button = DropdownButton public static Button = DropdownButton

View File

@ -17,18 +17,18 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props { interface Props {
children: DropdownChild children: DropdownChild
onClick: (e: MouseEvent<HTMLElement>) => void onClick: (e: MouseEvent<HTMLElement>) => void
status?: ComponentStatus status: ComponentStatus
active?: boolean color: ComponentColor
color?: ComponentColor size: ComponentSize
size?: ComponentSize active: boolean
icon?: IconFont icon?: IconFont
title?: string title?: string
testID: string testID?: string
} }
@ErrorHandling @ErrorHandling
class DropdownButton extends Component<Props> { class DropdownButton extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
color: ComponentColor.Default, color: ComponentColor.Default,
size: ComponentSize.Small, size: ComponentSize.Small,
status: ComponentStatus.Default, status: ComponentStatus.Default,

View File

@ -8,14 +8,14 @@ import {DropdownChild} from 'src/clockface/types'
import {ErrorHandling} from 'src/shared/decorators/errors' import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props { interface Props {
children?: DropdownChild
id: string id: string
text?: string text: string
children?: DropdownChild
} }
@ErrorHandling @ErrorHandling
class DropdownDivider extends Component<Props> { class DropdownDivider extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
text: '', text: '',
} }

View File

@ -11,15 +11,15 @@ interface Props {
id: string id: string
children: DropdownChild children: DropdownChild
value: any value: any
selected?: boolean selected: boolean
checkbox?: boolean checkbox: boolean
onClick?: (value: any) => void onClick?: (value: any) => void
testID?: string testID?: string
} }
@ErrorHandling @ErrorHandling
class DropdownItem extends Component<Props> { class DropdownItem extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
checkbox: false, checkbox: false,
selected: false, selected: false,
} }

View File

@ -24,19 +24,19 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props { interface Props {
children: JSX.Element[] children: JSX.Element[]
onChange: (selectedIDs: string[], value: any) => void onChange: (selectedIDs: string[], value: any) => void
onCollapse?: () => void
selectedIDs: string[] selectedIDs: string[]
buttonColor?: ComponentColor buttonColor: ComponentColor
buttonSize?: ComponentSize buttonSize: ComponentSize
menuColor?: DropdownMenuColors menuColor: DropdownMenuColors
wrapText: boolean
maxMenuHeight: number
emptyText: string
separatorText: string
customClass?: string
onCollapse?: () => void
status?: ComponentStatus status?: ComponentStatus
widthPixels?: number widthPixels?: number
icon?: IconFont icon?: IconFont
wrapText?: boolean
customClass?: string
maxMenuHeight?: number
emptyText?: string
separatorText?: string
} }
interface State { interface State {
@ -45,7 +45,7 @@ interface State {
@ErrorHandling @ErrorHandling
class MultiSelectDropdown extends Component<Props, State> { class MultiSelectDropdown extends Component<Props, State> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
buttonColor: ComponentColor.Default, buttonColor: ComponentColor.Default,
buttonSize: ComponentSize.Small, buttonSize: ComponentSize.Small,
status: ComponentStatus.Default, status: ComponentStatus.Default,

View File

@ -57,6 +57,7 @@ exports[`MultiSelectDropdown with menu expanded matches snapshot 1`] = `
<FancyScrollbar <FancyScrollbar
autoHeight={true} autoHeight={true}
autoHide={false} autoHide={false}
className=""
hideTracksWhenNotNeeded={true} hideTracksWhenNotNeeded={true}
maxHeight={250} maxHeight={250}
setScrollTop={[Function]} setScrollTop={[Function]}

View File

@ -15,21 +15,16 @@ import 'src/clockface/components/empty_state/EmptyState.scss'
// Decorators // Decorators
import {ErrorHandling} from 'src/shared/decorators/errors' import {ErrorHandling} from 'src/shared/decorators/errors'
interface PassedProps { interface Props {
children: JSX.Element | JSX.Element[] children: JSX.Element | JSX.Element[]
size: ComponentSize
testID: string
customClass?: string customClass?: string
} }
interface DefaultProps {
size?: ComponentSize
testID?: string
}
type Props = PassedProps & DefaultProps
@ErrorHandling @ErrorHandling
class EmptyState extends Component<Props> { class EmptyState extends Component<Props> {
public static defaultProps: DefaultProps = { public static defaultProps = {
size: ComponentSize.Small, size: ComponentSize.Small,
testID: 'empty-state', testID: 'empty-state',
} }

View File

@ -11,17 +11,13 @@ import FormFooter from 'src/clockface/components/form_layout/FormFooter'
import {ErrorHandling} from 'src/shared/decorators/errors' import {ErrorHandling} from 'src/shared/decorators/errors'
interface PassedProps { interface Props {
children: JSX.Element[] | JSX.Element children: JSX.Element[] | JSX.Element
style?: React.CSSProperties style?: React.CSSProperties
className?: string className?: string
onSubmit?: (e: React.FormEvent) => void onSubmit?: (e: React.FormEvent) => void
testID: string
} }
interface DefaultProps {
testID?: string
}
type Props = PassedProps & DefaultProps
interface BoxProps { interface BoxProps {
children: JSX.Element | JSX.Element[] children: JSX.Element | JSX.Element[]
@ -36,7 +32,7 @@ class Form extends Component<Props> {
public static Divider = FormDivider public static Divider = FormDivider
public static Footer = FormFooter public static Footer = FormFooter
public static defaultProps: DefaultProps = { public static defaultProps = {
testID: 'form-container', testID: 'form-container',
} }

View File

@ -9,7 +9,7 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props { interface Props {
children: JSX.Element | JSX.Element[] children: JSX.Element | JSX.Element[]
colsXS?: Columns colsXS: Columns
colsSM?: Columns colsSM?: Columns
colsMD?: Columns colsMD?: Columns
colsLG?: Columns colsLG?: Columns
@ -21,7 +21,7 @@ interface Props {
@ErrorHandling @ErrorHandling
class FormFooter extends Component<Props> { class FormFooter extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
colsXS: Columns.Twelve, colsXS: Columns.Twelve,
} }

View File

@ -7,7 +7,7 @@ import {Columns} from 'src/clockface/types'
interface Props { interface Props {
children: JSX.Element[] | JSX.Element children: JSX.Element[] | JSX.Element
widthXS?: Columns widthXS: Columns
widthSM?: Columns widthSM?: Columns
widthMD?: Columns widthMD?: Columns
widthLG?: Columns widthLG?: Columns
@ -18,7 +18,7 @@ interface Props {
} }
class GridColumn extends Component<Props> { class GridColumn extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
widthXS: Columns.Twelve, widthXS: Columns.Twelve,
} }

View File

@ -7,10 +7,10 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props { interface Props {
children?: JSX.Element[] children?: JSX.Element[]
cellWidth?: number cellWidth: number
recalculateFlag?: string recalculateFlag: string
width?: number width: number
wait?: number wait: number
} }
interface State { interface State {
@ -22,7 +22,7 @@ interface State {
} }
@ErrorHandling @ErrorHandling
class GridSizer extends PureComponent<Props, State> { class GridSizer extends PureComponent<Props, State> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
cellWidth: 150, cellWidth: 150,
recalculateFlag: '', recalculateFlag: '',
width: null, width: null,

View File

@ -8,20 +8,15 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
// Styles // Styles
import 'src/clockface/components/grid_sizer/ResponsiveGridSizer.scss' import 'src/clockface/components/grid_sizer/ResponsiveGridSizer.scss'
interface PassedProps { interface Props {
children: JSX.Element[] children: JSX.Element[]
columns: number columns: number
gutter: number
} }
interface DefaultProps {
gutter?: number
}
type Props = PassedProps & DefaultProps
@ErrorHandling @ErrorHandling
class ResponsiveGridSizer extends PureComponent<Props> { class ResponsiveGridSizer extends PureComponent<Props> {
public static defaultProps: DefaultProps = { public static defaultProps = {
gutter: 4, gutter: 4,
} }

View File

@ -6,7 +6,7 @@ import classnames from 'classnames'
import {ErrorHandling} from 'src/shared/decorators/errors' import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props { interface Props {
disabled?: boolean disabled: boolean
children: JSX.Element[] | JSX.Element children: JSX.Element[] | JSX.Element
customClass?: string customClass?: string
testID: string testID: string
@ -14,7 +14,7 @@ interface Props {
@ErrorHandling @ErrorHandling
class IndexListRow extends Component<Props> { class IndexListRow extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
disabled: false, disabled: false,
testID: 'table-row', testID: 'table-row',
} }

View File

@ -10,14 +10,14 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props { interface Props {
children: any children: any
alignment?: Alignment alignment: Alignment
revealOnHover?: boolean revealOnHover: boolean
testID?: string testID: string
} }
@ErrorHandling @ErrorHandling
class IndexListRowCell extends Component<Props> { class IndexListRowCell extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
alignment: Alignment.Left, alignment: Alignment.Left,
revealOnHover: false, revealOnHover: false,
testID: 'table-cell', testID: 'table-cell',

View File

@ -33,24 +33,25 @@ export enum Wrap {
} }
interface Props { interface Props {
autocapitalize?: AutoCapitalize autocapitalize: AutoCapitalize
autocomplete?: AutoComplete autocomplete: AutoComplete
autofocus?: boolean autofocus: boolean
cols?: number cols: number
disabled?: boolean disabled: boolean
form?: string form: string
maxlength?: number maxlength: number
minlength?: number minlength: number
name?: string name: string
placeholder?: string placeholder: string
readOnly?: boolean readOnly: boolean
required?: boolean required: boolean
rows?: number rows: number
spellCheck?: boolean spellCheck: boolean
wrap?: Wrap.Off wrap: Wrap.Off
widthPixels?: number widthPixels?: number
size?: ComponentSize size?: ComponentSize
status?: ComponentStatus status?: ComponentStatus
value: string
customClass?: string customClass?: string
onChange?: (s: string) => void onChange?: (s: string) => void
onBlur?: (e?: ChangeEvent<HTMLTextAreaElement>) => void onBlur?: (e?: ChangeEvent<HTMLTextAreaElement>) => void
@ -58,11 +59,10 @@ interface Props {
onKeyPress?: (e: KeyboardEvent<HTMLTextAreaElement>) => void onKeyPress?: (e: KeyboardEvent<HTMLTextAreaElement>) => void
onKeyUp?: (e: KeyboardEvent<HTMLTextAreaElement>) => void onKeyUp?: (e: KeyboardEvent<HTMLTextAreaElement>) => void
onKeyDown?: (e: KeyboardEvent<HTMLTextAreaElement>) => void onKeyDown?: (e: KeyboardEvent<HTMLTextAreaElement>) => void
value?: string
} }
class TextArea extends Component<Props> { class TextArea extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
autocapitalize: AutoCapitalize.Off, autocapitalize: AutoCapitalize.Off,
autocomplete: AutoComplete.Off, autocomplete: AutoComplete.Off,
autofocus: false, autofocus: false,

View File

@ -11,29 +11,24 @@ import './Label.scss'
import {ErrorHandling} from 'src/shared/decorators/errors' import {ErrorHandling} from 'src/shared/decorators/errors'
interface PassedProps { interface Props {
id: string id: string
name: string name: string
description: string description: string
colorHex: string colorHex: string
onClick?: (id: string) => void onClick?: (id: string) => void
onDelete?: (id: string) => void onDelete?: (id: string) => void
} size: ComponentSize
testID: string
interface DefaultProps {
size?: ComponentSize
testID?: string
} }
interface State { interface State {
isMouseOver: boolean isMouseOver: boolean
} }
type Props = PassedProps & DefaultProps
@ErrorHandling @ErrorHandling
class Label extends Component<Props, State> { class Label extends Component<Props, State> {
public static defaultProps: DefaultProps = { public static defaultProps = {
size: ComponentSize.ExtraSmall, size: ComponentSize.ExtraSmall,
testID: 'label--pill', testID: 'label--pill',
} }

View File

@ -3,12 +3,12 @@ import classnames from 'classnames'
interface Props { interface Props {
children: ReactNode children: ReactNode
maxWidth?: number maxWidth: number
customClass?: string customClass?: string
} }
class OverlayContainer extends Component<Props> { class OverlayContainer extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
maxWidth: 800, maxWidth: 800,
} }

View File

@ -11,17 +11,18 @@ interface Props {
value: any value: any
children: JSX.Element | string | number children: JSX.Element | string | number
onClick: (value: any) => void onClick: (value: any) => void
disabled?: boolean disabled: boolean
titleText: string titleText: string
disabledTitleText?: string disabledTitleText: string
testID?: string testID: string
} }
@ErrorHandling @ErrorHandling
class RadioButton extends Component<Props> { class RadioButton extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
disabled: false, disabled: false,
disabledTitleText: 'This option is disabled', disabledTitleText: 'This option is disabled',
titleText: '',
testID: 'radio-button', testID: 'radio-button',
} }

View File

@ -17,14 +17,14 @@ import './RadioButtons.scss'
interface Props { interface Props {
children: JSX.Element[] children: JSX.Element[]
customClass?: string customClass?: string
color?: ComponentColor color: ComponentColor
size?: ComponentSize size: ComponentSize
shape?: ButtonShape shape: ButtonShape
} }
@ErrorHandling @ErrorHandling
class Radio extends Component<Props> { class Radio extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
color: ComponentColor.Primary, color: ComponentColor.Primary,
size: ComponentSize.Small, size: ComponentSize.Small,
shape: ButtonShape.Default, shape: ButtonShape.Default,

View File

@ -7,27 +7,22 @@ import classnames from 'classnames'
// Constants // Constants
import {UPDATED_AT_TIME_FORMAT} from 'src/dashboards/constants' import {UPDATED_AT_TIME_FORMAT} from 'src/dashboards/constants'
interface PassedProps { interface Props {
name: () => JSX.Element name: () => JSX.Element
updatedAt?: string updatedAt?: string
owner?: {id: string; name: string} owner?: {id: string; name: string}
children?: JSX.Element[] | JSX.Element children?: JSX.Element[] | JSX.Element
disabled?: boolean disabled?: boolean
testID: string
description: () => JSX.Element
labels: () => JSX.Element
metaData: () => JSX.Element[]
contextMenu: () => JSX.Element
toggle: () => JSX.Element
} }
interface DefaultProps {
testID?: string
description?: () => JSX.Element
labels?: () => JSX.Element
metaData?: () => JSX.Element[]
contextMenu?: () => JSX.Element
toggle?: () => JSX.Element
}
type Props = PassedProps & DefaultProps
export default class ResourceListCard extends PureComponent<Props> { export default class ResourceListCard extends PureComponent<Props> {
public static defaultProps: DefaultProps = { public static defaultProps = {
testID: 'resource-card', testID: 'resource-card',
description: () => null, description: () => null,
labels: () => null, labels: () => null,

View File

@ -16,23 +16,18 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
// Styles // Styles
import 'src/clockface/components/resource_list/ResourceName.scss' import 'src/clockface/components/resource_list/ResourceName.scss'
interface PassedProps { interface Props {
onUpdate: (name: string) => void onUpdate: (name: string) => void
name: string name: string
onClick?: (e: MouseEvent<HTMLAnchorElement>) => void onClick?: (e: MouseEvent<HTMLAnchorElement>) => void
placeholder?: string placeholder?: string
noNameString: string noNameString: string
parentTestID: string
buttonTestID: string
inputTestID: string
hrefValue: string
} }
interface DefaultProps {
parentTestID?: string
buttonTestID?: string
inputTestID?: string
hrefValue?: string
}
type Props = PassedProps & DefaultProps
interface State { interface State {
isEditing: boolean isEditing: boolean
workingName: string workingName: string
@ -41,7 +36,7 @@ interface State {
@ErrorHandling @ErrorHandling
class ResourceName extends Component<Props, State> { class ResourceName extends Component<Props, State> {
public static defaultProps: DefaultProps = { public static defaultProps = {
parentTestID: 'resource-name', parentTestID: 'resource-name',
buttonTestID: 'resource-name--button', buttonTestID: 'resource-name--button',
inputTestID: 'resource-name--input', inputTestID: 'resource-name--input',

View File

@ -10,13 +10,13 @@ interface Props {
children: any children: any
visible: boolean visible: boolean
title: string title: string
maxWidth?: number maxWidth: number
onDismiss: () => void onDismiss: () => void
} }
@ErrorHandling @ErrorHandling
class WizardOverlay extends PureComponent<Props> { class WizardOverlay extends PureComponent<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
maxWidth: 1200, maxWidth: 1200,
} }

View File

@ -25,11 +25,7 @@ import * as AppActions from 'src/types/actions/app'
import * as QueriesModels from 'src/types/queries' import * as QueriesModels from 'src/types/queries'
import {Dashboard} from '@influxdata/influx' import {Dashboard} from '@influxdata/influx'
interface DefaultProps { interface Props {
zoomedTimeRange: QueriesModels.TimeRange
}
interface Props extends DefaultProps {
activeDashboard: string activeDashboard: string
dashboard: Dashboard dashboard: Dashboard
timeRange: QueriesModels.TimeRange timeRange: QueriesModels.TimeRange
@ -44,10 +40,11 @@ interface Props extends DefaultProps {
isShowingVariablesControlBar: boolean isShowingVariablesControlBar: boolean
isHidden: boolean isHidden: boolean
onAddNote: () => void onAddNote: () => void
zoomedTimeRange: QueriesModels.TimeRange
} }
export default class DashboardHeader extends Component<Props> { export default class DashboardHeader extends Component<Props> {
public static defaultProps: DefaultProps = { public static defaultProps = {
zoomedTimeRange: { zoomedTimeRange: {
upper: null, upper: null,
lower: null, lower: null,

View File

@ -1,7 +1,6 @@
import {DEFAULT_TABLE_OPTIONS} from 'src/dashboards/constants' import {DEFAULT_TABLE_OPTIONS} from 'src/dashboards/constants'
import {stringifyColorValues} from 'src/shared/constants/colorOperations' import {stringifyColorValues} from 'src/shared/constants/colorOperations'
import {ViewType, Axis, Axes} from 'src/types/dashboards' import {ViewType, Axis, Axes, Color, Base, Scale} from 'src/types'
import {Color} from 'src/types/colors'
export const initializeOptions = (type: ViewType) => { export const initializeOptions = (type: ViewType) => {
switch (type) { switch (type) {
@ -13,10 +12,10 @@ export const initializeOptions = (type: ViewType) => {
} }
export const AXES_SCALE_OPTIONS = { export const AXES_SCALE_OPTIONS = {
LINEAR: 'linear', LINEAR: Scale.Linear,
LOG: 'log', LOG: Scale.Log,
BASE_2: '2', BASE_2: Base.Two,
BASE_10: '10', BASE_10: Base.Ten,
} }
type DefaultAxis = Pick<Axis, Exclude<keyof Axis, 'bounds'>> type DefaultAxis = Pick<Axis, Exclude<keyof Axis, 'bounds'>>
@ -31,7 +30,7 @@ export const DEFAULT_AXIS: DefaultAxis = {
export const FULL_DEFAULT_AXIS: Axis = { export const FULL_DEFAULT_AXIS: Axis = {
...DEFAULT_AXIS, ...DEFAULT_AXIS,
bounds: ['', ''], bounds: ['', ''] as [string, string],
} }
export const DEFAULT_AXES: Axes = { export const DEFAULT_AXES: Axes = {

View File

@ -12,6 +12,8 @@ import {
SourceLinks, SourceLinks,
TimeRange, TimeRange,
QueryConfig, QueryConfig,
Scale,
Base,
} from 'src/types' } from 'src/types'
export const dashboard: Dashboard = { export const dashboard: Dashboard = {
@ -131,16 +133,16 @@ export const axes: Axes = {
label: '', label: '',
prefix: '', prefix: '',
suffix: '', suffix: '',
base: '10', base: Base.Ten,
scale: 'linear', scale: Scale.Linear,
}, },
y: { y: {
bounds: ['', ''], bounds: ['', ''],
label: '', label: '',
prefix: '', prefix: '',
suffix: '', suffix: '',
base: '10', base: Base.Ten,
scale: 'linear', scale: Scale.Linear,
}, },
} }

View File

@ -33,6 +33,7 @@ class SaveAsOverlay extends PureComponent<WithRouterProps, State> {
<div className="save-as--options"> <div className="save-as--options">
<Radio> <Radio>
<Radio.Button <Radio.Button
id="save-as-dashboard"
active={saveAsOption === SaveAsOption.Dashboard} active={saveAsOption === SaveAsOption.Dashboard}
value={SaveAsOption.Dashboard} value={SaveAsOption.Dashboard}
onClick={this.handleSetSaveAsOption} onClick={this.handleSetSaveAsOption}
@ -41,6 +42,7 @@ class SaveAsOverlay extends PureComponent<WithRouterProps, State> {
Dashboard Cell Dashboard Cell
</Radio.Button> </Radio.Button>
<Radio.Button <Radio.Button
id="save-as-task"
active={saveAsOption === SaveAsOption.Task} active={saveAsOption === SaveAsOption.Task}
value={SaveAsOption.Task} value={SaveAsOption.Task}
onClick={this.handleSetSaveAsOption} onClick={this.handleSetSaveAsOption}
@ -49,6 +51,7 @@ class SaveAsOverlay extends PureComponent<WithRouterProps, State> {
Task Task
</Radio.Button> </Radio.Button>
<Radio.Button <Radio.Button
id="save-as-variable"
active={saveAsOption === SaveAsOption.Variable} active={saveAsOption === SaveAsOption.Variable}
value={SaveAsOption.Variable} value={SaveAsOption.Variable}
onClick={this.handleSetSaveAsOption} onClick={this.handleSetSaveAsOption}

View File

@ -13,6 +13,7 @@ exports[`LineProtocol rendering renders! 1`] = `
<FancyScrollbar <FancyScrollbar
autoHeight={false} autoHeight={false}
autoHide={false} autoHide={false}
className=""
hideTracksWhenNotNeeded={true} hideTracksWhenNotNeeded={true}
maxHeight={null} maxHeight={null}
setScrollTop={[Function]} setScrollTop={[Function]}

View File

@ -15,6 +15,7 @@ exports[`SideBar rendering renders with children, and renders its children 1`] =
<FancyScrollbar <FancyScrollbar
autoHeight={false} autoHeight={false}
autoHide={false} autoHide={false}
className=""
hideTracksWhenNotNeeded={true} hideTracksWhenNotNeeded={true}
maxHeight={null} maxHeight={null}
setScrollTop={[Function]} setScrollTop={[Function]}
@ -60,6 +61,7 @@ exports[`SideBar rendering renders with no children 1`] = `
<FancyScrollbar <FancyScrollbar
autoHeight={false} autoHeight={false}
autoHide={false} autoHide={false}
className=""
hideTracksWhenNotNeeded={true} hideTracksWhenNotNeeded={true}
maxHeight={null} maxHeight={null}
setScrollTop={[Function]} setScrollTop={[Function]}

View File

@ -13,6 +13,7 @@ exports[`Onboarding.Components.AdminStep renders 1`] = `
<FancyScrollbar <FancyScrollbar
autoHeight={false} autoHeight={false}
autoHide={false} autoHide={false}
className=""
hideTracksWhenNotNeeded={true} hideTracksWhenNotNeeded={true}
maxHeight={null} maxHeight={null}
setScrollTop={[Function]} setScrollTop={[Function]}

View File

@ -10,6 +10,7 @@ exports[`Onboarding.Components.CompletionStep renders 1`] = `
<FancyScrollbar <FancyScrollbar
autoHeight={false} autoHeight={false}
autoHide={false} autoHide={false}
className=""
hideTracksWhenNotNeeded={true} hideTracksWhenNotNeeded={true}
maxHeight={null} maxHeight={null}
setScrollTop={[Function]} setScrollTop={[Function]}

View File

@ -31,6 +31,7 @@ export default class Retention extends PureComponent<Props> {
<> <>
<Radio shape={ButtonShape.StretchToFit} customClass="retention--radio"> <Radio shape={ButtonShape.StretchToFit} customClass="retention--radio">
<Radio.Button <Radio.Button
id="never"
active={type === null} active={type === null}
onClick={this.handleRadioClick} onClick={this.handleRadioClick}
value={null} value={null}
@ -38,6 +39,7 @@ export default class Retention extends PureComponent<Props> {
Never Never
</Radio.Button> </Radio.Button>
<Radio.Button <Radio.Button
id="intervals"
active={type === BucketRetentionRules.TypeEnum.Expire} active={type === BucketRetentionRules.TypeEnum.Expire}
onClick={this.handleRadioClick} onClick={this.handleRadioClick}
value={BucketRetentionRules.TypeEnum.Expire} value={BucketRetentionRules.TypeEnum.Expire}

View File

@ -13,12 +13,12 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props { interface Props {
children: JSX.Element[] children: JSX.Element[]
fullWidth: boolean fullWidth: boolean
inPresentationMode?: boolean inPresentationMode: boolean
} }
@ErrorHandling @ErrorHandling
class PageHeader extends Component<Props> { class PageHeader extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
inPresentationMode: false, inPresentationMode: false,
} }

View File

@ -12,12 +12,12 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props { interface Props {
children: JSX.Element[] | JSX.Element | string | number children: JSX.Element[] | JSX.Element | string | number
widthPixels?: number widthPixels: number
} }
@ErrorHandling @ErrorHandling
class PageHeaderCenter extends Component<Props> { class PageHeaderCenter extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
widthPixels: DEFAULT_PAGE_HEADER_CENTER_WIDTH, widthPixels: DEFAULT_PAGE_HEADER_CENTER_WIDTH,
} }

View File

@ -9,12 +9,12 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props { interface Props {
children: JSX.Element[] | JSX.Element | string | number children: JSX.Element[] | JSX.Element | string | number
offsetPixels?: number offsetPixels: number
} }
@ErrorHandling @ErrorHandling
class PageHeaderLeft extends Component<Props> { class PageHeaderLeft extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
offsetPixels: DEFAULT_OFFSET, offsetPixels: DEFAULT_OFFSET,
} }

View File

@ -9,12 +9,12 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props { interface Props {
children?: JSX.Element[] | JSX.Element | string | number children?: JSX.Element[] | JSX.Element | string | number
offsetPixels?: number offsetPixels: number
} }
@ErrorHandling @ErrorHandling
class PageHeaderRight extends Component<Props> { class PageHeaderRight extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
offsetPixels: DEFAULT_OFFSET, offsetPixels: DEFAULT_OFFSET,
} }

View File

@ -12,19 +12,14 @@ import CopyButton from 'src/shared/components/CopyButton'
// Styles // Styles
import 'src/shared/components/CodeSnippet.scss' import 'src/shared/components/CodeSnippet.scss'
export interface PassedProps { export interface Props {
copyText: string copyText: string
label: string
} }
interface DefaultProps {
label?: string
}
type Props = PassedProps & DefaultProps
@ErrorHandling @ErrorHandling
class CodeSnippet extends PureComponent<Props> { class CodeSnippet extends PureComponent<Props> {
public static defaultProps: DefaultProps = { public static defaultProps = {
label: 'Code Snippet', label: 'Code Snippet',
} }

View File

@ -6,12 +6,12 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
type Position = 'top' | 'bottom' | 'left' | 'right' type Position = 'top' | 'bottom' | 'left' | 'right'
interface Props { interface Props {
text?: string confirmText: string
confirmText?: string
confirmAction: () => void confirmAction: () => void
type?: string type: string
size?: string size: string
square?: boolean square: boolean
text?: string
icon?: string icon?: string
disabled?: boolean disabled?: boolean
customClass?: string customClass?: string
@ -24,7 +24,7 @@ interface State {
@ErrorHandling @ErrorHandling
class ConfirmButton extends PureComponent<Props, State> { class ConfirmButton extends PureComponent<Props, State> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
confirmText: 'Confirm', confirmText: 'Confirm',
type: 'btn-default', type: 'btn-default',
size: 'btn-sm', size: 'btn-sm',

View File

@ -18,11 +18,6 @@ import {notify as notifyAction} from 'src/shared/actions/notifications'
interface OwnProps { interface OwnProps {
textToCopy: string textToCopy: string
contentName: string // if copying a script, its "script" contentName: string // if copying a script, its "script"
size?: ComponentSize
color?: ComponentColor
}
interface DefaultProps {
size: ComponentSize size: ComponentSize
color: ComponentColor color: ComponentColor
} }
@ -34,10 +29,11 @@ interface DispatchProps {
type Props = OwnProps & DispatchProps type Props = OwnProps & DispatchProps
class CopyButton extends PureComponent<Props> { class CopyButton extends PureComponent<Props> {
public static defaultProps: DefaultProps = { public static defaultProps = {
size: ComponentSize.ExtraSmall, size: ComponentSize.ExtraSmall,
color: ComponentColor.Secondary, color: ComponentColor.Secondary,
} }
public render() { public render() {
const {textToCopy, color, size} = this.props const {textToCopy, color, size} = this.props

View File

@ -11,10 +11,10 @@ interface Props {
fileTypesToAccept?: string fileTypesToAccept?: string
containerClass?: string containerClass?: string
handleSubmit: (uploadContent: string | ArrayBuffer, fileName: string) => void handleSubmit: (uploadContent: string | ArrayBuffer, fileName: string) => void
submitText?: string submitText: string
submitOnDrop?: boolean submitOnDrop: boolean
submitOnUpload?: boolean submitOnUpload: boolean
compact?: boolean compact: boolean
onCancel?: () => void onCancel?: () => void
} }
@ -27,7 +27,7 @@ interface State {
let dragCounter = 0 let dragCounter = 0
class DragAndDrop extends PureComponent<Props, State> { class DragAndDrop extends PureComponent<Props, State> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
submitText: 'Write this File', submitText: 'Write this File',
submitOnDrop: false, submitOnDrop: false,
submitOnUpload: false, submitOnUpload: false,

View File

@ -14,21 +14,16 @@ import {RemoteDataState} from 'src/types'
// Decorators // Decorators
import {ErrorHandling} from 'src/shared/decorators/errors' import {ErrorHandling} from 'src/shared/decorators/errors'
interface PassedProps { interface Props {
onUpdate: (name: string) => void onUpdate: (name: string) => void
name: string name: string
noNameString: string
hrefValue: string
testID: string
onEditName?: (e?: MouseEvent<HTMLAnchorElement>) => void onEditName?: (e?: MouseEvent<HTMLAnchorElement>) => void
placeholder?: string placeholder?: string
noNameString: string
} }
interface DefaultProps {
hrefValue?: string
testID?: string
}
type Props = PassedProps & DefaultProps
interface State { interface State {
isEditing: boolean isEditing: boolean
workingName: string workingName: string
@ -37,7 +32,7 @@ interface State {
@ErrorHandling @ErrorHandling
class EditableName extends Component<Props, State> { class EditableName extends Component<Props, State> {
public static defaultProps: DefaultProps = { public static defaultProps = {
hrefValue: '#', hrefValue: '#',
testID: 'editable-name', testID: 'editable-name',
} }

View File

@ -32,16 +32,13 @@ import {DocumentCreate} from '@influxdata/influx'
import {ComponentColor, ComponentSize} from '@influxdata/clockface' import {ComponentColor, ComponentSize} from '@influxdata/clockface'
import {RemoteDataState} from 'src/types' import {RemoteDataState} from 'src/types'
interface OwnProps extends DefaultProps { interface OwnProps {
onDismissOverlay: () => void onDismissOverlay: () => void
resource: DocumentCreate resource: DocumentCreate
resourceName: string resourceName: string
orgID: string orgID: string
status: RemoteDataState status: RemoteDataState
} isVisible: boolean
interface DefaultProps {
isVisible?: boolean
} }
interface DispatchProps { interface DispatchProps {
@ -51,7 +48,7 @@ interface DispatchProps {
type Props = OwnProps & DispatchProps type Props = OwnProps & DispatchProps
class ExportOverlay extends PureComponent<Props> { class ExportOverlay extends PureComponent<Props> {
public static defaultProps: DefaultProps = { public static defaultProps = {
isVisible: true, isVisible: true,
} }

View File

@ -3,12 +3,12 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props { interface Props {
wrapperClass: string wrapperClass: string
tabIndex: number
value?: string value?: string
onChange?: (value: string) => void onChange?: (value: string) => void
onKeyDown?: (value: string) => void onKeyDown?: (value: string) => void
onBlur: (value: string) => void onBlur: (value: string) => void
disabled?: boolean disabled?: boolean
tabIndex?: number
placeholder?: string placeholder?: string
appearAsNormalInput?: boolean appearAsNormalInput?: boolean
} }
@ -20,7 +20,7 @@ interface State {
@ErrorHandling @ErrorHandling
class InputClickToEdit extends PureComponent<Props, State> { class InputClickToEdit extends PureComponent<Props, State> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
tabIndex: 0, tabIndex: 0,
} }

View File

@ -1,24 +0,0 @@
import React, {Component} from 'react'
interface Props {
className?: string
}
class LoadingDots extends Component<Props> {
public static defaultProps: Partial<Props> = {
className: '',
}
public render() {
const {className} = this.props
return (
<div className={`loading-dots ${className}`}>
<div />
<div />
<div />
</div>
)
}
}
export default LoadingDots

View File

@ -12,7 +12,7 @@ export interface MenuItem {
} }
interface Props { interface Props {
theme?: string theme: string
icon: string icon: string
informParent: () => void informParent: () => void
menuItems: MenuItem[] menuItems: MenuItem[]
@ -24,7 +24,7 @@ interface State {
@ErrorHandling @ErrorHandling
export default class MenuTooltipButton extends Component<Props, State> { export default class MenuTooltipButton extends Component<Props, State> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
theme: 'default', theme: 'default',
} }

View File

@ -44,7 +44,7 @@ interface State {
type Props = OwnProps & StateProps type Props = OwnProps & StateProps
class RefreshingView extends PureComponent<Props, State> { class RefreshingView extends PureComponent<Props, State> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
inView: true, inView: true,
manualRefresh: 0, manualRefresh: 0,
} }

View File

@ -18,11 +18,12 @@ interface Props extends DropdownProps {
searchTerm?: string searchTerm?: string
searchPlaceholder?: string searchPlaceholder?: string
onChangeSearchTerm?: (value: string) => void onChangeSearchTerm?: (value: string) => void
buttonSize: ComponentSize
} }
@ErrorHandling @ErrorHandling
export default class SearchableDropdown extends Component<Props> { export default class SearchableDropdown extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
buttonSize: ComponentSize.Small, buttonSize: ComponentSize.Small,
} }

View File

@ -17,13 +17,13 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props { interface Props {
selected: number selected: number
onChoose: (milliseconds: number) => void onChoose: (milliseconds: number) => void
showManualRefresh?: boolean showManualRefresh: boolean
onManualRefresh?: () => void onManualRefresh?: () => void
} }
@ErrorHandling @ErrorHandling
class AutoRefreshDropdown extends Component<Props> { class AutoRefreshDropdown extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
showManualRefresh: true, showManualRefresh: true,
} }

View File

@ -19,22 +19,15 @@ import {withHoverTime, InjectedHoverProps} from 'src/dashboards/utils/hoverTime'
// Constants // Constants
import {LINE_COLORS, LABEL_WIDTH, CHAR_PIXELS} from 'src/shared/graphs/helpers' import {LINE_COLORS, LABEL_WIDTH, CHAR_PIXELS} from 'src/shared/graphs/helpers'
import {getLineColorsHexes} from 'src/shared/constants/graphColorPalettes' import {getLineColorsHexes} from 'src/shared/constants/graphColorPalettes'
import { import {DEFAULT_AXIS} from 'src/dashboards/constants/cellEditor'
AXES_SCALE_OPTIONS,
DEFAULT_AXIS,
} from 'src/dashboards/constants/cellEditor'
// Types // Types
import {Axes, TimeRange} from 'src/types' import {Axes, TimeRange, Base, Scale, DashboardQuery, Color} from 'src/types'
import {DygraphData, Options, SeriesLegendData} from 'src/external/dygraph' import {DygraphData, Options, SeriesLegendData} from 'src/external/dygraph'
import {Color} from 'src/types/colors'
import {DashboardQuery} from 'src/types/dashboards'
import {SeriesDescription} from 'src/shared/parsing/flux/spreadTables' import {SeriesDescription} from 'src/shared/parsing/flux/spreadTables'
const getRangeMemoizedY = memoizeOne(getRange) const getRangeMemoizedY = memoizeOne(getRange)
const {LOG, BASE_10, BASE_2} = AXES_SCALE_OPTIONS
const DEFAULT_DYGRAPH_OPTIONS = { const DEFAULT_DYGRAPH_OPTIONS = {
yRangePad: 10, yRangePad: 10,
labelsKMB: true, labelsKMB: true,
@ -55,20 +48,18 @@ interface LegendData {
} }
interface OwnProps { interface OwnProps {
axes: Axes
viewID: string viewID: string
queries?: DashboardQuery[]
timeSeries: DygraphData
labels: string[]
seriesDescriptions: SeriesDescription[]
options?: Partial<Options>
colors: Color[] colors: Color[]
timeRange?: TimeRange labels: string[]
axes?: Axes timeSeries: DygraphData
isGraphFilled?: boolean options: Partial<Options>
onZoom?: (timeRange: TimeRange) => void seriesDescriptions: SeriesDescription[]
onZoom: (timeRange: TimeRange) => void
mode?: string mode?: string
underlayCallback?: () => void timeRange?: TimeRange
children?: JSX.Element children?: JSX.Element
queries?: DashboardQuery[]
} }
type Props = OwnProps & InjectedHoverProps type Props = OwnProps & InjectedHoverProps
@ -85,24 +76,23 @@ interface State {
@ErrorHandling @ErrorHandling
class Dygraph extends Component<Props, State> { class Dygraph extends Component<Props, State> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
onZoom: () => {},
axes: { axes: {
x: { x: {
bounds: [null, null], prefix: '',
suffix: '',
base: Base.Ten,
scale: Scale.Linear,
label: '',
...DEFAULT_AXIS, ...DEFAULT_AXIS,
bounds: [null, null] as [null, null],
}, },
y: { y: {
bounds: [null, null],
...DEFAULT_AXIS,
},
y2: {
bounds: undefined,
...DEFAULT_AXIS, ...DEFAULT_AXIS,
bounds: [null, null] as [null, null],
}, },
}, },
isGraphFilled: true,
onZoom: () => {},
underlayCallback: () => {},
options: {}, options: {},
} }
@ -244,7 +234,7 @@ class Dygraph extends Component<Props, State> {
const [min, max] = range const [min, max] = range
// Bug in Dygraph calculates a negative range for logscale when min range is 0 // Bug in Dygraph calculates a negative range for logscale when min range is 0
if (y.scale === LOG && min <= 0) { if (y.scale === Scale.Log && min <= 0) {
range = [0.01, max] range = [0.01, max]
} }
@ -282,8 +272,6 @@ class Dygraph extends Component<Props, State> {
const { const {
labels, labels,
axes: {y}, axes: {y},
underlayCallback,
isGraphFilled,
options: passedOptions, options: passedOptions,
} = this.props } = this.props
@ -298,18 +286,17 @@ class Dygraph extends Component<Props, State> {
const options = { const options = {
labels, labels,
underlayCallback,
colors, colors,
file: timeSeries as any, file: timeSeries as any,
zoomCallback: handleZoom, zoomCallback: handleZoom,
fillGraph: isGraphFilled, fillGraph: true,
logscale: y.scale === LOG, logscale: y.scale === Scale.Log,
ylabel: yLabel, ylabel: yLabel,
axes: { axes: {
y: { y: {
axisLabelWidth: labelWidth, axisLabelWidth: labelWidth,
labelsKMB: y.base === BASE_10, labelsKMB: y.base === Base.Ten,
labelsKMG2: y.base === BASE_2, labelsKMG2: y.base === Base.Two,
axisLabelFormatter: formatYVal, axisLabelFormatter: formatYVal,
valueRange: this.getYRange(timeSeries), valueRange: this.getYRange(timeSeries),
}, },
@ -400,4 +387,4 @@ class Dygraph extends Component<Props, State> {
} }
} }
export default withHoverTime(Dygraph) export default withHoverTime<OwnProps>(Dygraph)

View File

@ -7,17 +7,14 @@ import {Scrollbars} from '@influxdata/react-custom-scrollbars'
// Decorators // Decorators
import {ErrorHandling} from 'src/shared/decorators/errors' import {ErrorHandling} from 'src/shared/decorators/errors'
interface DefaultProps { interface Props {
className: string
maxHeight: number
autoHide: boolean autoHide: boolean
autoHeight: boolean autoHeight: boolean
maxHeight: number
setScrollTop: (value: React.MouseEvent<HTMLElement>) => void
style: React.CSSProperties style: React.CSSProperties
hideTracksWhenNotNeeded?: boolean hideTracksWhenNotNeeded: boolean
} setScrollTop: (value: React.MouseEvent<HTMLElement>) => void
interface Props {
className?: string
scrollTop?: number scrollTop?: number
scrollLeft?: number scrollLeft?: number
thumbStartColor?: string thumbStartColor?: string
@ -25,11 +22,12 @@ interface Props {
} }
@ErrorHandling @ErrorHandling
class FancyScrollbar extends Component<Props & Partial<DefaultProps>> { class FancyScrollbar extends Component<Props> {
public static defaultProps: DefaultProps = { public static defaultProps = {
className: '',
autoHide: true, autoHide: true,
hideTracksWhenNotNeeded: true,
autoHeight: false, autoHeight: false,
hideTracksWhenNotNeeded: true,
maxHeight: null, maxHeight: null,
style: {}, style: {},
setScrollTop: () => {}, setScrollTop: () => {},

View File

@ -4,13 +4,14 @@ import {Notification as NotificationType} from 'src/types/notifications'
import Notification from 'src/shared/components/notifications/Notification' import Notification from 'src/shared/components/notifications/Notification'
interface Props { interface Props {
inPresentationMode?: boolean
notifications: NotificationType[] notifications: NotificationType[]
inPresentationMode: boolean
} }
class Notifications extends PureComponent<Props> { class Notifications extends PureComponent<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
inPresentationMode: false, inPresentationMode: false,
notifications: [],
} }
public render() { public render() {

View File

@ -19,12 +19,12 @@ export enum PermissionsWidgetSelection {
interface Props { interface Props {
children: JSX.Element[] | JSX.Element children: JSX.Element[] | JSX.Element
mode: PermissionsWidgetMode mode: PermissionsWidgetMode
heightPixels?: number heightPixels: number
className?: string className?: string
} }
class PermissionsWidget extends Component<Props> { class PermissionsWidget extends Component<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
heightPixels: 500, heightPixels: 500,
} }

View File

@ -13,8 +13,8 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props { interface Props {
onSearch: (searchTerm: string) => void onSearch: (searchTerm: string) => void
widthPixels?: number widthPixels: number
placeholderText?: string placeholderText: string
searchTerm: string searchTerm: string
} }
@ -24,7 +24,7 @@ interface State {
@ErrorHandling @ErrorHandling
class SearchWidget extends Component<Props, State> { class SearchWidget extends Component<Props, State> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
widthPixels: 440, widthPixels: 440,
placeholderText: 'Search...', placeholderText: 'Search...',
searchTerm: '', searchTerm: '',

View File

@ -17,15 +17,15 @@ import {
const NOOP = () => {} const NOOP = () => {}
interface Props { interface Props {
name?: string
handleDisplay?: string
style?: CSSProperties
handlePixels: number handlePixels: number
id: string id: string
size: number size: number
name: string
offset: number offset: number
draggable: boolean draggable: boolean
orientation: string orientation: string
handleDisplay: string
style: CSSProperties
activeHandleID: string activeHandleID: string
headerOrientation: string headerOrientation: string
render: (visibility: string, pixels: number) => ReactElement<any> render: (visibility: string, pixels: number) => ReactElement<any>
@ -37,7 +37,7 @@ interface Props {
} }
class Division extends PureComponent<Props> { class Division extends PureComponent<Props> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
name: '', name: '',
handleDisplay: 'visible', handleDisplay: 'visible',
style: {}, style: {},

View File

@ -48,12 +48,12 @@ interface DivisionState extends DivisionProps {
interface Props { interface Props {
divisions: DivisionProps[] divisions: DivisionProps[]
orientation: string orientation: string
containerClass?: string containerClass: string
} }
@ErrorHandling @ErrorHandling
class Threesizer extends Component<Props, State> { class Threesizer extends Component<Props, State> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
orientation: HANDLE_HORIZONTAL, orientation: HANDLE_HORIZONTAL,
containerClass: '', containerClass: '',
} }

View File

@ -7,7 +7,7 @@ import {
} from 'src/shared/constants/thresholds' } from 'src/shared/constants/thresholds'
// Types // Types
import {ViewType, ViewShape} from 'src/types' import {ViewType, ViewShape, Base, Scale} from 'src/types'
import {HistogramPosition} from 'src/minard' import {HistogramPosition} from 'src/minard'
import { import {
XYView, XYView,
@ -56,24 +56,16 @@ function defaultLineViewProperties() {
label: '', label: '',
prefix: '', prefix: '',
suffix: '', suffix: '',
base: '10', base: Base.Ten,
scale: 'linear', scale: Scale.Linear,
}, },
y: { y: {
bounds: ['', ''] as [string, string], bounds: ['', ''] as [string, string],
label: '', label: '',
prefix: '', prefix: '',
suffix: '', suffix: '',
base: '10', base: Base.Ten,
scale: 'linear', scale: Scale.Linear,
},
y2: {
bounds: ['', ''] as [string, string],
label: '',
prefix: '',
suffix: '',
base: '10',
scale: 'linear',
}, },
}, },
} }

View File

@ -36,15 +36,15 @@ import {TaskOptions, TaskSchedule} from 'src/utils/taskOptionsToFluxScript'
interface Props { interface Props {
orgs: Organization[] orgs: Organization[]
taskOptions: TaskOptions taskOptions: TaskOptions
isInOverlay: boolean
canSubmit: boolean
onSubmit: () => void
dismiss: () => void
onChangeScheduleType: (schedule: TaskSchedule) => void onChangeScheduleType: (schedule: TaskSchedule) => void
onChangeInput: (e: ChangeEvent<HTMLInputElement>) => void onChangeInput: (e: ChangeEvent<HTMLInputElement>) => void
onChangeTaskOrgID: (orgID: string) => void onChangeTaskOrgID: (orgID: string) => void
onChangeToOrgName: (orgName: string) => void onChangeToOrgName: (orgName: string) => void
onChangeToBucketName: (bucketName: string) => void onChangeToBucketName: (bucketName: string) => void
isInOverlay?: boolean
onSubmit?: () => void
canSubmit?: boolean
dismiss?: () => void
} }
interface State { interface State {
@ -54,12 +54,15 @@ interface State {
const getBuckets = (org: Organization) => client.buckets.getAllByOrg(org.name) const getBuckets = (org: Organization) => client.buckets.getAllByOrg(org.name)
export default class TaskForm extends PureComponent<Props, State> { export default class TaskForm extends PureComponent<Props, State> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
isInOverlay: false, isInOverlay: false,
onSubmit: () => {},
canSubmit: true, canSubmit: true,
onSubmit: () => {},
dismiss: () => {}, dismiss: () => {},
onChangeToBucketName: () => {},
onChangeToOrgName: () => {},
} }
constructor(props: Props) { constructor(props: Props) {
super(props) super(props)

View File

@ -88,8 +88,8 @@ class TaskPage extends PureComponent<
<div className="task-form--options"> <div className="task-form--options">
<TaskForm <TaskForm
orgs={orgs} orgs={orgs}
canSubmit={this.isFormValid}
taskOptions={taskOptions} taskOptions={taskOptions}
canSubmit={this.isFormValid}
onChangeInput={this.handleChangeInput} onChangeInput={this.handleChangeInput}
onChangeScheduleType={this.handleChangeScheduleType} onChangeScheduleType={this.handleChangeScheduleType}
onChangeTaskOrgID={this.handleChangeTaskOrgID} onChangeTaskOrgID={this.handleChangeTaskOrgID}

View File

@ -113,12 +113,12 @@ class TagSelector extends PureComponent<Props> {
> >
<SearchableDropdown <SearchableDropdown
searchTerm={keysSearchTerm} searchTerm={keysSearchTerm}
titleText="No Tags Found"
searchPlaceholder="Search keys..." searchPlaceholder="Search keys..."
onChangeSearchTerm={this.handleKeysSearch}
selectedID={selectedKey} selectedID={selectedKey}
onChange={this.handleSelectTag} onChange={this.handleSelectTag}
status={toComponentStatus(keysStatus)} status={toComponentStatus(keysStatus)}
titleText="No Tags Found" onChangeSearchTerm={this.handleKeysSearch}
testID="tag-selector--dropdown" testID="tag-selector--dropdown"
buttonTestID="tag-selector--dropdown-button" buttonTestID="tag-selector--dropdown-button"
> >

View File

@ -1,20 +1,15 @@
// Libraries // Libraries
import React, {PureComponent} from 'react' import React, {PureComponent} from 'react'
interface PassedProps { interface Props {
onSetActive: () => void onSetActive: () => void
name: string name: string
active: boolean active: boolean
testID: string
} }
interface DefaultProps {
testID?: string
}
type Props = PassedProps & DefaultProps
export default class ToolbarTab extends PureComponent<Props> { export default class ToolbarTab extends PureComponent<Props> {
public static defaultProps: DefaultProps = { public static defaultProps = {
testID: 'toolbar-tab', testID: 'toolbar-tab',
} }

View File

@ -11,7 +11,7 @@ import {FluxToolbarFunction} from 'src/types/shared'
interface Props { interface Props {
func: FluxToolbarFunction func: FluxToolbarFunction
onClickFunction: (name: string, example: string) => void onClickFunction: (name: string, example: string) => void
testID?: string testID: string
} }
interface State { interface State {
@ -19,7 +19,7 @@ interface State {
} }
class ToolbarFunction extends PureComponent<Props, State> { class ToolbarFunction extends PureComponent<Props, State> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
testID: 'toolbar-function', testID: 'toolbar-function',
} }

View File

@ -22,11 +22,11 @@ import {SeverityColor, SeverityColorOptions} from 'src/types/logs'
import {ErrorHandling} from 'src/shared/decorators/errors' import {ErrorHandling} from 'src/shared/decorators/errors'
interface Props { interface Props {
label?: string
threshold: Color threshold: Color
isBase?: boolean label: string
isDeletable?: boolean isBase: boolean
disableColor?: boolean isDeletable: boolean
disableColor: boolean
onChooseColor: (threshold: Color) => void onChooseColor: (threshold: Color) => void
onValidateColorValue: (threshold: Color, targetValue: number) => boolean onValidateColorValue: (threshold: Color, targetValue: number) => boolean
onUpdateColorValue: (threshold: Color, targetValue: number) => void onUpdateColorValue: (threshold: Color, targetValue: number) => void
@ -40,7 +40,7 @@ interface State {
@ErrorHandling @ErrorHandling
class Threshold extends PureComponent<Props, State> { class Threshold extends PureComponent<Props, State> {
public static defaultProps: Partial<Props> = { public static defaultProps = {
label: 'Value is <=', label: 'Value is <=',
disableColor: false, disableColor: false,
isDeletable: true, isDeletable: true,

View File

@ -7,13 +7,23 @@ import {
Cell as CellAPI, Cell as CellAPI,
} from '@influxdata/influx' } from '@influxdata/influx'
export enum Scale {
Linear = 'linear',
Log = 'log',
}
export enum Base {
Two = '2',
Ten = '10',
}
export interface Axis { export interface Axis {
label: string label: string
prefix: string prefix: string
suffix: string suffix: string
base: string base: Base
scale: string scale: Scale
bounds: [string, string] bounds: [string, string] | [null, null]
} }
export type TimeSeriesValue = string | number | null | undefined export type TimeSeriesValue = string | number | null | undefined