From 1a119e2009f131957d090f56c7b1204af45503e5 Mon Sep 17 00:00:00 2001 From: Lucas Badico Date: Wed, 25 Nov 2020 22:47:00 -0300 Subject: [PATCH 1/2] feat: extend event bus expose all lane actions to eventBus: - updateLanes - updateLane - moveLane - removeLane - addLane --- src/controllers/BoardContainer.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/controllers/BoardContainer.js b/src/controllers/BoardContainer.js index 2e80cd737..7ed7e5848 100644 --- a/src/controllers/BoardContainer.js +++ b/src/controllers/BoardContainer.js @@ -61,14 +61,15 @@ class BoardContainer extends Component { let eventBus = { publish: event => { switch (event.type) { + case 'REFRESH_BOARD': + return actions.loadBoard(event.data) + case 'ADD_CARD': return actions.addCard({laneId: event.laneId, card: event.card}) case 'UPDATE_CARD': return actions.updateCard({laneId: event.laneId, card: event.card}) case 'REMOVE_CARD': return actions.removeCard({laneId: event.laneId, cardId: event.cardId}) - case 'REFRESH_BOARD': - return actions.loadBoard(event.data) case 'MOVE_CARD': return actions.moveCardAcrossLanes({ fromLaneId: event.fromLaneId, @@ -78,10 +79,18 @@ class BoardContainer extends Component { }) case 'UPDATE_CARDS': return actions.updateCards({laneId: event.laneId, cards: event.cards}) + case 'UPDATE_LANES': return actions.updateLanes(event.lanes) case 'UPDATE_LANE': return actions.updateLane(event.lane) + case 'MOVE_LANE': + return actions.moveLane({ oldIndex: event.fromIndex, newIndex: event.toIndex }) + case 'REMOVE_LANE': + return actions.moveLane({ laneId: event.laneId }) + case 'ADD_LANE': + return actions.addLane(event.lane) + } } } From 1a2287f52506a2cc0e0953e1323f1683424639a6 Mon Sep 17 00:00:00 2001 From: Lucas Badico Date: Wed, 25 Nov 2020 22:47:52 -0300 Subject: [PATCH 2/2] doc: update the readme with lane actions the updateLane action already existed in code, but was not documented, fixed --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 5db3b0c16..97c6f0bfc 100644 --- a/README.md +++ b/README.md @@ -283,6 +283,19 @@ eventBus.publish({type: 'MOVE_CARD', fromLaneId: 'PLANNED', toLaneId: 'WIP', car //To update the lanes eventBus.publish({type: 'UPDATE_LANES', lanes: newLaneData}) +//To update one lane +eventBus.publish({type: 'UPDATE_LANE', lane: { id: 'TODO', title: 'teste' }}) + +//To add a new lane +eventBus.publish({type: 'ADD_LANE', lane: { id: 'TODO', title: 'teste' }}) + +//To move one lane +eventBus.publish({type: 'MOVE_LANE', fromIndex: 0, toIndex: 1 }) + +//To remove a lane +eventBus.publish({type: 'REMOVE_LANE', laneId: 'TODO' }) + + ```