Restore delete Dashboard Cell functionality
parent
7db2d74ad3
commit
70ffc86ca0
|
@ -98,9 +98,10 @@ export const renameDashboardCell = (dashboard, x, y, name) => ({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
export const deleteDashboardCell = cell => ({
|
export const deleteDashboardCell = (dashboard, cell) => ({
|
||||||
type: 'DELETE_DASHBOARD_CELL',
|
type: 'DELETE_DASHBOARD_CELL',
|
||||||
payload: {
|
payload: {
|
||||||
|
dashboard,
|
||||||
cell,
|
cell,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -185,10 +186,10 @@ export const addDashboardCellAsync = dashboard => async dispatch => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const deleteDashboardCellAsync = cell => async dispatch => {
|
export const deleteDashboardCellAsync = (dashboard, cell) => async dispatch => {
|
||||||
try {
|
try {
|
||||||
await deleteDashboardCellAJAX(cell)
|
await deleteDashboardCellAJAX(cell)
|
||||||
dispatch(deleteDashboardCell(cell))
|
dispatch(deleteDashboardCell(dashboard, cell))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
dispatch(errorThrown(error))
|
dispatch(errorThrown(error))
|
||||||
|
|
|
@ -151,7 +151,8 @@ class DashboardPage extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleDeleteDashboardCell(cell) {
|
handleDeleteDashboardCell(cell) {
|
||||||
this.props.dashboardActions.deleteDashboardCellAsync(cell)
|
const dashboard = this.getActiveDashboard()
|
||||||
|
this.props.dashboardActions.deleteDashboardCellAsync(dashboard, cell)
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSelectTemplate(templateID, values) {
|
handleSelectTemplate(templateID, values) {
|
||||||
|
|
|
@ -113,8 +113,7 @@ export default function ui(state = initialState, action) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'DELETE_DASHBOARD_CELL': {
|
case 'DELETE_DASHBOARD_CELL': {
|
||||||
const {cell} = action.payload
|
const {dashboard, cell} = action.payload
|
||||||
const {dashboard} = state
|
|
||||||
|
|
||||||
const newCells = dashboard.cells.filter(
|
const newCells = dashboard.cells.filter(
|
||||||
c => !(c.x === cell.x && c.y === cell.y)
|
c => !(c.x === cell.x && c.y === cell.y)
|
||||||
|
|
Loading…
Reference in New Issue