From 74b1d49f90258002f6327dc97d58f6a4a6c0c950 Mon Sep 17 00:00:00 2001 From: Alex P Date: Mon, 16 Apr 2018 10:59:12 -0700 Subject: [PATCH 1/4] Introduce notification default for "Delete" actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Planning to use this in the future to visually distinguish from “Create” actions --- ui/src/shared/copy/notifications.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ui/src/shared/copy/notifications.js b/ui/src/shared/copy/notifications.js index 09907a4ee0..a510729ab1 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.' From 0910d38e700e72c90aeae45177eff6c76bf534db Mon Sep 17 00:00:00 2001 From: Alex P Date: Mon, 16 Apr 2018 10:59:41 -0700 Subject: [PATCH 2/4] Create notifications for cell add/delete/clone --- ui/src/shared/copy/notifications.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ui/src/shared/copy/notifications.js b/ui/src/shared/copy/notifications.js index a510729ab1..01445c99a1 100644 --- a/ui/src/shared/copy/notifications.js +++ b/ui/src/shared/copy/notifications.js @@ -412,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 = () => ({ From 89f165727caec63a9296c10665b189483c16c7c2 Mon Sep 17 00:00:00 2001 From: Alex P Date: Mon, 16 Apr 2018 10:59:57 -0700 Subject: [PATCH 3/4] Implement cell action notifications --- ui/src/dashboards/actions/index.js | 6 ++++++ 1 file changed, 6 insertions(+) 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)) From a99c08892d086dc7074c142a32422df6d400ad6f Mon Sep 17 00:00:00 2001 From: Alex P Date: Mon, 16 Apr 2018 11:03:57 -0700 Subject: [PATCH 4/4] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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