Auto-dismiss notification

pull/10616/head
Jared Scheib 2017-03-29 11:23:46 -07:00
parent 4a5eb775d5
commit fb6a0e14c2
2 changed files with 5 additions and 1 deletions

View File

@ -7,8 +7,9 @@ import {
deleteDashboardCell as deleteDashboardCellAJAX,
} from 'src/dashboards/apis'
import {publishNotification} from 'src/shared/actions/notifications';
import {publishNotification, delayDismissNotification} from 'src/shared/actions/notifications'
import {SHORT_NOTIFICATION_DISAPPEARING_DELAY} from 'shared/constants'
import {NEW_DEFAULT_DASHBOARD_CELL} from 'src/dashboards/constants'
export const loadDashboards = (dashboards, dashboardID) => ({
@ -135,6 +136,7 @@ export const deleteDashboardAsync = (dashboard) => async (dispatch) => {
try {
await deleteDashboardAJAX(dashboard)
dispatch(publishNotification('success', 'Dashboard deleted successfully.'))
dispatch(delayDismissNotification('success', SHORT_NOTIFICATION_DISAPPEARING_DELAY))
} catch (error) {
dispatch(deleteDashboardFailed(dashboard))
dispatch(publishNotification('error', `Failed to delete dashboard: ${error.data.message}.`))

View File

@ -471,6 +471,8 @@ export const STROKE_WIDTH = {
export const PRESENTATION_MODE_ANIMATION_DELAY = 0 // In milliseconds.
export const PRESENTATION_MODE_NOTIFICATION_DELAY = 2000 // In milliseconds.
export const SHORT_NOTIFICATION_DISAPPEARING_DELAY = 1500 // in milliseconds
export const RES_UNAUTHORIZED = 401
export const AUTOREFRESH_DEFAULT = 15000 // in milliseconds