diff --git a/CHANGELOG.md b/CHANGELOG.md index 171606cc4f..3f888ef1ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ 1. [#3096](https://github.com/influxdata/chronograf/pull/3096): Standardize delete confirmation interactions 1. [#3096](https://github.com/influxdata/chronograf/pull/3096): Standardize save & cancel interactions 1. [#3116](https://github.com/influxdata/chronograf/pull/3116): Improve cell renaming +1. [#3204](https://github.com/influxdata/chronograf/pull/3204): Notify user when a dashboard cell is added, removed, or cloned ### Bug Fixes diff --git a/ui/src/dashboards/actions/index.js b/ui/src/dashboards/actions/index.js index f367e489a8..bbc2fa7627 100644 --- a/ui/src/dashboards/actions/index.js +++ b/ui/src/dashboards/actions/index.js @@ -18,6 +18,9 @@ import { import { notifyDashboardDeleted, notifyDashboardDeleteFailed, + notifyCellAdded, + notifyCellCloned, + notifyCellDeleted, } from 'shared/copy/notifications' import { @@ -293,6 +296,7 @@ export const addDashboardCellAsync = dashboard => async dispatch => { getNewDashboardCell(dashboard) ) dispatch(addDashboardCell(dashboard, data)) + dispatch(notify(notifyCellAdded())) } catch (error) { console.error(error) dispatch(errorThrown(error)) @@ -306,6 +310,7 @@ export const cloneDashboardCellAsync = (dashboard, cell) => async dispatch => { getClonedDashboardCell(dashboard, cell) ) dispatch(addDashboardCell(dashboard, data)) + dispatch(notify(notifyCellCloned(cell.name))) } catch (error) { console.error(error) dispatch(errorThrown(error)) @@ -316,6 +321,7 @@ export const deleteDashboardCellAsync = (dashboard, cell) => async dispatch => { try { await deleteDashboardCellAJAX(cell) dispatch(deleteDashboardCell(dashboard, cell)) + dispatch(notify(notifyCellDeleted(cell.name))) } catch (error) { console.error(error) dispatch(errorThrown(error)) diff --git a/ui/src/shared/copy/notifications.js b/ui/src/shared/copy/notifications.js index 09907a4ee0..01445c99a1 100644 --- a/ui/src/shared/copy/notifications.js +++ b/ui/src/shared/copy/notifications.js @@ -15,6 +15,12 @@ const defaultSuccessNotification = { duration: FIVE_SECONDS, } +const defaultDeletionNotification = { + type: 'primary', + icon: 'trash', + duration: FIVE_SECONDS, +} + // Misc Notifications // ---------------------------------------------------------------------------- export const notifyGenericFail = () => 'Could not communicate with server.' @@ -406,6 +412,27 @@ export const notifyDashboardDeleted = name => ({ export const notifyDashboardDeleteFailed = (name, errorMessage) => `Failed to delete Dashboard ${name}: ${errorMessage}.` +export const notifyCellAdded = () => ({ + ...defaultSuccessNotification, + icon: 'dash-h', + duration: 2200, + message: 'Added "Untitled Cell" to dashboard.', +}) + +export const notifyCellCloned = name => ({ + ...defaultSuccessNotification, + icon: 'duplicate', + duration: 2200, + message: `Added "${name}" to dashboard.`, +}) + +export const notifyCellDeleted = name => ({ + ...defaultDeletionNotification, + icon: 'dash-h', + duration: 2200, + message: `Deleted "${name}" from dashboard.`, +}) + // Rule Builder Notifications // ---------------------------------------------------------------------------- export const notifyAlertRuleCreated = () => ({