Conversation
df4892f to
beafede
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Two moderate findings remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Migrates work package type ordering to the shared sortable-lists system while preserving pagination, grouped variants, and server-backed move actions.
Changes:
- Adds anchor-based drag ordering and paginated move handling.
- Updates sortable markup, handles, drag feedback, and pagination context.
- Expands request, component, controller, and browser coverage.
Two moderate findings remain: legacy group selectors need migration or compatibility support, and single-type rows can still initiate dragging.
| File | Summary |
|---|---|
spec/requests/work_package_types/type_ordering_spec.rb |
Covers ordering requests and validation. |
spec/features/types/variants_index_spec.rb |
Updates grouped-list browser coverage. |
spec/features/types/type_ordering_spec.rb |
Covers paginated browser ordering. |
spec/controllers/work_package_types/types_controller_spec.rb |
Updates controller ordering expectations. |
spec/components/work_package_types/types/type_actions_component_spec.rb |
Tests paginated move menus. |
spec/components/work_package_types/types/grouped_list_component_spec.rb |
Tests sortable markup and context URLs. |
spec/components/open_project/common/border_box_list_component_spec.rb |
Tests drag-handle argument forwarding. |
app/views/work_package_types/types/index.html.erb |
Passes pagination context. |
app/models/type.rb |
Enables anchor-based ordering. |
app/controllers/work_package_types/types_controller.rb |
Handles paginated drag and menu reordering. |
app/components/work_package_types/types/type_actions_component.rb |
Preserves pagination in move menus. |
app/components/work_package_types/types/grouped_list_component.sass |
Adds drag feedback styling. |
app/components/work_package_types/types/grouped_list_component.rb |
Configures sortable groups and URLs. |
app/components/work_package_types/types/grouped_list_component.html.erb |
Renders sortable grouped-list markup and pagination. |
app/components/open_project/common/border_box_list_component/header.rb |
Supports drag-handle configuration. |
app/components/open_project/common/border_box_list_component/header.html.erb |
Forwards drag-handle configuration. |
app/components/_index.sass |
Imports sortable-list styles. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Warning Flaky specs
🤖 Ask Copilot to investigateCopy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer. |
lwassermann
left a comment
There was a problem hiding this comment.
There seems to be something broken with the expansion. Dragging around some items closes all unfolded Types. Be they dragged or just other elements in the list. That feels quite annoying. Is there something we could do about that?
Reloading the page also closes everything and also feels annoying. Expanding is just not added to the URL 😅
We do have list_id in the sortable list params. But still we handle the page_args separately in the links. That feels like we have two different ways to handling the same problem. Scoping the list we're operating in. Maybe they belong together?
Some small comments, but nothing that should block this from being rolled out 👍 💯
| form_arguments: { method: :post } | ||
| tag: :button, | ||
| href: move_types_path(type, **page_args, expand: expanded_type_id), | ||
| form_arguments: { method: :post, inputs: [{ name: "type[move_to]", value: move_to.to_s }] } |
There was a problem hiding this comment.
Am I right in assuming that we can't use SortableList::MoveMenu here because of the additional page_args and expanded_type_id arguments? Or is it the first/last detection that is limited for paginated lists?
There was a problem hiding this comment.
Right — SortableLists::MoveMenu works out availability and moves from the visible DOM siblings, so it can't move across pages. Paginated statuses use the same server-backed menu approach. Menus now carry page and expansion context (91023d0).
(Server-backed move menus are hand-rolled in statuses, types, project phase definitions, CF hierarchy items and backlogs. A sibling SortableLists::ServerMoveMenu mixin could share the directions and gating; I'll fold that into the helpers follow-up.)
| params[:list_type] == ::Type.model_name.param_key && | ||
| (params[:list_id].nil? || params[:list_id] == "") && | ||
| params.key?(:prev_id) | ||
| end |
There was a problem hiding this comment.
This check and the surrounding methods seem to exist wherever we use sortable_lists. Even if we do copy them out or overwrite them in some controllers, I feel like we should create helpers for these. I was already tempted on my PR. Seeing it here again reinforces that feeling. But that is probably out of scope for this PR, because of how many places it would already change.
There was a problem hiding this comment.
Good point. I'll add a work package for this.
Adds a drag_handle_arguments option to the Border Box list header and forwards it to the Primer drag handle, so sortable lists can mark the header handle as their drag target without wrapping the header. https://community.openproject.org/wp/DREAM-791
bfe7ddd to
f0d7561
Compare
Replaces the generic drag-and-drop wiring on the type index with sortable lists. Drops are validated relative anchors; a blank anchor places the type at the start of the current page, so dragging on later pages stays on that page. The list morphs in place and keeps page and expansion context in its drop URL and pagination links. A lone type is fixed in place. Moves the type index feature specs onto the page object, which finds groups by exact title. https://community.openproject.org/wp/DREAM-791
Carries page and expansion context into the lazy type menus and posts menu moves with it. Moves stay global, and the server now answers with a morph of the current page instead of redirecting to the first page. Removes the unused type_move permitted parameter. https://community.openproject.org/wp/DREAM-791
f0d7561 to
91023d0
Compare

Ticket
https://community.openproject.org/wp/DREAM-791
What are you trying to accomplish?
Migrate work package type ordering to sortable-lists while retaining pagination and the existing grouped variant presentation.
What approach did you choose and why?
Form configuration is separate in DREAM-859.
AI involvement
Collaborative
Merge checklist