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 {DashboardName} from 'src/types/dashboards'
|
||||
import * as AppActions from 'src/shared/actions/app'
|
||||
import * as AppActions from 'src/types/actions/app'
|
||||
|
||||
interface Props {
|
||||
activeDashboard: string
|
||||
|
|
|
@ -62,7 +62,7 @@ import {
|
|||
import {DashboardName} from 'src/types/dashboards'
|
||||
import {ColorNumber, ColorString} from 'src/types/colors'
|
||||
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 DashboardActions from 'src/types/actions/dashboards'
|
||||
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 {Dispatch} from 'redux'
|
||||
import * as AppActions from 'src/types/actions/app'
|
||||
|
||||
// ephemeral state action creators
|
||||
export type EnablePresentationModeActionCreator = () => EnablePresentationModeAction
|
||||
|
||||
interface EnablePresentationModeAction {
|
||||
type: 'ENABLE_PRESENTATION_MODE'
|
||||
}
|
||||
export const enablePresentationMode = (): EnablePresentationModeAction => ({
|
||||
export const enablePresentationMode = (): AppActions.EnablePresentationModeAction => ({
|
||||
type: 'ENABLE_PRESENTATION_MODE',
|
||||
})
|
||||
|
||||
interface DisablePresentationModeAction {
|
||||
type: 'DISABLE_PRESENTATION_MODE'
|
||||
}
|
||||
export const disablePresentationMode = (): DisablePresentationModeAction => ({
|
||||
export const disablePresentationMode = (): AppActions.DisablePresentationModeAction => ({
|
||||
type: 'DISABLE_PRESENTATION_MODE',
|
||||
})
|
||||
|
||||
export type DelayEnablePresentationModeDispatcher = () => DelayEnablePresentationModeThunk
|
||||
export type DelayEnablePresentationModeThunk = (
|
||||
dispatch: Dispatch<EnablePresentationModeAction>
|
||||
) => Promise<NodeJS.Timer>
|
||||
|
||||
export const delayEnablePresentationMode: DelayEnablePresentationModeDispatcher = () => async (
|
||||
dispatch: Dispatch<EnablePresentationModeAction>
|
||||
export const delayEnablePresentationMode: AppActions.DelayEnablePresentationModeDispatcher = () => async (
|
||||
dispatch: Dispatch<AppActions.EnablePresentationModeAction>
|
||||
): Promise<NodeJS.Timer> =>
|
||||
setTimeout(() => {
|
||||
dispatch(enablePresentationMode())
|
||||
|
@ -36,39 +25,21 @@ export const delayEnablePresentationMode: DelayEnablePresentationModeDispatcher
|
|||
}, PRESENTATION_MODE_ANIMATION_DELAY)
|
||||
|
||||
// persistent state action creators
|
||||
export type SetAutoRefreshActionCreator = (
|
||||
milliseconds: number
|
||||
) => SetAutoRefreshAction
|
||||
|
||||
interface SetAutoRefreshAction {
|
||||
type: 'SET_AUTOREFRESH'
|
||||
payload: {
|
||||
milliseconds: number
|
||||
}
|
||||
}
|
||||
export const setAutoRefresh: SetAutoRefreshActionCreator = (
|
||||
export const setAutoRefresh: AppActions.SetAutoRefreshActionCreator = (
|
||||
milliseconds: number
|
||||
): SetAutoRefreshAction => ({
|
||||
): AppActions.SetAutoRefreshAction => ({
|
||||
type: 'SET_AUTOREFRESH',
|
||||
payload: {
|
||||
milliseconds,
|
||||
},
|
||||
})
|
||||
|
||||
export type TemplateControlBarVisibilityToggledActionCreator = () => TemplateControlBarVisibilityToggledAction
|
||||
|
||||
interface TemplateControlBarVisibilityToggledAction {
|
||||
type: 'TEMPLATE_CONTROL_BAR_VISIBILITY_TOGGLED'
|
||||
}
|
||||
export const templateControlBarVisibilityToggled = (): TemplateControlBarVisibilityToggledAction => ({
|
||||
export const templateControlBarVisibilityToggled = (): AppActions.TemplateControlBarVisibilityToggledAction => ({
|
||||
type: 'TEMPLATE_CONTROL_BAR_VISIBILITY_TOGGLED',
|
||||
})
|
||||
|
||||
interface NoopAction {
|
||||
type: 'NOOP'
|
||||
payload: object
|
||||
}
|
||||
export const noop = (): NoopAction => ({
|
||||
export const noop = (): AppActions.NoopAction => ({
|
||||
type: 'NOOP',
|
||||
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