Refactor app action types file structure & imports to new style
parent
5a1a888e42
commit
72d913b955
|
@ -13,7 +13,7 @@ import DashboardSwitcher from 'src/dashboards/components/DashboardSwitcher'
|
||||||
|
|
||||||
import {Dashboard, TimeRange} from 'src/types'
|
import {Dashboard, TimeRange} from 'src/types'
|
||||||
import {DashboardName} from 'src/types/dashboards'
|
import {DashboardName} from 'src/types/dashboards'
|
||||||
import * as AppActions from 'src/shared/actions/app'
|
import * as AppActions from 'src/types/actions/app'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
activeDashboard: string
|
activeDashboard: string
|
||||||
|
|
|
@ -62,7 +62,7 @@ import {
|
||||||
import {DashboardName} from 'src/types/dashboards'
|
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/types/actions/app'
|
||||||
import * as CellEditorOverlayActions from 'src/types/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'
|
||||||
|
|
|
@ -4,31 +4,20 @@ import {notify} from 'src/shared/actions/notifications'
|
||||||
import {notifyPresentationMode} from 'src/shared/copy/notifications'
|
import {notifyPresentationMode} from 'src/shared/copy/notifications'
|
||||||
|
|
||||||
import {Dispatch} from 'redux'
|
import {Dispatch} from 'redux'
|
||||||
|
import * as AppActions from 'src/types/actions/app'
|
||||||
|
|
||||||
// ephemeral state action creators
|
// ephemeral state action creators
|
||||||
export type EnablePresentationModeActionCreator = () => EnablePresentationModeAction
|
|
||||||
|
|
||||||
interface EnablePresentationModeAction {
|
export const enablePresentationMode = (): AppActions.EnablePresentationModeAction => ({
|
||||||
type: 'ENABLE_PRESENTATION_MODE'
|
|
||||||
}
|
|
||||||
export const enablePresentationMode = (): EnablePresentationModeAction => ({
|
|
||||||
type: 'ENABLE_PRESENTATION_MODE',
|
type: 'ENABLE_PRESENTATION_MODE',
|
||||||
})
|
})
|
||||||
|
|
||||||
interface DisablePresentationModeAction {
|
export const disablePresentationMode = (): AppActions.DisablePresentationModeAction => ({
|
||||||
type: 'DISABLE_PRESENTATION_MODE'
|
|
||||||
}
|
|
||||||
export const disablePresentationMode = (): DisablePresentationModeAction => ({
|
|
||||||
type: 'DISABLE_PRESENTATION_MODE',
|
type: 'DISABLE_PRESENTATION_MODE',
|
||||||
})
|
})
|
||||||
|
|
||||||
export type DelayEnablePresentationModeDispatcher = () => DelayEnablePresentationModeThunk
|
export const delayEnablePresentationMode: AppActions.DelayEnablePresentationModeDispatcher = () => async (
|
||||||
export type DelayEnablePresentationModeThunk = (
|
dispatch: Dispatch<AppActions.EnablePresentationModeAction>
|
||||||
dispatch: Dispatch<EnablePresentationModeAction>
|
|
||||||
) => Promise<NodeJS.Timer>
|
|
||||||
|
|
||||||
export const delayEnablePresentationMode: DelayEnablePresentationModeDispatcher = () => async (
|
|
||||||
dispatch: Dispatch<EnablePresentationModeAction>
|
|
||||||
): Promise<NodeJS.Timer> =>
|
): Promise<NodeJS.Timer> =>
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
dispatch(enablePresentationMode())
|
dispatch(enablePresentationMode())
|
||||||
|
@ -36,39 +25,21 @@ export const delayEnablePresentationMode: DelayEnablePresentationModeDispatcher
|
||||||
}, PRESENTATION_MODE_ANIMATION_DELAY)
|
}, PRESENTATION_MODE_ANIMATION_DELAY)
|
||||||
|
|
||||||
// persistent state action creators
|
// persistent state action creators
|
||||||
export type SetAutoRefreshActionCreator = (
|
|
||||||
milliseconds: number
|
|
||||||
) => SetAutoRefreshAction
|
|
||||||
|
|
||||||
interface SetAutoRefreshAction {
|
export const setAutoRefresh: AppActions.SetAutoRefreshActionCreator = (
|
||||||
type: 'SET_AUTOREFRESH'
|
|
||||||
payload: {
|
|
||||||
milliseconds: number
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export const setAutoRefresh: SetAutoRefreshActionCreator = (
|
|
||||||
milliseconds: number
|
milliseconds: number
|
||||||
): SetAutoRefreshAction => ({
|
): AppActions.SetAutoRefreshAction => ({
|
||||||
type: 'SET_AUTOREFRESH',
|
type: 'SET_AUTOREFRESH',
|
||||||
payload: {
|
payload: {
|
||||||
milliseconds,
|
milliseconds,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
export type TemplateControlBarVisibilityToggledActionCreator = () => TemplateControlBarVisibilityToggledAction
|
export const templateControlBarVisibilityToggled = (): AppActions.TemplateControlBarVisibilityToggledAction => ({
|
||||||
|
|
||||||
interface TemplateControlBarVisibilityToggledAction {
|
|
||||||
type: 'TEMPLATE_CONTROL_BAR_VISIBILITY_TOGGLED'
|
|
||||||
}
|
|
||||||
export const templateControlBarVisibilityToggled = (): TemplateControlBarVisibilityToggledAction => ({
|
|
||||||
type: 'TEMPLATE_CONTROL_BAR_VISIBILITY_TOGGLED',
|
type: 'TEMPLATE_CONTROL_BAR_VISIBILITY_TOGGLED',
|
||||||
})
|
})
|
||||||
|
|
||||||
interface NoopAction {
|
export const noop = (): AppActions.NoopAction => ({
|
||||||
type: 'NOOP'
|
|
||||||
payload: object
|
|
||||||
}
|
|
||||||
export const noop = (): NoopAction => ({
|
|
||||||
type: 'NOOP',
|
type: 'NOOP',
|
||||||
payload: {},
|
payload: {},
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
import {Dispatch} from 'redux'
|
||||||
|
|
||||||
|
export type EnablePresentationModeActionCreator = () => EnablePresentationModeAction
|
||||||
|
|
||||||
|
export interface EnablePresentationModeAction {
|
||||||
|
type: 'ENABLE_PRESENTATION_MODE'
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DisablePresentationModeAction {
|
||||||
|
type: 'DISABLE_PRESENTATION_MODE'
|
||||||
|
}
|
||||||
|
|
||||||
|
export type DelayEnablePresentationModeDispatcher = () => DelayEnablePresentationModeThunk
|
||||||
|
|
||||||
|
export type DelayEnablePresentationModeThunk = (
|
||||||
|
dispatch: Dispatch<EnablePresentationModeAction>
|
||||||
|
) => Promise<NodeJS.Timer>
|
||||||
|
|
||||||
|
export type SetAutoRefreshActionCreator = (
|
||||||
|
milliseconds: number
|
||||||
|
) => SetAutoRefreshAction
|
||||||
|
|
||||||
|
export interface SetAutoRefreshAction {
|
||||||
|
type: 'SET_AUTOREFRESH'
|
||||||
|
payload: {
|
||||||
|
milliseconds: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TemplateControlBarVisibilityToggledActionCreator = () => TemplateControlBarVisibilityToggledAction
|
||||||
|
|
||||||
|
export interface TemplateControlBarVisibilityToggledAction {
|
||||||
|
type: 'TEMPLATE_CONTROL_BAR_VISIBILITY_TOGGLED'
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface NoopAction {
|
||||||
|
type: 'NOOP'
|
||||||
|
payload: object
|
||||||
|
}
|
Loading…
Reference in New Issue