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',
|
||||
payload: {
|
||||
dashboard,
|
||||
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 {
|
||||
await deleteDashboardCellAJAX(cell)
|
||||
dispatch(deleteDashboardCell(cell))
|
||||
dispatch(deleteDashboardCell(dashboard, cell))
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
dispatch(errorThrown(error))
|
||||
|
|
|
@ -151,7 +151,8 @@ class DashboardPage extends Component {
|
|||
}
|
||||
|
||||
handleDeleteDashboardCell(cell) {
|
||||
this.props.dashboardActions.deleteDashboardCellAsync(cell)
|
||||
const dashboard = this.getActiveDashboard()
|
||||
this.props.dashboardActions.deleteDashboardCellAsync(dashboard, cell)
|
||||
}
|
||||
|
||||
handleSelectTemplate(templateID, values) {
|
||||
|
|
|
@ -113,8 +113,7 @@ export default function ui(state = initialState, action) {
|
|||
}
|
||||
|
||||
case 'DELETE_DASHBOARD_CELL': {
|
||||
const {cell} = action.payload
|
||||
const {dashboard} = state
|
||||
const {dashboard, cell} = action.payload
|
||||
|
||||
const newCells = dashboard.cells.filter(
|
||||
c => !(c.x === cell.x && c.y === cell.y)
|
||||
|
|
Loading…
Reference in New Issue