Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

LucasBadico
Copy link

@LucasBadico LucasBadico commented Nov 26, 2020

We needed more fine control over the board state through event bus.

Also added the doc for the new API.

expose all lane actions to eventBus:
- updateLanes
- updateLane
- moveLane
- removeLane
- addLane
@LucasBadico LucasBadico requested a review from dapi as a code owner November 26, 2020 01:50
the updateLane action already existed in code, but was not documented, fixed
@LucasBadico LucasBadico force-pushed the feat/extend-event-bus branch from 661ade5 to 1a2287f Compare November 26, 2020 01:52
@@ -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' }})
Copy link
Author

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 })
Copy link
Author

@LucasBadico LucasBadico Nov 26, 2020

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?

Copy link
Collaborator

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?

Copy link
Author

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.

Copy link
Owner

@rcdexta rcdexta left a 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

@rcdexta
Copy link
Owner

rcdexta commented Dec 26, 2020

@LucasBadico do you mind resolving the merge conflict and I can add to coming release

@LucasBadico
Copy link
Author

@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 })
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know fromIndex and toIndexnames 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?

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants