Refactor cellEditorOverlay types file structure & imports to new style
parent
28b919908b
commit
a57055772a
|
@ -1,211 +1,114 @@
|
||||||
import {Cell} from 'src/types'
|
import {Cell} from 'src/types'
|
||||||
import {CellType, ThresholdType} from 'src/types/dashboards'
|
|
||||||
import {ColorNumber, ColorString} from 'src/types/colors'
|
import {ColorNumber, ColorString} from 'src/types/colors'
|
||||||
import {
|
import * as DashboardData from 'src/types/dashboards'
|
||||||
Axes,
|
import * as CellEditorOverlayActions from 'src/types/actions/cellEditorOverlay'
|
||||||
DecimalPlaces,
|
|
||||||
FieldOption,
|
|
||||||
TableOptions,
|
|
||||||
} from 'src/types/dashboards'
|
|
||||||
|
|
||||||
export type Action =
|
export const showCellEditorOverlay: CellEditorOverlayActions.ShowCellEditorOverlayActionCreator = (
|
||||||
| ShowCellEditorOverlayAction
|
|
||||||
| HideCellEditorOverlayAction
|
|
||||||
| ChangeCellTypeAction
|
|
||||||
| RenameCellAction
|
|
||||||
| UpdateThresholdsListColorsAction
|
|
||||||
| UpdateThresholdsListTypeAction
|
|
||||||
| UpdateGaugeColorsAction
|
|
||||||
| UpdateAxesAction
|
|
||||||
| UpdateTableOptionsAction
|
|
||||||
| UpdateLineColorsAction
|
|
||||||
| ChangeTimeFormatAction
|
|
||||||
| ChangeDecimalPlacesAction
|
|
||||||
| UpdateFieldOptionsAction
|
|
||||||
|
|
||||||
export type ShowCellEditorOverlayActionCreator = (
|
|
||||||
cell: Cell
|
cell: Cell
|
||||||
) => ShowCellEditorOverlayAction
|
): CellEditorOverlayActions.ShowCellEditorOverlayAction => ({
|
||||||
|
|
||||||
interface ShowCellEditorOverlayAction {
|
|
||||||
type: 'SHOW_CELL_EDITOR_OVERLAY'
|
|
||||||
payload: {
|
|
||||||
cell: Cell
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export const showCellEditorOverlay: ShowCellEditorOverlayActionCreator = (
|
|
||||||
cell: Cell
|
|
||||||
): ShowCellEditorOverlayAction => ({
|
|
||||||
type: 'SHOW_CELL_EDITOR_OVERLAY',
|
type: 'SHOW_CELL_EDITOR_OVERLAY',
|
||||||
payload: {
|
payload: {
|
||||||
cell,
|
cell,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
export type HideCellEditorOverlayActionCreator = () => HideCellEditorOverlayAction
|
export const hideCellEditorOverlay = (): CellEditorOverlayActions.HideCellEditorOverlayAction => ({
|
||||||
|
|
||||||
interface HideCellEditorOverlayAction {
|
|
||||||
type: 'HIDE_CELL_EDITOR_OVERLAY'
|
|
||||||
}
|
|
||||||
export const hideCellEditorOverlay = (): HideCellEditorOverlayAction => ({
|
|
||||||
type: 'HIDE_CELL_EDITOR_OVERLAY',
|
type: 'HIDE_CELL_EDITOR_OVERLAY',
|
||||||
})
|
})
|
||||||
|
|
||||||
interface ChangeCellTypeAction {
|
export const changeCellType = (
|
||||||
type: 'CHANGE_CELL_TYPE'
|
cellType: DashboardData.CellType
|
||||||
payload: {
|
): CellEditorOverlayActions.ChangeCellTypeAction => ({
|
||||||
cellType: CellType
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const changeCellType = (cellType: CellType): ChangeCellTypeAction => ({
|
|
||||||
type: 'CHANGE_CELL_TYPE',
|
type: 'CHANGE_CELL_TYPE',
|
||||||
payload: {
|
payload: {
|
||||||
cellType,
|
cellType,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
interface RenameCellAction {
|
export const renameCell = (
|
||||||
type: 'RENAME_CELL'
|
cellName: string
|
||||||
payload: {
|
): CellEditorOverlayActions.RenameCellAction => ({
|
||||||
cellName: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export const renameCell = (cellName: string): RenameCellAction => ({
|
|
||||||
type: 'RENAME_CELL',
|
type: 'RENAME_CELL',
|
||||||
payload: {
|
payload: {
|
||||||
cellName,
|
cellName,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
interface UpdateThresholdsListColorsAction {
|
|
||||||
type: 'UPDATE_THRESHOLDS_LIST_COLORS'
|
|
||||||
payload: {
|
|
||||||
thresholdsListColors: ColorNumber[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export const updateThresholdsListColors = (
|
export const updateThresholdsListColors = (
|
||||||
thresholdsListColors: ColorNumber[]
|
thresholdsListColors: ColorNumber[]
|
||||||
): UpdateThresholdsListColorsAction => ({
|
): CellEditorOverlayActions.UpdateThresholdsListColorsAction => ({
|
||||||
type: 'UPDATE_THRESHOLDS_LIST_COLORS',
|
type: 'UPDATE_THRESHOLDS_LIST_COLORS',
|
||||||
payload: {
|
payload: {
|
||||||
thresholdsListColors,
|
thresholdsListColors,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
interface UpdateThresholdsListTypeAction {
|
|
||||||
type: 'UPDATE_THRESHOLDS_LIST_TYPE'
|
|
||||||
payload: {
|
|
||||||
thresholdsListType: ThresholdType
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const updateThresholdsListType = (
|
export const updateThresholdsListType = (
|
||||||
thresholdsListType: ThresholdType
|
thresholdsListType: DashboardData.ThresholdType
|
||||||
): UpdateThresholdsListTypeAction => ({
|
): CellEditorOverlayActions.UpdateThresholdsListTypeAction => ({
|
||||||
type: 'UPDATE_THRESHOLDS_LIST_TYPE',
|
type: 'UPDATE_THRESHOLDS_LIST_TYPE',
|
||||||
payload: {
|
payload: {
|
||||||
thresholdsListType,
|
thresholdsListType,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
interface UpdateGaugeColorsAction {
|
|
||||||
type: 'UPDATE_GAUGE_COLORS'
|
|
||||||
payload: {
|
|
||||||
gaugeColors: ColorNumber[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export const updateGaugeColors = (
|
export const updateGaugeColors = (
|
||||||
gaugeColors: ColorNumber[]
|
gaugeColors: ColorNumber[]
|
||||||
): UpdateGaugeColorsAction => ({
|
): CellEditorOverlayActions.UpdateGaugeColorsAction => ({
|
||||||
type: 'UPDATE_GAUGE_COLORS',
|
type: 'UPDATE_GAUGE_COLORS',
|
||||||
payload: {
|
payload: {
|
||||||
gaugeColors,
|
gaugeColors,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
interface UpdateAxesAction {
|
export const updateAxes = (
|
||||||
type: 'UPDATE_AXES'
|
axes: DashboardData.Axes
|
||||||
payload: {
|
): CellEditorOverlayActions.UpdateAxesAction => ({
|
||||||
axes: Axes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export const updateAxes = (axes: Axes): UpdateAxesAction => ({
|
|
||||||
type: 'UPDATE_AXES',
|
type: 'UPDATE_AXES',
|
||||||
payload: {
|
payload: {
|
||||||
axes,
|
axes,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
interface UpdateTableOptionsAction {
|
|
||||||
type: 'UPDATE_TABLE_OPTIONS'
|
|
||||||
payload: {
|
|
||||||
tableOptions: TableOptions
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export const updateTableOptions = (
|
export const updateTableOptions = (
|
||||||
tableOptions: TableOptions
|
tableOptions: DashboardData.TableOptions
|
||||||
): UpdateTableOptionsAction => ({
|
): CellEditorOverlayActions.UpdateTableOptionsAction => ({
|
||||||
type: 'UPDATE_TABLE_OPTIONS',
|
type: 'UPDATE_TABLE_OPTIONS',
|
||||||
payload: {
|
payload: {
|
||||||
tableOptions,
|
tableOptions,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
interface UpdateLineColorsAction {
|
|
||||||
type: 'UPDATE_LINE_COLORS'
|
|
||||||
payload: {
|
|
||||||
lineColors: ColorString[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export const updateLineColors = (
|
export const updateLineColors = (
|
||||||
lineColors: ColorString[]
|
lineColors: ColorString[]
|
||||||
): UpdateLineColorsAction => ({
|
): CellEditorOverlayActions.UpdateLineColorsAction => ({
|
||||||
type: 'UPDATE_LINE_COLORS',
|
type: 'UPDATE_LINE_COLORS',
|
||||||
payload: {
|
payload: {
|
||||||
lineColors,
|
lineColors,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
interface ChangeTimeFormatAction {
|
|
||||||
type: 'CHANGE_TIME_FORMAT'
|
|
||||||
payload: {
|
|
||||||
timeFormat: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export const changeTimeFormat = (
|
export const changeTimeFormat = (
|
||||||
timeFormat: string
|
timeFormat: string
|
||||||
): ChangeTimeFormatAction => ({
|
): CellEditorOverlayActions.ChangeTimeFormatAction => ({
|
||||||
type: 'CHANGE_TIME_FORMAT',
|
type: 'CHANGE_TIME_FORMAT',
|
||||||
payload: {
|
payload: {
|
||||||
timeFormat,
|
timeFormat,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
interface ChangeDecimalPlacesAction {
|
|
||||||
type: 'CHANGE_DECIMAL_PLACES'
|
|
||||||
payload: {
|
|
||||||
decimalPlaces: DecimalPlaces
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export const changeDecimalPlaces = (
|
export const changeDecimalPlaces = (
|
||||||
decimalPlaces: DecimalPlaces
|
decimalPlaces: DashboardData.DecimalPlaces
|
||||||
): ChangeDecimalPlacesAction => ({
|
): CellEditorOverlayActions.ChangeDecimalPlacesAction => ({
|
||||||
type: 'CHANGE_DECIMAL_PLACES',
|
type: 'CHANGE_DECIMAL_PLACES',
|
||||||
payload: {
|
payload: {
|
||||||
decimalPlaces,
|
decimalPlaces,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
interface UpdateFieldOptionsAction {
|
|
||||||
type: 'UPDATE_FIELD_OPTIONS'
|
|
||||||
payload: {
|
|
||||||
fieldOptions: FieldOption[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export const updateFieldOptions = (
|
export const updateFieldOptions = (
|
||||||
fieldOptions: FieldOption[]
|
fieldOptions: DashboardData.FieldOption[]
|
||||||
): UpdateFieldOptionsAction => ({
|
): CellEditorOverlayActions.UpdateFieldOptionsAction => ({
|
||||||
type: 'UPDATE_FIELD_OPTIONS',
|
type: 'UPDATE_FIELD_OPTIONS',
|
||||||
payload: {
|
payload: {
|
||||||
fieldOptions,
|
fieldOptions,
|
||||||
|
|
|
@ -63,7 +63,7 @@ import {DashboardName} from 'src/types/dashboards'
|
||||||
import {ColorNumber, ColorString} from 'src/types/colors'
|
import {ColorNumber, ColorString} from 'src/types/colors'
|
||||||
import * as AnnotationActions from 'src/types/actions/annotations'
|
import * as AnnotationActions from 'src/types/actions/annotations'
|
||||||
import * as AppActions from 'src/shared/actions/app'
|
import * as AppActions from 'src/shared/actions/app'
|
||||||
import * as CellEditorOverlayActions from 'src/dashboards/actions/cellEditorOverlay'
|
import * as CellEditorOverlayActions from 'src/types/actions/cellEditorOverlay'
|
||||||
import * as DashboardActions from 'src/types/actions/dashboards'
|
import * as DashboardActions from 'src/types/actions/dashboards'
|
||||||
import * as ErrorActions from 'src/types/actions/errors'
|
import * as ErrorActions from 'src/types/actions/errors'
|
||||||
import * as NotificationActions from 'src/types/actions/notifications'
|
import * as NotificationActions from 'src/types/actions/notifications'
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {
|
||||||
} from 'src/shared/constants/graphColorPalettes'
|
} from 'src/shared/constants/graphColorPalettes'
|
||||||
|
|
||||||
import {initializeOptions} from 'src/dashboards/constants/cellEditor'
|
import {initializeOptions} from 'src/dashboards/constants/cellEditor'
|
||||||
import {Action} from 'src/dashboards/actions/cellEditorOverlay'
|
import {Action} from 'src/types/actions/cellEditorOverlay'
|
||||||
import {CellType, Cell} from 'src/types'
|
import {CellType, Cell} from 'src/types'
|
||||||
import {ThresholdType, TableOptions} from 'src/types/dashboards'
|
import {ThresholdType, TableOptions} from 'src/types/dashboards'
|
||||||
import {ThresholdColor, GaugeColor, LineColor} from 'src/types/colors'
|
import {ThresholdColor, GaugeColor, LineColor} from 'src/types/colors'
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
import {Cell} from 'src/types'
|
||||||
|
import {ColorNumber, ColorString} from 'src/types/colors'
|
||||||
|
import * as DashboardData from 'src/types/dashboards'
|
||||||
|
|
||||||
|
export type Action =
|
||||||
|
| ShowCellEditorOverlayAction
|
||||||
|
| HideCellEditorOverlayAction
|
||||||
|
| ChangeCellTypeAction
|
||||||
|
| RenameCellAction
|
||||||
|
| UpdateThresholdsListColorsAction
|
||||||
|
| UpdateThresholdsListTypeAction
|
||||||
|
| UpdateGaugeColorsAction
|
||||||
|
| UpdateAxesAction
|
||||||
|
| UpdateTableOptionsAction
|
||||||
|
| UpdateLineColorsAction
|
||||||
|
| ChangeTimeFormatAction
|
||||||
|
| ChangeDecimalPlacesAction
|
||||||
|
| UpdateFieldOptionsAction
|
||||||
|
|
||||||
|
export type ShowCellEditorOverlayActionCreator = (
|
||||||
|
cell: Cell
|
||||||
|
) => ShowCellEditorOverlayAction
|
||||||
|
|
||||||
|
export interface ShowCellEditorOverlayAction {
|
||||||
|
type: 'SHOW_CELL_EDITOR_OVERLAY'
|
||||||
|
payload: {
|
||||||
|
cell: Cell
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export type HideCellEditorOverlayActionCreator = () => HideCellEditorOverlayAction
|
||||||
|
|
||||||
|
export interface HideCellEditorOverlayAction {
|
||||||
|
type: 'HIDE_CELL_EDITOR_OVERLAY'
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ChangeCellTypeAction {
|
||||||
|
type: 'CHANGE_CELL_TYPE'
|
||||||
|
payload: {
|
||||||
|
cellType: DashboardData.CellType
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RenameCellAction {
|
||||||
|
type: 'RENAME_CELL'
|
||||||
|
payload: {
|
||||||
|
cellName: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateThresholdsListColorsAction {
|
||||||
|
type: 'UPDATE_THRESHOLDS_LIST_COLORS'
|
||||||
|
payload: {
|
||||||
|
thresholdsListColors: ColorNumber[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateThresholdsListTypeAction {
|
||||||
|
type: 'UPDATE_THRESHOLDS_LIST_TYPE'
|
||||||
|
payload: {
|
||||||
|
thresholdsListType: DashboardData.ThresholdType
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateGaugeColorsAction {
|
||||||
|
type: 'UPDATE_GAUGE_COLORS'
|
||||||
|
payload: {
|
||||||
|
gaugeColors: ColorNumber[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateAxesAction {
|
||||||
|
type: 'UPDATE_AXES'
|
||||||
|
payload: {
|
||||||
|
axes: DashboardData.Axes
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateTableOptionsAction {
|
||||||
|
type: 'UPDATE_TABLE_OPTIONS'
|
||||||
|
payload: {
|
||||||
|
tableOptions: DashboardData.TableOptions
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateLineColorsAction {
|
||||||
|
type: 'UPDATE_LINE_COLORS'
|
||||||
|
payload: {
|
||||||
|
lineColors: ColorString[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ChangeTimeFormatAction {
|
||||||
|
type: 'CHANGE_TIME_FORMAT'
|
||||||
|
payload: {
|
||||||
|
timeFormat: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ChangeDecimalPlacesAction {
|
||||||
|
type: 'CHANGE_DECIMAL_PLACES'
|
||||||
|
payload: {
|
||||||
|
decimalPlaces: DashboardData.DecimalPlaces
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateFieldOptionsAction {
|
||||||
|
type: 'UPDATE_FIELD_OPTIONS'
|
||||||
|
payload: {
|
||||||
|
fieldOptions: DashboardData.FieldOption[]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue