Skip to content

feat(customer-portal): usage metrics UI improvements and chat widget cleanup - #1046

Merged
Rashmika998 merged 3 commits into
mainfrom
feature/case-date-range-filters
Jul 5, 2026
Merged

Rashmika998 merged 3 commits into
mainfrom
feature/case-date-range-filters

Conversation

@SasmithaDilshan

@SasmithaDilshan SasmithaDilshan commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Usage metrics panel (UsageEnvironmentProductsPanel): flat instance rows (no per-instance accordion), product header stats right-justified showing Avg/Min/Max only (Curr removed), instances show OS / Java Version / U2 Level only
  • Labels: data source toggle renamed to Live / Upload; "Core Metrics" renamed to CPU Usage
  • Data source toggle locked: always shows Live selected; pointerEvents: none prevents user interaction (reflects live API data source)
  • Default deployment tab: selects first tab with productCount > 0 instead of instanceCount > 0
  • Type fix: ProjectDeploymentItem.deployedProductCount → productCount to match actual API response field name
  • OS derivation: usageMetricsEnvironmentProducts now extracts os/osVersion from deployment metadata; defensive ascending date sort before .at(-1) to handle SN ordering differences
  • Chat widget: removed token request flow (TokenRequestModal, WebSocket handler, state) from NoveraChatPage

Test plan

  • Navigate to a project with usage metrics data — deployment tab auto-selects the first deployment that has products
  • Expand a product accordion — instances show OS, Java Version, U2 Level only (no summaryStats chips)
  • Product header stats are right-justified and show Avg / Min / Max (no Curr column)
  • Data source toggle shows "Live" selected and is not clickable
  • Toggle labels read "Live" and "Upload" (not "API Call" / "File Upload")
  • CPU Usage label appears in product header stats (not "Core Metrics")
  • Support chat widget loads without token request button or modal

Summary by CodeRabbit

  • New Features

    • Added OS information to instance details in usage and metrics views.
    • Renamed deployment count and updated usage labels for clearer wording, including “Live,” “Upload,” and “CPU Usage.”
  • Improvements

    • Simplified the usage and metrics experience by showing deployment tabs directly and streamlining product/instance displays.
    • Updated chat behavior to remove the token request flow and adjust input availability.
  • Bug Fixes

    • Instance details now use the most recent metric data for displayed values.

SasmithaDilshan and others added 3 commits July 5, 2026 19:08
…cleanup

- Rewrite UsageEnvironmentProductsPanel with flat instance rows showing OS/Java/U2 only;
  product headers right-justified with Avg/Min/Max stats (Curr removed); CPU Usage label
- Rename data source toggle labels to Live / Upload and lock it read-only (always Live)
- Default deployment tab to first with productCount > 0 instead of instanceCount
- Fix productCount field name in ProjectDeploymentItem type (was deployedProductCount)
- Add OS derivation with defensive date sort in usageMetricsEnvironmentProducts util
- Remove token request feature from NoveraChatPage chat widget
- Minor: trim "Escalation" suffix from escalation modal title

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ddressed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR refactors Usage & Metrics UI to derive tabs directly from deployment data, replacing the overview drill-down with a flat instance-row display and disabling data-source selection. It updates related type/constant contracts, adjusts instance metric derivation, and removes the token-request modal flow from the Novera chat page.

Changes

Usage Metrics Tab and Panel Refactor

Layer / File(s) Summary
Type and constant contracts
.../types/deployments.ts, .../types/usage.ts, .../usage-metrics/types/usageMetrics.ts, .../usage-metrics/constants/usageMetricsConstants.ts
ProjectDeploymentItem.deployedProductCount renamed to productCount; UsageProductInstanceRow gains os; expandedInstanceKeys/onToggleInstance moved from ProductExpandedViewProps to ProductAccordionRowProps; added USAGE_METRICS_INSTANCE_OS, removed USAGE_METRICS_INSTANCE_CORE_COUNT, relabeled data-source and core-metrics constants.
Instance metric derivation
.../usage-metrics/utils/usageMetricsEnvironmentProducts.ts
Instance datapoints are sorted by date before deriving javaVer, u2Level, and a new os field from the latest datapoint.
Deployment-driven tab logic
.../usage-metrics/components/UsageAndMetricsTabContent.tsx
Tabs and default tab are computed directly from deploymentsData; dataSource is fixed to API_CALL with the toggle disabled; overview panel branch removed, TabBar and time range selector always rendered.
Flat instance rendering in product panel
.../usage-metrics/components/UsageEnvironmentProductsPanel.tsx
Per-instance accordion expansion replaced with flat InstanceRow rendering; CurrMinMaxBlock drops the CURR column; accordion header/summary layout and ProductExpandedView invocation updated.

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

Novera Chat Token Modal Removal

Layer / File(s) Summary
Remove token-request modal flow
.../support/pages/NoveraChatPage.tsx
Removes TOKEN_WARNING_SESSION_LIMIT_REACHED and TokenRequestModal imports, replaces typing-disabled/modal state with showRichText/isInputDisabled, drops the token_request_ack WebSocket case and handleTokenRequestSubmit callback, and removes related ChatInput props.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: v15a1, cloby99, kasunsiyambalapitiya

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary and test plan, but most required template sections are missing or empty. Add the missing template sections: Purpose, Goals, Approach, User stories, Release note, Documentation, Testing, Security checks, and any applicable links.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the main usage metrics and chat widget changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/case-date-range-filters

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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/customer-portal/webapp/src/features/usage-metrics/components/UsageAndMetricsTabContent.tsx (1)

132-146: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Use disabled instead of pointerEvents: none for the locked toggle.

pointerEvents: none only blocks mouse interaction; the toggle buttons remain focusable via keyboard and are still announced as interactive controls by screen readers, even though nothing happens on activation (no onChange handler exists). Use MUI's disabled prop on the ToggleButtonGroup/ToggleButtons for correct semantics (removes from tab order, announces disabled state).

♿ Proposed fix
       <ToggleButtonGroup
         size="small"
         exclusive
         value={dataSource}
         aria-label="data source filter"
-        sx={{ pointerEvents: "none" }}
+        disabled
       >
-        <ToggleButton value={DataSource.API_CALL} aria-label={USAGE_METRICS_DATA_SOURCE_API_CALL}>
+        <ToggleButton value={DataSource.API_CALL} aria-label={USAGE_METRICS_DATA_SOURCE_API_CALL} disabled>
           {USAGE_METRICS_DATA_SOURCE_API_CALL}
         </ToggleButton>
-        <ToggleButton value={DataSource.FILE_UPLOAD} aria-label={USAGE_METRICS_DATA_SOURCE_FILE_UPLOAD}>
+        <ToggleButton value={DataSource.FILE_UPLOAD} aria-label={USAGE_METRICS_DATA_SOURCE_FILE_UPLOAD} disabled>
           {USAGE_METRICS_DATA_SOURCE_FILE_UPLOAD}
         </ToggleButton>
       </ToggleButtonGroup>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/customer-portal/webapp/src/features/usage-metrics/components/UsageAndMetricsTabContent.tsx`
around lines 132 - 146, The locked usage/source toggle in
UsageAndMetricsTabContent should use proper disabled semantics instead of
pointerEvents styling. Update the ToggleButtonGroup and/or its ToggleButton
children to be disabled so the controls are removed from tab order and announced
correctly by assistive tech, and remove the sx pointerEvents: "none" workaround.
Keep the existing DataSource.API_CALL and DataSource.FILE_UPLOAD options intact
while making the toggle non-interactive.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@apps/customer-portal/webapp/src/features/usage-metrics/components/UsageAndMetricsTabContent.tsx`:
- Around line 72-94: Handle the empty-deployments branch in
UsageAndMetricsTabContent so users see an explicit no-data state instead of only
the tab bar and time range selector. In the component’s deployment tab logic,
where defaultTab and activeDeploymentId are derived from deploymentsData, add a
guard for the empty deploymentsData case and render a dedicated empty-state UI
before UsageEnvironmentProductsPanel is considered. Keep the existing behavior
for non-empty data and use the current symbols deploymentTabs, defaultTab,
activeTab, and activeDeploymentId to place the fix.

---

Nitpick comments:
In
`@apps/customer-portal/webapp/src/features/usage-metrics/components/UsageAndMetricsTabContent.tsx`:
- Around line 132-146: The locked usage/source toggle in
UsageAndMetricsTabContent should use proper disabled semantics instead of
pointerEvents styling. Update the ToggleButtonGroup and/or its ToggleButton
children to be disabled so the controls are removed from tab order and announced
correctly by assistive tech, and remove the sx pointerEvents: "none" workaround.
Keep the existing DataSource.API_CALL and DataSource.FILE_UPLOAD options intact
while making the toggle non-interactive.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 435baf87-4d2e-4075-bd9e-ef4e198c94d5

📥 Commits

Reviewing files that changed from the base of the PR and between 60a42c9 and 92f21da.

📒 Files selected for processing (8)
  • apps/customer-portal/webapp/src/features/project-details/types/deployments.ts
  • apps/customer-portal/webapp/src/features/project-details/types/usage.ts
  • apps/customer-portal/webapp/src/features/support/pages/NoveraChatPage.tsx
  • apps/customer-portal/webapp/src/features/usage-metrics/components/UsageAndMetricsTabContent.tsx
  • apps/customer-portal/webapp/src/features/usage-metrics/components/UsageEnvironmentProductsPanel.tsx
  • apps/customer-portal/webapp/src/features/usage-metrics/constants/usageMetricsConstants.ts
  • apps/customer-portal/webapp/src/features/usage-metrics/types/usageMetrics.ts
  • apps/customer-portal/webapp/src/features/usage-metrics/utils/usageMetricsEnvironmentProducts.ts
💤 Files with no reviewable changes (2)
  • apps/customer-portal/webapp/src/features/usage-metrics/types/usageMetrics.ts
  • apps/customer-portal/webapp/src/features/support/pages/NoveraChatPage.tsx

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants