•  
     
    story #13626 Drag and drop cards
Summary
Empty
Drag and drop cards
Empty

Functional overview

The drag and drop enabling to change swimlane has been split into a different story at story #14149.

Drag'n drop on taskboard is quite a beast as it allows:

  • Drag'n drop to change status (as in cardwall v1)
  • Drag'n drop to change priority amongst cards
  • and... the combination of the 2 as one can change status and place a card precisely in the new column.

Limits (in the first implementation, if the need arise it will be done afterward):

  • There is no multiselect of elements (cannot drag'n drop multiple tasks at once).

Technical overview

This story assumes that the management of the mapping between columns and actual status of backlog_items is already done and is part of the VueJS app.

Backend of drop

As we cannot predict the way cards will be moved, we must introduce a new REST route that corresponds to "this card was placed in that cell" semantic. The move in this cell could be one of the 3 drag and drops described in functional overview or a combination. But it's the backend that will detect it and proceed with the corresponding actions.

/*
 * swimlane_id = The new parent swimlane's artifact id. The swimlane we are dropping into
 * column_id = The column I'm dropping into
 */
PATCH /taskboard_cells/{swimlane_id}/column/{column_id}
{
    add: <card_id>,                    // The artifact id of the card we are dropping
    order: {
      ids: [<card_id>],                // This maintains compatibility with existing "reordering" payloads (AgileDashboard REST routes)
      direction: "before",             // "before" | "after"
      compared_to: <card_id>
    }
}

In order to know whether swimlanes can be "dropped into" or whether cards can be "dragged", we will need to add some information to the "trackers" representations passed in DOM: 

/* The names may change */
can_update_mapped_field: true | false // Does current user have "update" permission on the taskboard mapped field for this tracker

When can_update_mapped_field is false, for all cards of this tracker, current user will not be able to drop them in any column (no change of "status").

Frontend of drop

Dynamic rules (from the workflow or field dependencies) are only managed as "backend errors". It means that there will be no visual indicator that a drop cannot be done due to a field dependency or worklow but if someone tries to do it anyway, they will get an error from the backend.

A card may not be dropped if there is no associated mapping for this column and the dragged item's "mapping field". It means that if I try to drop into this column, the backend won't know what value to assign, so it can't be dropped here.

We have spiked https://github.com/bevacqua/dragula and https://github.com/SortableJS/Vue.Draggable. We have chosen dragula because it does not try to "be smart" and update the model. It's easier to update the model ourselves than fix the errors the libs are doing.

Design warnings

  • A mock-up or skeleton for dropped card (something to display while the vueapp is fetching the content of the card)
    • => No need of card skeleton here. The "before drag", dragged and dropped card states will be the same. On dropped, the card will be on "updating" state then "updated" state, as we do in planning view. Pease check the live mockup and click on "Edit card" (bottom left) to simulate theses states.

Precisions on the mapping between a field and its cardwall column:
The field can be a multi-selectbox. And an admin may select multiple list values for a single column. For example when "status" is either "On going" or "Waiting", it goes in the "Ongoing" column.

In this case, we will follow the existing behaviour. For Drag and drop, this means that when I drop a card in the "Ongoing" column, it will assign the "status" field to "On going" for this card, because it's the first (by value id order).

Empty
Empty
Status
Empty
Done
Development
  • [ ] Does it involves User Interface? 
  • [ ] Are there any mockups?
  • [ ] Are permissions checked?
  • [ ] Does it need Javascript development?
  • [ ] Does it need a forge upgrade bucket?
  • [ ] Does it need to execute things in system events?
  • [ ] Does it impact project creation (templates)?
  • [ ] Is it exploratory?
Empty
Details
#13626
Manuel Vacelet (vaceletm)
2019-12-04 13:44
2019-07-11 16:00
14986

References
Referencing story #13626

Git commit

tuleap/tuleap/stable

Extract artifacts reordering in unit-tested class 390edfc937
Add GET /taskboard/:id/columns 5c94c10cae
Allow reordering children Cards through REST API 34b965f208
Reorder cards in column 4e3764ad6d
Extract cells helper functions in vuex getters 227c6907db
Unit-test drag and drop handler be9778443c
Enforce presence of "order" key in PATCH payload c303f5c314
Get Mapping without cardwall config 61ed260d14
Refactoring: Group Milestone Tracker and Tracker together c706a7d6b0
Update PATCH taskboard cell to change card status cc98553068
Inject "can update mapped field" in DOM ae95460cf5
Prevent reordering when a card is dropped in its source cell ed020050a5
Drag over collapsed column label now works 05196f6b4c
Refresh parent card when changing status 5dceae7719
Remove unused private method cfe206544d
Only allow reordering when user can't update status 69042dafa6
Fix card opacity when it's moving around the taskboard 2cf3ad3a60
Refresh dropped card and parent on change of status 58879f38fa
Remove "show" card animation f8cf70f8da
Improve drag and drop performances f9871d4049
Keep a minimum swimlane height when I drop a solo card in a collapsed column a0cc989d79

Follow-ups

User avatar
Joris MASSON (jmasson)2019-12-03 17:27
Real-time update was split and is now story #14251 have Real-time update

  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
Joris MASSON (jmasson)2019-11-14 10:13
updated ACs. The "change of swimlane" part of this story has been moved to story #14149.
Permission on artifact field governs who can "see" the artifact, not who can update it. I have therefore removed all "can_update" mentions for drag and drop, those checks don't need to be made.
I have also explained the choice of lib for dragula.

  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
Joris MASSON (jmasson)2019-10-21 16:35
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
Joris MASSON (jmasson)2019-10-21 11:59
Update ACs after split and estimation

  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
  • Status changed from Ready (stalled) to On going
User avatar
Joris MASSON (jmasson)2019-10-11 16:36
Updated ACs. The realtime part of this story is split and will be done at a later time.

  • I want to
    -drag'n drop cards on cardwall 
    +Drag and drop cards 
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
Joris MASSON (jmasson)2019-07-18 15:01
Add my notes following the estimation. Mainly, the realtime event mechanism is considered as already done in story #13629

  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
  • Technical informations
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
Joris MASSON (jmasson)2019-07-12 14:11
Added technical precisions from my notes.

  • Technical informations
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes