Skip to content

[DREAM-688] Use BorderBoxList for enumerations#23953

Open
myabc wants to merge 1 commit into
devfrom
implementation/74940-migrate-enumerations-to-border-box-list
Open

[DREAM-688] Use BorderBoxList for enumerations#23953
myabc wants to merge 1 commit into
devfrom
implementation/74940-migrate-enumerations-to-border-box-list

Conversation

@myabc

@myabc myabc commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Ticket

https://community.openproject.org/wp/DREAM-688

What are you trying to accomplish?

Migrate the enumerations admin index list to the shared OpenProject::Common::BorderBoxListComponent, validating the primitive in a real drag-and-drop reordering context. Header, rows, empty state, and DnD wiring are preserved and covered by a component spec that shares the "a reorderable Border Box List" example.

Note

Document Types are not migrated in this PR. Since the page actually uses a semantic table, it is intentionally left out of scope here.

Screenshots

What approach did you choose and why?

Replaced the bespoke border_box_container header/row markup with the list component's slots (with_header, with_item, with_empty_state). The header now renders as an h3 to match sibling admin lists, and the itemless list shows the default Blankslate empty state. Drag target and per-row draggable data attributes, the turbo wrapper, and locale keys are preserved.

The markup and specs are kept byte-identical to the equivalent commit in the wider DREAM-697 migration (#23812) so the two branches reconcile without conflict.

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

Migrate the enumerations admin index from hand-rolled BorderBox header
and row markup to the shared BorderBoxListComponent, exercising the
primitive in a real drag-and-drop reordering context. The header now
renders as an h3 to match sibling admin lists. Adds spec coverage.

https://community.openproject.org/wp/DREAM-688
@myabc myabc requested review from HDinger and Copilot June 25, 2026 22:24
@myabc myabc added needs review ruby Pull requests that update Ruby code maintenance styling labels Jun 25, 2026
@myabc myabc added this to the 17.7.x milestone Jun 25, 2026
@myabc myabc marked this pull request as ready for review June 25, 2026 22:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Migrates the Administration → Enumerations index list to OpenProject::Common::BorderBoxListComponent, aligning the admin UI with the shared BorderBox list composition while keeping drag-and-drop reordering behavior intact.

Changes:

  • Replaced bespoke border_box_container markup in the enumerations index with BorderBoxListComponent header/item/empty-state slots.
  • Added component spec coverage for the enumerations index, including empty-state rendering and DnD-related data attributes.
  • Introduced shared RSpec examples for BorderBoxListComponent list headings, empty states, and generic reorderable-list behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
spec/support/shared/components/border_box_list_component.rb Adds shared examples for BorderBoxListComponent heading/empty state and reorderable-list expectations.
spec/components/admin/enumerations/index_component_spec.rb Adds component spec coverage for Admin::Enumerations::IndexComponent (rows, empty state, DnD attributes).
app/components/admin/enumerations/index_component.html.erb Switches enumerations index rendering to BorderBoxListComponent slots (header/items/empty state).

Comment on lines +75 to +88
it "renders each record as a draggable row pointing at its drop URL", :aggregate_failures do
draggable_records.each do |record|
selector = ".Box-row[data-draggable-type='#{drag_type}'][data-draggable-id='#{draggable_id_for(record)}']"

expect(rendered_component).to have_css(selector) do |row|
expect(row["data-drop-url"]).to end_with(drop_url_for(record))
end
end
end

def draggable_id_for(record)
record.id
end
end
let!(:priority_b) { create(:priority, name: "Trivial") }
let(:enumerations) { IssuePriority.where(id: [priority_a.id, priority_b.id]).order(:position) }

it_behaves_like "rendering Box", row_count: 2
Comment on lines +52 to +65
it "renders a drag-and-drop reorderable container", :aggregate_failures do
expect(rendered_component)
.to have_css(".Box.op-border-box-list[data-generic-drag-and-drop-target='container']") do |box|
expect(box["data-target-container-accessor"]).to eq(":scope > ul")
expect(box["data-target-allowed-drag-type"]).to eq("enumeration")
end

[priority_a, priority_b].each do |enumeration|
expect(rendered_component).to have_css(
".Box-row[data-draggable-type='enumeration']" \
"[data-draggable-id='#{enumeration.id}'][data-drop-url]"
)
end
end
@github-actions

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./modules/wikis/spec/features/admin/internal_provider_spec.rb[1:1]
🤖 Ask Copilot to investigate

Copy 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.

@copilot The following spec(s) are flaky in CI (first seen on PR #23953, linked for reference only):

- `rspec ./modules/wikis/spec/features/admin/internal_provider_spec.rb[1:1]`

Treat this as a standalone task, unrelated to PR #23953. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #23953 or reuse that branch.

Follow the playbook in docs/development/testing/handling-flaky-tests/README.md to find the root cause and fix the underlying race — do not skip, delete, or weaken the spec to make it pass; disabling is a last resort per the playbook, and only with a bug ticket. Verify the fix by running the spec(s) repeatedly (e.g. `script/bulk_run_rspec --run-count 10`).

If you cannot reproduce the flake or are not confident in a fix after reasonable investigation, do not fabricate a change or skip the spec to force CI green. Instead, leave the pull request in draft and document what you tried, the suspected cause, and any leads in its description, then assign @myabc to take over.

Once the fix is verified, title the PR after the spec(s) it fixes, and use the PR description to explain the root cause, how the change resolves it, and the before/after results. Label the PR `flaky-spec`, assign @myabc, and request a review from @myabc.
On every commit, set @myabc as the sole co-author with a `Co-authored-by:` trailer (use their GitHub no-reply email so it links to their account), so it is traceable who dispatched the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance needs review ruby Pull requests that update Ruby code styling

Development

Successfully merging this pull request may close these issues.

2 participants