Commit 3e0a34ce by Peter Holmberg

typing changes

parent bd2f9a38
......@@ -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<Props> {
componentDidMount() {
appEvents.on('alert-warning', options => this.addAppNotification(options[0], options[1], 'warning', 5000));
......
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',
......
export interface AppNotification {
id: number;
severity: string;
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[];
}
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment