From fb6a0e14c2119f1cb326b465712ab9ec01d03b99 Mon Sep 17 00:00:00 2001 From: Jared Scheib Date: Wed, 29 Mar 2017 11:23:46 -0700 Subject: [PATCH] Auto-dismiss notification --- ui/src/dashboards/actions/index.js | 4 +++- ui/src/shared/constants/index.js | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/src/dashboards/actions/index.js b/ui/src/dashboards/actions/index.js index 3eeca56d75..8312da819b 100644 --- a/ui/src/dashboards/actions/index.js +++ b/ui/src/dashboards/actions/index.js @@ -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}.`)) diff --git a/ui/src/shared/constants/index.js b/ui/src/shared/constants/index.js index d238e7bb7a..4ebcac2dc8 100644 --- a/ui/src/shared/constants/index.js +++ b/ui/src/shared/constants/index.js @@ -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