Skip to content

Use displayId in work package URLs for semantic identifier routing#22733

Draft
akabiru wants to merge 3 commits intofeature/73717-adapt-work-package-lists-for-project-based-semantic-work-package-identifiersfrom
implementation/73797-use-displayid-in-work-package-urls
Draft

Use displayId in work package URLs for semantic identifier routing#22733
akabiru wants to merge 3 commits intofeature/73717-adapt-work-package-lists-for-project-based-semantic-work-package-identifiersfrom
implementation/73797-use-displayid-in-work-package-urls

Conversation

@akabiru
Copy link
Copy Markdown
Member

@akabiru akabiru commented Apr 13, 2026

Ticket

https://community.openproject.org/wp/73797

Builds on #18997

What are you trying to accomplish?

When a project has semantic work package identifiers enabled, clicking any work package link still showed the numeric PK in the browser URL bar (e.g. /work_packages/42/activity). This changes all frontend-generated URLs to use the semantic displayId instead (e.g. /work_packages/PROJ-7/activity), giving users readable, shareable URLs that match the identifiers they see in the UI.

The backend already accepts both forms — this is purely a frontend wiring change.

What approach did you choose and why?

The tricky part is that the same <a> element serves two masters: the href for navigation, and data-work-package-id for the selection/hover system. Selection is keyed by numeric PK everywhere — row CSS classes (wp-row-42), setSelection(), hover sync with parseInt() — so changing the data attribute would break a lot of things.

The fix separates these two concerns:

UiStateLinkBuilder now takes an optional routingId that only affects the href. The data attribute stays numeric. This covers all table/card link elements where one DOM node does both routing and selection.

Navigation handlers (list view, embedded tables, boards, BCF, calendar) use a resolveRoutingId() helper that looks up the WP from the States cache and returns displayId ?? workPackageId. This covers click-to-navigate flows where the event carries a numeric ID from the data attribute but the URL should be semantic.

Direct callers (breadcrumbs, tabs, hierarchy, single view, context menu, quickinfo macro, post-creation redirect) just inline the displayId ?? id pattern since they already have the WP resource in scope.

API-only paths (time entries, share dialogs, hover cards, progress modal) are deliberately left with numeric IDs — they never appear in the address bar so there is no user benefit to changing them, and it avoids unnecessary risk.

Everything falls back to numeric IDs gracefully when displayId is not set (classic mode).

Merge checklist

  • Added/updated tests
  • Tested major browsers (Chrome, Firefox, Edge, ...)

@akabiru akabiru marked this pull request as draft April 13, 2026 11:31
@akabiru akabiru changed the title Use displayId in work package URLs for human-readable routing Use displayId in work package URLs for semantic identifier routing Apr 13, 2026
Routes already accept semantic identifiers (e.g. PROJ-7) via
WP_ID_URL_PATTERN, but all frontend-generated links still used
numeric PKs. This wires displayId into every navigation path so
the browser URL bar shows the semantic form when available.

Key design decision: data-work-package-id attributes on <a>
elements stay numeric — the selection/hover system is keyed by
PK. Only the href gets the semantic ID via a new optional
routingId parameter on UiStateLinkBuilder.

Changes span table links (ID column, linked WP fields, details
action), navigation handlers (list view, embedded tables, boards,
BCF, calendar), breadcrumbs, tabs, hierarchy, single view,
context menu, quickinfo macro, and post-creation redirect.

API-only paths (time entries, share, hover cards, progress modal)
are deliberately left with numeric IDs — they never appear in the
address bar.
@akabiru akabiru force-pushed the implementation/73797-use-displayid-in-work-package-urls branch from 6574c91 to 530eecc Compare April 13, 2026 11:36
Stateful navigation changes ($state.go callers) moved to a
follow-up PR with P1 bug fixes for focus/selection, card
highlight, bulk delete, and cache coherence.

Retained changes only modify href attributes and URL strings —
click handlers still read data-work-package-id (numeric PK),
so no semantic IDs leak into Angular state params.
@akabiru akabiru self-assigned this Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant