diff --git a/public/app/core/components/AppNotifications/AppNotificationList.tsx b/public/app/core/components/AppNotifications/AppNotificationList.tsx index a5953156aab..10b5997ed98 100644 --- a/public/app/core/components/AppNotifications/AppNotificationList.tsx +++ b/public/app/core/components/AppNotifications/AppNotificationList.tsx @@ -2,7 +2,7 @@ import React, { PureComponent } from 'react'; import appEvents from 'app/core/app_events'; import { addAppNotification, clearAppNotification } from './state/actions'; import { connectWithStore } from 'app/core/utils/connectWithReduxStore'; -import { AppNotification, StoreState } from '../../../types'; +import { AppNotification, AppNotificationSeverity, StoreState } from 'app/types'; export interface Props { appNotifications: AppNotification[]; @@ -10,13 +10,6 @@ export interface Props { clearAppNotification: typeof clearAppNotification; } -enum AppNotificationSeverity { - Success = 'success', - Warning = 'warning', - Error = 'error', - Info = 'info', -} - export class AppNotificationList extends PureComponent { componentDidMount() { appEvents.on('alert-warning', options => this.addAppNotification(options[0], options[1], 'warning', 5000)); diff --git a/public/app/core/components/AppNotifications/state/reducers.test.ts b/public/app/core/components/AppNotifications/state/reducers.test.ts index bdc78b4fe0b..b46955a087f 100644 --- a/public/app/core/components/AppNotifications/state/reducers.test.ts +++ b/public/app/core/components/AppNotifications/state/reducers.test.ts @@ -1,5 +1,6 @@ import { appNotificationsReducer } from './reducers'; import { ActionTypes } from './actions'; +import { AppNotificationSeverity } from 'app/types'; describe('clear alert', () => { it('should filter alert', () => { @@ -10,14 +11,14 @@ describe('clear alert', () => { appNotifications: [ { id: id1, - severity: 'success', + severity: AppNotificationSeverity.Success, icon: 'success', title: 'test', text: 'test alert', }, { id: id2, - severity: 'fail', + severity: AppNotificationSeverity.Warning, icon: 'warning', title: 'test2', text: 'test alert fail 2', @@ -34,7 +35,7 @@ describe('clear alert', () => { appNotifications: [ { id: id1, - severity: 'success', + severity: AppNotificationSeverity.Success, icon: 'success', title: 'test', text: 'test alert', diff --git a/public/app/types/alerts.ts b/public/app/types/alerts.ts deleted file mode 100644 index 3f25fedbf8b..00000000000 --- a/public/app/types/alerts.ts +++ /dev/null @@ -1,11 +0,0 @@ -export interface AppNotification { - id: number; - severity: string; - icon: string; - title: string; - text: string; -} - -export interface AppNotificationsState { - appNotifications: AppNotification[]; -} diff --git a/public/app/types/appNotifications.ts b/public/app/types/appNotifications.ts new file mode 100644 index 00000000000..1bbc66a4baa --- /dev/null +++ b/public/app/types/appNotifications.ts @@ -0,0 +1,18 @@ +export interface AppNotification { + id?: number; + severity: AppNotificationSeverity; + icon: string; + title: string; + text: string; +} + +export enum AppNotificationSeverity { + Success = 'success', + Warning = 'warning', + Error = 'error', + Info = 'info', +} + +export interface AppNotificationsState { + appNotifications: AppNotification[]; +} diff --git a/public/app/types/index.ts b/public/app/types/index.ts index bc446bf3e36..b888ba83877 100644 --- a/public/app/types/index.ts +++ b/public/app/types/index.ts @@ -9,7 +9,7 @@ import { ApiKey, ApiKeysState, NewApiKey } from './apiKeys'; import { Invitee, OrgUser, User, UsersState } from './user'; import { DataSource, DataSourcesState } from './datasources'; import { PluginDashboard, PluginMeta, Plugin, PluginsState } from './plugins'; -import { AppNotification, AppNotificationsState } from './alerts'; +import { AppNotification, AppNotificationSeverity, AppNotificationsState } from './appNotifications'; export { Team, @@ -49,6 +49,7 @@ export { PluginDashboard, AppNotification, AppNotificationsState, + AppNotificationSeverity, }; export interface StoreState {