Centralize Notification types & make usage consistent
parent
1948d28276
commit
acf083e5b6
|
@ -24,7 +24,7 @@ import {DEFAULT_HOME_PAGE} from 'src/shared/constants'
|
|||
|
||||
import * as copy from 'src/shared/copy/notifications'
|
||||
|
||||
import {Source, Me} from 'src/types'
|
||||
import {Source, Me, Notification, NotificationFunc} from 'src/types'
|
||||
|
||||
interface Auth {
|
||||
isUsingAuth: boolean
|
||||
|
@ -47,7 +47,7 @@ interface Props {
|
|||
router: InjectedRouter
|
||||
location: Location
|
||||
auth: Auth
|
||||
notify: () => void
|
||||
notify: (message: Notification | NotificationFunc) => void
|
||||
errorThrown: () => void
|
||||
}
|
||||
|
||||
|
|
|
@ -8,10 +8,17 @@ import {notify as notifyAction} from 'src/shared/actions/notifications'
|
|||
import {ErrorHandling} from 'src/shared/decorators/errors'
|
||||
|
||||
import AllUsersTable from 'src/admin/components/chronograf/AllUsersTable'
|
||||
import {AuthLinks, Organization, Role, User} from 'src/types'
|
||||
import {
|
||||
AuthLinks,
|
||||
Organization,
|
||||
Role,
|
||||
User,
|
||||
Notification,
|
||||
NotificationFunc,
|
||||
} from 'src/types'
|
||||
|
||||
interface Props {
|
||||
notify: () => void
|
||||
notify: (message: Notification | NotificationFunc) => void
|
||||
links: AuthLinks
|
||||
meID: string
|
||||
users: User[]
|
||||
|
|
|
@ -2,17 +2,7 @@ import React, {SFC} from 'react'
|
|||
|
||||
import AlertTabs from 'src/kapacitor/components/AlertTabs'
|
||||
|
||||
import {Kapacitor, Source} from 'src/types'
|
||||
|
||||
export interface Notification {
|
||||
id?: string
|
||||
type: string
|
||||
icon: string
|
||||
duration: number
|
||||
message: string
|
||||
}
|
||||
|
||||
type NotificationFunc = () => Notification
|
||||
import {Kapacitor, Source, Notification, NotificationFunc} from 'src/types'
|
||||
|
||||
interface AlertOutputProps {
|
||||
exists: boolean
|
||||
|
|
|
@ -3,19 +3,9 @@ import React, {ChangeEvent, MouseEvent, PureComponent} from 'react'
|
|||
import AlertOutputs from 'src/kapacitor/components/AlertOutputs'
|
||||
import Input from 'src/kapacitor/components/KapacitorFormInput'
|
||||
import FancyScrollbar from 'src/shared/components/FancyScrollbar'
|
||||
|
||||
import {Kapacitor, Source} from 'src/types'
|
||||
import KapacitorFormSkipVerify from 'src/kapacitor/components/KapacitorFormSkipVerify'
|
||||
|
||||
export interface Notification {
|
||||
id?: string
|
||||
type: string
|
||||
icon: string
|
||||
duration: number
|
||||
message: string
|
||||
}
|
||||
|
||||
type NotificationFunc = () => Notification
|
||||
import {Kapacitor, Source, Notification, NotificationFunc} from 'src/types'
|
||||
|
||||
interface Props {
|
||||
kapacitor: Kapacitor
|
||||
|
|
|
@ -3,6 +3,8 @@ import React, {PureComponent} from 'react'
|
|||
import TagInput from 'src/shared/components/TagInput'
|
||||
import {ErrorHandling} from 'src/shared/decorators/errors'
|
||||
|
||||
import {Notification, NotificationFunc} from 'src/types'
|
||||
|
||||
interface Properties {
|
||||
brokers: string[]
|
||||
timeout: string
|
||||
|
@ -30,6 +32,7 @@ interface Props {
|
|||
onSave: (properties: Properties) => void
|
||||
onTest: (event: React.MouseEvent<HTMLButtonElement>) => void
|
||||
enabled: boolean
|
||||
notify: (message: Notification | NotificationFunc) => void
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
|
|
@ -5,7 +5,7 @@ import {bindActionCreators} from 'redux'
|
|||
|
||||
import {notify as notifyAction} from 'src/shared/actions/notifications'
|
||||
|
||||
import {Source} from 'src/types'
|
||||
import {Source, Notification, NotificationFunc} from 'src/types'
|
||||
|
||||
import {
|
||||
createKapacitor,
|
||||
|
@ -29,16 +29,6 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
|
|||
export const defaultName = 'My Kapacitor'
|
||||
export const kapacitorPort = '9092'
|
||||
|
||||
export interface Notification {
|
||||
id?: string
|
||||
type: string
|
||||
icon: string
|
||||
duration: number
|
||||
message: string
|
||||
}
|
||||
|
||||
export type NotificationFunc = () => Notification
|
||||
|
||||
interface Kapacitor {
|
||||
url: string
|
||||
name: string
|
||||
|
|
|
@ -10,7 +10,14 @@ import {getActiveKapacitor} from 'src/shared/apis'
|
|||
import {getLogStreamByRuleID, pingKapacitorVersion} from 'src/kapacitor/apis'
|
||||
import {notify as notifyAction} from 'src/shared/actions/notifications'
|
||||
|
||||
import {Source, Kapacitor, Task, AlertRule} from 'src/types'
|
||||
import {
|
||||
Source,
|
||||
Kapacitor,
|
||||
Task,
|
||||
AlertRule,
|
||||
Notification,
|
||||
NotificationFunc,
|
||||
} from 'src/types'
|
||||
|
||||
import {
|
||||
notifyTickscriptLoggingUnavailable,
|
||||
|
@ -55,7 +62,7 @@ interface Props {
|
|||
router: Router
|
||||
params: Params
|
||||
rules: AlertRule[]
|
||||
notify: any
|
||||
notify: (message: Notification | NotificationFunc) => void
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
import {AlertRule, Kapacitor, Task} from './kapacitor'
|
||||
import {Source, SourceLinks} from './sources'
|
||||
import {DropdownAction, DropdownItem} from './shared'
|
||||
import {Notification} from 'src/kapacitor/components/AlertOutputs'
|
||||
import {Notification, NotificationFunc} from './notifications'
|
||||
|
||||
export {
|
||||
Me,
|
||||
|
@ -37,4 +37,5 @@ export {
|
|||
TimeRange,
|
||||
Task,
|
||||
Notification,
|
||||
NotificationFunc,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue