Get cloned cell name for notification from cloned cell generator function

pull/10616/head
ebb-tide 2018-05-08 15:39:52 -07:00
parent edb5c74219
commit 33155de4ef
3 changed files with 4 additions and 14 deletions

View File

@ -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))

View File

@ -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}
}

View File

@ -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',