Get cloned cell name for notification from cloned cell generator function

pull/10616/head
ebb-tide 2018-05-08 15:39:52 -07:00 committed by Andrew Watkins
parent 50b256cf7a
commit 83f3b41693
3 changed files with 4 additions and 14 deletions

View File

@ -19,7 +19,6 @@ import {
notifyDashboardDeleted, notifyDashboardDeleted,
notifyDashboardDeleteFailed, notifyDashboardDeleteFailed,
notifyCellAdded, notifyCellAdded,
notifyCellCloned,
notifyCellDeleted, notifyCellDeleted,
} from 'shared/copy/notifications' } from 'shared/copy/notifications'
@ -319,12 +318,10 @@ export const addDashboardCellAsync = (
export const cloneDashboardCellAsync = (dashboard, cell) => async dispatch => { export const cloneDashboardCellAsync = (dashboard, cell) => async dispatch => {
try { try {
const {data} = await addDashboardCellAJAX( const clonedCell = getClonedDashboardCell(dashboard, cell)
dashboard, const {data} = await addDashboardCellAJAX(dashboard, clonedCell)
getClonedDashboardCell(dashboard, cell)
)
dispatch(addDashboardCell(dashboard, data)) dispatch(addDashboardCell(dashboard, data))
dispatch(notify(notifyCellCloned(cell.name))) dispatch(notify(notifyCellAdded(clonedCell.name)))
} catch (error) { } catch (error) {
console.error(error) console.error(error)
dispatch(errorThrown(error)) dispatch(errorThrown(error))

View File

@ -89,7 +89,7 @@ export const getNewDashboardCell = (dashboard, cellType) => {
export const getClonedDashboardCell = (dashboard, cloneCell) => { export const getClonedDashboardCell = (dashboard, cloneCell) => {
const {x, y} = getNextAvailablePosition(dashboard, cloneCell) const {x, y} = getNextAvailablePosition(dashboard, cloneCell)
const name = `${cloneCell.name} (Clone)` const name = `${cloneCell.name} (clone)`
return {...cloneCell, x, y, name} return {...cloneCell, x, y, name}
} }

View File

@ -424,13 +424,6 @@ export const notifyCellAdded = name => ({
message: `Added "${name}" to dashboard.`, message: `Added "${name}" to dashboard.`,
}) })
export const notifyCellCloned = name => ({
...defaultSuccessNotification,
icon: 'duplicate',
duration: 1900,
message: `Added "${name}" (Clone) to dashboard.`,
})
export const notifyCellDeleted = name => ({ export const notifyCellDeleted = name => ({
...defaultDeletionNotification, ...defaultDeletionNotification,
icon: 'dash-h', icon: 'dash-h',