Get cloned cell name for notification from cloned cell generator function
parent
edb5c74219
commit
33155de4ef
|
@ -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))
|
||||
|
|
|
@ -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}
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue