-
Notifications
You must be signed in to change notification settings - Fork 487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extend event bus capabilities #417
base: master
Are you sure you want to change the base?
extend event bus capabilities #417
Conversation
expose all lane actions to eventBus: - updateLanes - updateLane - moveLane - removeLane - addLane
the updateLane action already existed in code, but was not documented, fixed
661ade5
to
1a2287f
Compare
@@ -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' }}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one already was in code, but was not documented.
eventBus.publish({type: 'ADD_LANE', lane: { id: 'TODO', title: 'teste' }}) | ||
|
||
//To move one lane | ||
eventBus.publish({type: 'MOVE_LANE', fromIndex: 0, toIndex: 1 }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm asking myself if it was not better to create a new action based on id, not on index. What do you think, @dapi?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @LucasBadico !
I agree with you. If we pass an id we can fetch lane's index when need.
What is you use case of MOVE_LANE
event? Do you save lanes order to backend?
One thought came. When we drug one lane, from example move it from index 0 to index 5. Actually all lanes from 1 to 5 index are moved ) Shall we emit events for all these lanes? Probably better way to emit event like "LANES_MOVED" and pass new ordered lanes set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have some points.
but my use case here:
- move lane was needed because the WebSocket and the feature of move lane and the socket keep the order of all clients synched.
- would be a good thing to have that Lanes Moved, but now I'm doing this on my backend, with a head and tail logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @LucasBadico. Makes sense to expose other actions on the event bus
@LucasBadico do you mind resolving the merge conflict and I can add to coming release |
sure, will try to do this by end of my day. |
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 }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know fromIndex
and toIndex
names are better then oldIndex
and newIndex
. But it is preferable not to create new entities. We need either rename current attributes either use their. As we can't simply rename their because of using them by users we just have to use current names.
@LucasBadico What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sense. Principle of least surprise.
We needed more fine control over the board state through event bus.
Also added the doc for the new API.