From 83f3b416937a3cc5695ec0864d1a6b9dfb45ff5b Mon Sep 17 00:00:00 2001 From: ebb-tide Date: Tue, 8 May 2018 15:39:52 -0700 Subject: [PATCH] Get cloned cell name for notification from cloned cell generator function --- ui/src/dashboards/actions/index.js | 9 +++------ ui/src/dashboards/utils/cellGetters.js | 2 +- ui/src/shared/copy/notifications.js | 7 ------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/ui/src/dashboards/actions/index.js b/ui/src/dashboards/actions/index.js index ce5c9678d1..325cfcc70f 100644 --- a/ui/src/dashboards/actions/index.js +++ b/ui/src/dashboards/actions/index.js @@ -19,7 +19,6 @@ import { notifyDashboardDeleted, notifyDashboardDeleteFailed, notifyCellAdded, - notifyCellCloned, notifyCellDeleted, } from 'shared/copy/notifications' @@ -319,12 +318,10 @@ export const addDashboardCellAsync = ( export const cloneDashboardCellAsync = (dashboard, cell) => async dispatch => { try { - const {data} = await addDashboardCellAJAX( - dashboard, - getClonedDashboardCell(dashboard, cell) - ) + const clonedCell = getClonedDashboardCell(dashboard, cell) + const {data} = await addDashboardCellAJAX(dashboard, clonedCell) dispatch(addDashboardCell(dashboard, data)) - dispatch(notify(notifyCellCloned(cell.name))) + dispatch(notify(notifyCellAdded(clonedCell.name))) } catch (error) { console.error(error) dispatch(errorThrown(error)) diff --git a/ui/src/dashboards/utils/cellGetters.js b/ui/src/dashboards/utils/cellGetters.js index 44ba00abe4..4cbe6d638d 100644 --- a/ui/src/dashboards/utils/cellGetters.js +++ b/ui/src/dashboards/utils/cellGetters.js @@ -89,7 +89,7 @@ export const getNewDashboardCell = (dashboard, cellType) => { export const getClonedDashboardCell = (dashboard, cloneCell) => { const {x, y} = getNextAvailablePosition(dashboard, cloneCell) - const name = `${cloneCell.name} (Clone)` + const name = `${cloneCell.name} (clone)` return {...cloneCell, x, y, name} } diff --git a/ui/src/shared/copy/notifications.js b/ui/src/shared/copy/notifications.js index 61541ecf57..e26610efd7 100644 --- a/ui/src/shared/copy/notifications.js +++ b/ui/src/shared/copy/notifications.js @@ -424,13 +424,6 @@ export const notifyCellAdded = name => ({ message: `Added "${name}" to dashboard.`, }) -export const notifyCellCloned = name => ({ - ...defaultSuccessNotification, - icon: 'duplicate', - duration: 1900, - message: `Added "${name}" (Clone) to dashboard.`, -}) - export const notifyCellDeleted = name => ({ ...defaultDeletionNotification, icon: 'dash-h',