Skip to content

[CSM Portal] fix dashboard drill-down losing its team filter - #1379

Merged
cloby99 merged 4 commits into
wso2-open-operations:mainfrom
rksk:sajithe/dashboard-widget-total-count
Aug 6, 2026
Merged

[CSM Portal] fix dashboard drill-down losing its team filter#1379
cloby99 merged 4 commits into
wso2-open-operations:mainfrom
rksk:sajithe/dashboard-widget-total-count

Conversation

@rksk

@rksk rksk commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Purpose

The CSM Portal dashboard's "View more" drill-down page (shape: "list" widgets) silently
dropped the current team's filter, returning every team's data instead of the viewer's own.
Resolves one reported CSM Portal dashboard issue (tracked internally).

Goals

  • Stop the "View more" drill-down page from silently widening its query to every team.
  • Make the drill-down page's actual query criteria visible to the viewer instead of implicit.

Approach

  • DashboardWidgetTile.tsx: the "View more" link now resolves the widget's team-placeholder
    filter before building its URL (resolveTeamPlaceholder(filters, selectedTeamGroupId)),
    mirroring the count-shape widget's own click-through link, which already did this correctly.
    Previously the raw, unresolved filter reached the URL, and the destination page — which has
    no team context of its own — fell back to its documented fail-open behavior and dropped the
    filter entirely.
  • widgetPreviewUrl.ts: new describeWidgetFilters() helper flattens a widget's filters
    (both shapes this app uses) into a human-readable list, reusing the existing case-filter-DSL
    handling rather than duplicating it.
  • DashboardWidgetPreviewPage.tsx: renders the above as a "Filtered by: ..." chip row above
    the results.
  • CsmCaseDetailPage.tsx: un-hides the case detail SLAs tab (hidden: true was reintroduced
    with no recorded rationale three weeks after the tab shipped visible; the underlying data
    path already works and is fetched on page load — only the tab button was unreachable).

User stories

As a CS engineer, when I drill into a dashboard widget's "View more" I see the same
team-scoped data the tile showed me, plus a clear summary of what's being filtered. Separately,
I can reach the case detail SLAs tab again.

Release note

Dashboard "View more" pages now keep the current team's filter and show the active filter
criteria. The case detail SLAs tab is visible again.

Documentation

N/A — internal-tool UI behavior change, no external-facing docs to update.

Automation tests

  • Unit tests: added/updated across the 3 touched dashboard source files (8 new tests: 2 for
    the team-placeholder resolution on the "View more" href, 3 for the filter-criteria display,
    5 for the new describeWidgetFilters helper).
  • Integration tests: none added; verified manually end-to-end against a real ServiceNow DEV
    backend (local full-stack run), confirming the filter-criteria chips reflect real data
    correctly.

Security checks

Samples

N/A

Related PRs

None

Migrations (if applicable)

N/A — no schema/data change.

Test environment

Verified locally: Vitest (jsdom), Node/pnpm per repo's package.json, Chrome (manual
end-to-end check against a local full-stack run with real ServiceNow DEV data).

Learning

N/A

Summary by CodeRabbit

  • New Features

    • Dashboard widget previews now display active filters as accessible summary chips.
    • Filter summaries support standard filters, team criteria, operators, and value-less conditions.
    • The SLA tab is now visible on case detail pages.
  • Bug Fixes

    • “View more” links now correctly apply the selected team filter.
    • Links omit the team filter when no team is selected while preserving other filters.

… its team filter

List-shape dashboard widgets now show their total item count next to the
title, matching the existing count-shape widget's number formatting.

The "View more" drill-down page also stopped silently dropping the current
team's filter: its link was built from a widget's raw, unresolved filters,
so a team-scoped widget's placeholder never got resolved before navigating
away, and the destination page (which has no team context of its own)
fell back to its documented fail-open behavior and queried every team's
data instead. The link now resolves the placeholder first, the same way
the count-shape widget's own click-through already does, and the
drill-down page shows the resolved filter criteria so what's being
queried is visible rather than implicit.
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2637e0a1-b1e8-47ea-b633-14c943b58c18

📥 Commits

Reviewing files that changed from the base of the PR and between eba025c and 9d511b0.

📒 Files selected for processing (3)
  • apps/csm-portal/webapp/src/features/csm-cases/pages/CsmCaseDetailPage.tsx
  • apps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardWidgetTile.test.tsx
  • apps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardWidgetTile.tsx
💤 Files with no reviewable changes (1)
  • apps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardWidgetTile.test.tsx

📝 Walkthrough

Walkthrough

Dashboard widgets now resolve current-team placeholders in preview URLs and display resolved active filters as accessible chips. The case detail page also shows the SLA tab.

Changes

Dashboard widget filter handling

Layer / File(s) Summary
Filter summary contract and formatting
apps/csm-portal/webapp/src/features/csm-dashboard/utils/widgetPreviewUrl.ts, apps/csm-portal/webapp/src/features/csm-dashboard/utils/widgetPreviewUrl.test.ts
Added WidgetFilterSummaryEntry and describeWidgetFilters. The utility formats flat and nested filters, operators, values, and resolved team IDs.
Widget tile preview navigation
apps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardWidgetTile.tsx, apps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardWidgetTile.test.tsx
List widget preview URLs resolve the current-team placeholder or omit the team filter when no team is selected.
Preview active-filter display
apps/csm-portal/webapp/src/features/csm-dashboard/pages/DashboardWidgetPreviewPage.tsx, apps/csm-portal/webapp/src/features/csm-dashboard/pages/DashboardWidgetPreviewPage.test.tsx
The preview page renders resolved filters as accessible outlined chips and omits the group when no filters exist.

Case detail SLA tab

Layer / File(s) Summary
SLA tab navigation
apps/csm-portal/webapp/src/features/csm-cases/pages/CsmCaseDetailPage.tsx
The SLA tab is visible in the case detail page tab bar.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DashboardWidgetTile
  participant widgetPreviewUrl
  participant DashboardWidgetPreviewPage
  DashboardWidgetTile->>widgetPreviewUrl: Resolve current-team filter
  DashboardWidgetTile->>DashboardWidgetPreviewPage: Open preview with resolved filters
  DashboardWidgetPreviewPage->>widgetPreviewUrl: Describe query filters
  widgetPreviewUrl-->>DashboardWidgetPreviewPage: Return filter summary entries
  DashboardWidgetPreviewPage-->>DashboardWidgetPreviewPage: Render active-filter chips
Loading

Possibly related PRs

Suggested labels: Type/Bug

Suggested reviewers: rashmika998, hesara2003

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: preserving the team filter during dashboard drill-down.
Description check ✅ Passed The description covers the purpose, goals, approach, user stories, release note, testing, security, environment, and related impact.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rksk

rksk commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Reviews resumed.

@rksk
rksk marked this pull request as draft August 6, 2026 03:37
rksk added 3 commits August 6, 2026 09:25
…a bare number

A bare total on its own still made the viewer do arithmetic against the
listLimit to know how much of it the tile is showing. Match the wording
the drill-down page's own pagination already uses, in the same spot.
hidden: true was reintroduced in wso2-open-operations#1267 with no recorded rationale, three
weeks after the tab shipped visible in wso2-open-operations#1049/wso2-open-operations#1079. The underlying data
path (useGetCsmCaseSlas -> BFF/entity-service POST /slas/search) works
and is already being fetched on page load; only the tab button was
unreachable.
Dropping the total-count feature (and its later "1-N of total" reformat)
from this branch; keeping the "View more" team-filter fix and the
drill-down page's filter-criteria display, which don't depend on it.
@rksk rksk changed the title [CSM Portal] show list-widget totals, fix dashboard drill-down losing its team filter [CSM Portal] fix dashboard drill-down losing its team filter Aug 6, 2026
@rksk
rksk marked this pull request as ready for review August 6, 2026 07:28
@cloby99
cloby99 merged commit 61ccbc1 into wso2-open-operations:main Aug 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants