Skip to content

feat: add the event mapping page to the admin panel - #5469

Merged
mbani01 merged 7 commits into
mainfrom
feat/issue-1158-event-mapping-page
Nov 27, 2026
Merged

mbani01 merged 7 commits into
mainfrom
feat/issue-1158-event-mapping-page

Conversation

@mbani01

@mbani01 mbani01 commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

What this adds

Last PR for the review of held Sessionize events: the "Event mapping" tab in the admin panel.

#5463, #5465, #5467 and #5468 are merged; this branch is rebased on main.

Refs linuxfoundation/lfx-cdp-insights-ops#1158

The page

Admins only. The tab badge shows how many events still need a decision.

  • Status tabs with counts: Best match, Unresolved, Confirmed, Ignored. A platform filter sits above them (All platforms, Sessionize).
  • Each row shows the event and its dates, the platform, the match badge with its evidence (or the reason there is no suggestion), the project with its project group, and the actions.
  • Actions: Confirm, Ignore, change the project through a picker, "Use " when the rules found a close event they did not accept, Confirm selected for several rows, Undo on a confirmed row and Restore on an ignored one.
  • Undo is replaced by "Loading started" once the event has a sync unit.
  • A picked project that is not confirmed yet lives in the page only. It survives Undo, Restore and Ignore, with the "Picked manually" badge.
  • Failed loads show an error with a retry. They are never shown as an empty list.
  • After a decision the list is refetched, and the buttons stay disabled until it is fresh.

Project picker

The picker has its own small endpoint, GET /event-mapping/projects (permission eventMappingRead, Zod-validated search, limit, offset), backed by searchActiveSubprojectsForMapping in the data-access layer.

  • It returns active projects with the project group name taken from the project group itself, ordered by project group and then project name, so the grouped list stays in order as more pages load.
  • The search matches the project name or the project group name.
  • The existing "lite" project query was not reused: it pages by project name only, and 56 of the 12,885 active projects have no stored group name in the column it reads.

Differences from the design

The page follows the design for layout, copy and behaviour. Where the design and the shared components or theme tokens differ, the shared ones win:

Element Design This page Cause
Match badges Amber, blue, grey, orange Best match and sub-event blue, unresolved yellow, manual pick gray lf-pill types; the kit has no orange
Status tabs Underlined Highlighted lf-tabs
Platform filter Segmented control Dropdown Same control as the Integrations status page
Section heading 18 px 16 px Theme heading scale (h6)
"Select project" Full cell width Natural width lf-popover trigger
Project picker Expands in the cell Popover with the dropdown look lf-popover, dropdown tokens
"Use " Dashed border Ghost button lf-button
Colours, paddings Design's own values Theme tokens Theme

Other agreed differences: no Credly option in the platform filter (no data yet), no event search box, and the extra unresolved reasons the API returns ("Not checked yet", "Project not in CDP").

Files that need a code owner

services/libs/data-access-layer/src/segments/index.ts (one added function).

Tests

44 frontend unit tests (labels, evidence texts, page state helpers), 58 backend handler tests and 28 data-access-layer database tests pass. Lint, type check and build pass.

The page was checked at 1440 px against the design in a local preview with mocked requests. It has not been tested against a real backend with an Auth0 login.

Known limits

  • The tab badge loads the full list to show one number. The list holds about 100 rows today.
  • One line in frontend/src/shared/queries/invalidate.ts is re-wrapped by the pre-commit prettier hook.
  • The table's minimum width uses one arbitrary value (min-w-[1040px]); the theme has no equivalent token.
  • "Confirm selected" sends every selected row in one request, and the endpoint accepts at most 200. There is no select-all, so this needs more than 200 manual ticks.
  • A search longer than 100 characters pasted into the picker is refused by the endpoint and shows as a load failure.
  • The picker search reads from the primary database; the replica would do, since a decision does not change projects.
  • The picker panel repeats the shared dropdown's classes rather than referencing its class name.

@mbani01
mbani01 requested review from a team and lfx-one as code owners November 27, 2026 17:17
Copilot AI balanced review requested due to automatic review settings November 27, 2026 17:17
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@cursor

cursor Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Introduces a new admin workflow that drives confirm/ignore/restore mapping decisions and a new paginated project search query; gated by admin role and eventMappingRead, but mistakes affect how Sessionize events link to projects.

Overview
Adds an Event mapping tab to the admin panel (admins only), including a badge with the count of events still needing a decision.

The new page lets reviewers filter by platform and status (Best match, Unresolved, Confirmed, Ignored), inspect match badges and evidence, pick or change CDP projects via a searchable infinite-scroll picker, and Confirm, Ignore, Restore/Undo, or bulk Confirm selected. Client-side state tracks manual picks and “Just now” decision notes until the list refetches.

Backend adds GET /event-mapping/projects (eventMappingRead, Zod-validated search/limit/offset) and searchActiveSubprojectsForMapping in the data-access layer (active subprojects with group name from the grandparent segment, ordered by group then project, ILIKE search with safe %/_ handling). The frontend wires TanStack Query keys, invalidation, API helpers, row/picker components, and shared label/evidence helpers, with broad unit and handler/DB test coverage.

Reviewed by Cursor Bugbot for commit 2b3d584. Bugbot is set up for automated code reviews on this repo. Configure here.

@lfx-one

lfx-one commented Nov 27, 2026 •

Copy link
Copy Markdown

@mbani01 I'm starting review 1 of this pull request now (started 2026-11-27 17:17 UTC using review agent v0.1.34). This usually takes a few minutes. I'll update this comment with the summary when I'm done. If there's no summary here after about 45 minutes, the review stopped: push a new commit, or post a comment that begins with a mention of me followed by re-review, to start another. For help with the review agent, see https://github.com/linuxfoundation/lfx-review-agent/issues.


Hi Mouad BANI, thanks for the detailed PR description and the tests that come with it.

Summary

This adds an admin-only "Event mapping" tab where Sessionize events can be confirmed, ignored, restored or re-mapped through a project picker. It also adds the GET /event-mapping/projects endpoint and its data-access query. The code is consistent with the repository's conventions, with no findings.

Decision

✅ Approved

Details

Overall impression: The new endpoint checks eventMappingRead before reading anything, validates search, limit and offset with Zod, and the query binds its parameters and escapes % and _ in the search text. On the page, a failed load shows an error with a retry instead of an empty list, and the tab is rendered only for admins. The helper, label and handler tests, and the database tests for the new query, cover the main cases.

Other reviewers and CI checks: Greptile raised one P2 point: if a decision succeeds but the list refetch fails, the old buttons become enabled again and there is no retry control, because cached rows exist. It is a non-blocking edge case, and I did not repeat it as a finding. The required DCO check passed on 8d127b1.

Documentation reminder: changed /event-mapping/projects, Event mapping. Please check product pages and external docs; the author and maintainers own those updates.

Rule files: read AGENTS.md, frontend/CLAUDE.md, .claude/rules/skill-guidance.md; skipped none

Questions, problems, or feedback: https://github.com/linuxfoundation/lfx-review-agent/issues

@greptile-apps

greptile-apps Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge; the previous refresh issue is fixed and no new actionable issues were found.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous refresh issue is fixed and no new actionable issues were found.

Summary

Adds the admin Event mapping page, project picker endpoint, and grouped project search.

  • Admins can review held Sessionize events in the admin panel.
  • The project picker searches active projects by project or group name.

Tests and browser checks were not run during this review.

Reviews (2) · Last reviewed commit: "fix: keep event mapping actions disabled..." · Reviewed by Greptile

lfx-one
lfx-one previously approved these changes Nov 27, 2026

@lfx-one lfx-one left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No blocking or minor findings. The new picker endpoint is permission-checked and Zod-validated, the new query escapes % and _ in the search text, and the page keeps failed loads out of the empty state. The required DCO check passed on this commit.

Documentation

This pull request changes behavior that may also be described outside this repository, such as product pages or an external docs site. I can't read those, so please check them; the author and maintainers own those updates. Changed here:

  • /event-mapping/projects (new route)
  • Event mapping (new admin panel tab)

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.

🟡 Changes recommended

Failed refreshes leave stale actions available, later-page fetch errors lack a retry, and project options and bulk-selection checkboxes have unresolved keyboard and screen-reader accessibility issues.

4 open issues
What changed in this PR

Adds the admin-only Event mapping page, completing the review workflow for held Sessionize events built by the preceding storage and API PRs.

Changes:

  • Adds status tabs, counts, match evidence, project selection, and individual or bulk review actions.
  • Adds a validated project-search endpoint with grouped, paginated results from the data-access layer.
  • Adds tests for display helpers, project search, permissions, and validation.
File Description
services/​libs/​data-access-layer/​src/​sessionize/​index.test.ts Tests project search, ordering, pagination, and filtering.
services/​libs/​data-access-layer/​src/​segments/​index.ts Adds paginated project search with group names.
frontend/​src/​shared/​types/​tanstack.ts Adds event-mapping query identifiers.
frontend/​src/​shared/​queries/​keys.ts Defines list and project-search cache keys.
frontend/​src/​shared/​queries/​invalidate.ts Adds event-mapping cache invalidation.
frontend/​src/​modules/​admin/​pages/​admin-panel.page.vue Adds the admin tab and pending-count badge.
frontend/​src/​modules/​admin/​modules/​event-mapping/​types/​EventMapping.ts Defines event, project, and UI types.
frontend/​src/​modules/​admin/​modules/​event-mapping/​services/​event-mapping.api.service.ts Wraps list, search, and decision endpoints.
frontend/​src/​modules/​admin/​modules/​event-mapping/​queries/​useEventMappingProjectsQuery.ts Loads project-search pages.
frontend/​src/​modules/​admin/​modules/​event-mapping/​queries/​useEventMappingListQuery.ts Loads event mappings through the shared cache.
frontend/​src/​modules/​admin/​modules/​event-mapping/​pages/​event-mapping.page.vue Implements filtering, selection, and review actions.
frontend/​src/​modules/​admin/​modules/​event-mapping/​event-mapping-helper.ts Provides display, selection, and local-state helpers.
frontend/​src/​modules/​admin/​modules/​event-mapping/​event-mapping-helper.test.ts Tests helpers and manual-pick retention.
frontend/​src/​modules/​admin/​modules/​event-mapping/​config/​platforms.ts Defines Sessionize display settings.
frontend/​src/​modules/​admin/​modules/​event-mapping/​config/​match-labels.ts Defines match badges and evidence text.
frontend/​src/​modules/​admin/​modules/​event-mapping/​config/​match-labels.test.ts Tests badges and evidence wording.
frontend/​src/​modules/​admin/​modules/​event-mapping/​components/​event-mapping-row.vue Renders event details and row actions.
frontend/​src/​modules/​admin/​modules/​event-mapping/​components/​event-mapping-project-picker.vue Adds grouped project search and scrolling.
backend/​src/​api/​eventMapping/​index.ts Registers the project-search route.
backend/​src/​api/​eventMapping/​eventMappingProjects.ts Validates and authorizes project searches.
backend/​src/​api/​eventMapping/​eventMappingProjects.test.ts Tests endpoint responses, validation, and permissions.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 27, 2026 17:28
@lfx-one

lfx-one commented Nov 27, 2026 •

Copy link
Copy Markdown

@mbani01 I'm starting review 2 of this pull request now (started 2026-11-27 17:28 UTC using review agent v0.1.34). This usually takes a few minutes. I'll update this comment with the summary when I'm done. If there's no summary here after about 45 minutes, the review stopped: push a new commit, or post a comment that begins with a mention of me followed by re-review, to start another. For help with the review agent, see https://github.com/linuxfoundation/lfx-review-agent/issues.


Hi Mouad BANI, thanks for addressing the earlier feedback so quickly.

Summary

This push makes a failed list refresh lock the row actions and show a retry. It also adds a retry for failed later pages in the project picker and gives the row checkboxes accessible names. The change is small and well tested, and I found no new issues.

Decision

✅ Approved

Details

Overall impression: The new listState helper separates a failed first load from a failed refresh. While a refresh has failed, actionsLocked disables every row action, the checkboxes and "Confirm selected", and the retry calls refetch(). The picker keeps the loaded projects and offers a retry for the next page. The listState unit test covers the four states. The earlier review's change to the new endpoint and query is unchanged.

👏 Nice work: Locking the actions on a failed refresh and keeping the rows visible keeps the reviewer's place and stops a repeated decision. The hidden "Select " label gives each checkbox a name even though LfCheckbox does not forward attributes to its input.

Revision tracking:

  • ✅ Resolved: Greptile's "Failed refresh leaves stale actions" and Copilot's "Hide stale rows and show retry after mutation refresh fails", fixed in 2b3d584.
  • ✅ Resolved: Copilot's "Show retry for failures loading later project pages", fixed in 2b3d584.
  • ✅ Resolved: Copilot's "Add accessible names to bulk-selection checkboxes", fixed in 2b3d584.
  • ℹ️ Not changed by the author: Copilot's "Make project dropdown options keyboard accessible". The author replied that keyboard support belongs in the shared LfDropdownItem, which other dropdowns use the same way. It is an existing limitation of a shared component, so I did not raise it as a finding. Please track it separately.

Other reviewers and CI checks: Greptile's second pass reports no new issues. The required DCO check passed on 2b3d584.

Documentation reminder: changed Could not refresh the list., Could not load more projects.. Please check product pages and external docs; the author and maintainers own those updates.

Rule files: read AGENTS.md, frontend/CLAUDE.md, .claude/rules/skill-guidance.md; skipped none

Questions, problems, or feedback: https://github.com/linuxfoundation/lfx-review-agent/issues

@lfx-one lfx-one left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No blocking or minor findings in the new commit. A failed list refresh now locks the row actions, the checkboxes and "Confirm selected" and shows a retry, the project picker shows a retry when a later page fails, and the row checkboxes have accessible names. The required DCO check passed on 2b3d584.

Documentation

This pull request changes behavior that may also be described outside this repository, such as product pages or an external docs site. I can't read those, so please check them; the author and maintainers own those updates. Changed here:

  • Could not refresh the list. (new message with a retry on the event mapping page)
  • Could not load more projects. (new message with a retry in the project picker)

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.

🔵 Needs a closer look

The pagination query incorrectly reports total: 0 when the offset reaches or exceeds the matching project count, requiring a count fallback and a database test for this boundary.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Preserve total count when offset yields an empty page

services/​libs/​data-access-layer/​src/​segments/​index.ts:364

When the offset reaches or exceeds the number of matching projects, the window-count query returns no rows and this reports total: 0. For example, three matches with offset=3 should return an empty page with total: 3. Obtain the count independently when a nonzero offset returns an empty page, and add a database test for this boundary.

4 resolved since last review

Review effort: Balanced

@mbani01
mbani01 merged commit e53e286 into main Nov 27, 2026
19 checks passed
@mbani01
mbani01 deleted the feat/issue-1158-event-mapping-page branch November 27, 2026 17:41
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.

4 participants