mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
typing changes
This commit is contained in:
parent
bd2f9a38d9
commit
3e0a34ceca
@ -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));
|
||||
|
@ -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',
|
||||
|
@ -1,11 +0,0 @@
|
||||
export interface AppNotification {
|
||||
id: number;
|
||||
severity: string;
|
||||
icon: string;
|
||||
title: string;
|
||||
text: string;
|
||||
}
|
||||
|
||||
export interface AppNotificationsState {
|
||||
appNotifications: AppNotification[];
|
||||
}
|
18
public/app/types/appNotifications.ts
Normal file
18
public/app/types/appNotifications.ts
Normal file
@ -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[];
|
||||
}
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user