diff --git a/ui/src/dashboards/actions/index.ts b/ui/src/dashboards/actions/index.ts index c15e3b5d12..c7a689a134 100644 --- a/ui/src/dashboards/actions/index.ts +++ b/ui/src/dashboards/actions/index.ts @@ -72,7 +72,7 @@ import * as DashboardActions from 'src/types/actions/dashboards' import * as DashboardAPIs from 'src/types/apis/dashboard' import * as DashboardReducers from 'src/types/reducers/dashboards' import * as AuthReducers from 'src/types/reducers/auth' -import * as NotificationActions from 'src/shared/actions/notifications' +import * as NotificationActions from 'src/types/actions/notifications' import * as ErrorActions from 'src/types/actions/errors' import {LocationAction} from 'react-router-redux' diff --git a/ui/src/dashboards/containers/DashboardPage.tsx b/ui/src/dashboards/containers/DashboardPage.tsx index 1a2443561c..d074ffea14 100644 --- a/ui/src/dashboards/containers/DashboardPage.tsx +++ b/ui/src/dashboards/containers/DashboardPage.tsx @@ -66,7 +66,7 @@ import * as AppActions from 'src/shared/actions/app' import * as CellEditorOverlayActions from 'src/dashboards/actions/cellEditorOverlay' import * as DashboardActions from 'src/types/actions/dashboards' import * as ErrorActions from 'src/types/actions/errors' -import * as NotificationActions from 'src/shared/actions/notifications' +import * as NotificationActions from 'src/types/actions/notifications' interface DashboardActions { setDashTimeV1: DashboardActions.SetDashTimeV1ActionCreator diff --git a/ui/src/shared/actions/notifications.ts b/ui/src/shared/actions/notifications.ts index c5c6729fee..ded2d75cf3 100644 --- a/ui/src/shared/actions/notifications.ts +++ b/ui/src/shared/actions/notifications.ts @@ -1,36 +1,15 @@ import {Notification} from 'src/types' +import * as NotificationActions from 'src/types/actions/notifications' -export type Action = PublishNotificationAction | ActionDismissNotification - -// Publish notification -export type PublishNotificationActionCreator = ( - n: Notification -) => PublishNotificationAction - -export interface PublishNotificationAction { - type: 'PUBLISH_NOTIFICATION' - payload: { - notification: Notification - } -} - -export const notify: PublishNotificationActionCreator = ( +export const notify: NotificationActions.PublishNotificationActionCreator = ( notification: Notification -): PublishNotificationAction => ({ +): NotificationActions.PublishNotificationAction => ({ type: 'PUBLISH_NOTIFICATION', payload: {notification}, }) - -// Dismiss notification -export type DismissNotification = (id: string) => ActionDismissNotification -export interface ActionDismissNotification { - type: 'DISMISS_NOTIFICATION' - payload: { - id: string - } -} - -export const dismissNotification = (id: string): ActionDismissNotification => ({ +export const dismissNotification = ( + id: string +): NotificationActions.DismissNotificationAction => ({ type: 'DISMISS_NOTIFICATION', payload: {id}, }) diff --git a/ui/src/shared/reducers/notifications.ts b/ui/src/shared/reducers/notifications.ts index cb9f6fd92f..8c9d938d40 100644 --- a/ui/src/shared/reducers/notifications.ts +++ b/ui/src/shared/reducers/notifications.ts @@ -1,5 +1,5 @@ import uuid from 'uuid' -import {Action} from 'src/shared/actions/notifications' +import {Action} from 'src/types/actions/notifications' import {Notification} from 'src/types' export const initialState: Notification[] = [] diff --git a/ui/src/sources/containers/SourcePage.tsx b/ui/src/sources/containers/SourcePage.tsx index 6f2619960a..306029bdaf 100644 --- a/ui/src/sources/containers/SourcePage.tsx +++ b/ui/src/sources/containers/SourcePage.tsx @@ -9,10 +9,7 @@ import { AddSource, UpdateSource, } from 'src/shared/actions/sources' -import { - notify as notifyAction, - PublishNotificationActionCreator, -} from 'src/shared/actions/notifications' +import {notify as notifyAction} from 'src/shared/actions/notifications' import {connect} from 'react-redux' import Notifications from 'src/shared/components/Notifications' @@ -20,7 +17,6 @@ import SourceForm from 'src/sources/components/SourceForm' import FancyScrollbar from 'src/shared/components/FancyScrollbar' import PageHeader from 'src/shared/components/PageHeader' import {DEFAULT_SOURCE} from 'src/shared/constants' -import {Source} from 'src/types' const INITIAL_PATH = '/sources/new' @@ -33,8 +29,11 @@ import { } from 'src/shared/copy/notifications' import {ErrorHandling} from 'src/shared/decorators/errors' +import {Source} from 'src/types' +import * as NotificationActions from 'src/types/actions/notifications' + interface Props extends WithRouterProps { - notify: PublishNotificationActionCreator + notify: NotificationActions.PublishNotificationActionCreator addSource: AddSource updateSource: UpdateSource } diff --git a/ui/src/types/actions/dashboards.ts b/ui/src/types/actions/dashboards.ts index ac50659e7f..02d7cf544f 100644 --- a/ui/src/types/actions/dashboards.ts +++ b/ui/src/types/actions/dashboards.ts @@ -6,7 +6,7 @@ import * as DashboardData from 'src/types/dashboards' import * as QueryData from 'src/types/query' import * as TempVarData from 'src/types/tempVars' import * as ErrorActions from 'src/types/actions/errors' -import * as NotificationActions from 'src/shared/actions/notifications' +import * as NotificationActions from 'src/types/actions/notifications' import * as DashboardReducers from 'src/types/reducers/dashboards' import {Location} from 'history' diff --git a/ui/src/types/actions/notifications.ts b/ui/src/types/actions/notifications.ts new file mode 100644 index 0000000000..e43d25ad12 --- /dev/null +++ b/ui/src/types/actions/notifications.ts @@ -0,0 +1,23 @@ +import {Notification} from 'src/types' + +export type Action = PublishNotificationAction | DismissNotificationAction + +export type PublishNotificationActionCreator = ( + n: Notification +) => PublishNotificationAction + +export interface PublishNotificationAction { + type: 'PUBLISH_NOTIFICATION' + payload: { + notification: Notification + } +} + +export type DismissNotification = (id: string) => DismissNotificationAction + +export interface DismissNotificationAction { + type: 'DISMISS_NOTIFICATION' + payload: { + id: string + } +}