Skip to content

Add Historical Range display in View Monitor page#490

Draft
rasika2012 wants to merge 1 commit intowso2:mainfrom
rasika2012:minor-bugs
Draft

Add Historical Range display in View Monitor page#490
rasika2012 wants to merge 1 commit intowso2:mainfrom
rasika2012:minor-bugs

Conversation

@rasika2012
Copy link
Contributor

@rasika2012 rasika2012 commented Mar 4, 2026

Purpose

This pull request enhances the ViewMonitorComponent in the evaluation workspace by improving how historical monitors are displayed. The main change is the addition of a clear visual indicator and label for historical monitor periods, making it easier for users to distinguish between historical and current monitors.

User interface improvements for historical monitors:

  • Added a Chip component with a clock icon and a formatted date range label to indicate when a monitor is historical, replacing the time range selector in this case. (ViewMonitor.Component.tsx)
  • Introduced logic to determine if a monitor is historical (isHistorical) and to format and display the historical date range (historicalRangeLabel). (ViewMonitor.Component.tsx)
  • Updated the UI to conditionally show either the historical range chip or the time range selector, depending on the monitor type. (ViewMonitor.Component.tsx)

Component and dependency updates:

  • Imported the Chip component to support the new historical monitor UI. (ViewMonitor.Component.tsx)

Minor refactor:

  • Added a small whitespace for readability in the memoized label code. (ViewMonitor.Component.tsx)

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

User stories

Summary of user stories addressed by this change>

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter �N/A� plus brief explanation of why there�s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type �Sent� when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type �N/A� and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

Summary by CodeRabbit

  • New Features
    • Added historical mode support to the monitor view, displaying the date range for past monitor data.
    • Replaced the time-range selector with a date-range label when viewing historical monitors, providing better context for past data analysis.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 4, 2026

📝 Walkthrough

Walkthrough

Added historical mode support to the monitor view component. When monitorData type is "past", the component displays the historical time range as a non-editable chip instead of the interactive time-range selector, and includes logic for formatting and displaying the date range.

Changes

Cohort / File(s) Summary
Historical Mode UI Enhancement
console/workspaces/pages/eval/src/ViewMonitor.Component.tsx
Added isHistorical flag detection, historicalRangeLabel computation for date range formatting, and conditional rendering to display a Chip component for historical ranges instead of the time-range Select control.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A monitor stands at the crossroads of time,
Now glancing backward with historical shine,
Past traces gleam in a chip's gentle frame,
While selectors rest—no picking today, my friend!
Time ranges bloom where data once danced. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes a well-written Purpose section explaining the enhancement and its benefits, but most required sections (Goals, Approach, User stories, Release note, Documentation, Training, Certification, Marketing, Automation tests, Security checks, Samples, Related PRs, Migrations, Test environment, and Learning) are left as unfilled template placeholders. Complete the remaining template sections, particularly Goals, Approach (with UI screenshots), Automation tests (unit and integration test coverage), Security checks, and Documentation/Training links to provide comprehensive context for code review and release.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main change: adding historical range display to the View Monitor page, which aligns with the core objective of displaying historical monitor periods.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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)
console/workspaces/pages/eval/src/ViewMonitor.Component.tsx (1)

362-362: Use theme token instead of hardcoded width in sx.

Line 362 uses a hardcoded width value. Prefer a theme token to keep spacing consistent across the console app.

Proposed fix
-                    sx={{ minWidth: 140 }}
+                    sx={{ minWidth: (theme) => theme.spacing(17.5) }}

As per coding guidelines, console/**/*.{ts,tsx,js,jsx} should use theme tokens via the sx prop instead of hardcoded colors and spacing values.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@console/workspaces/pages/eval/src/ViewMonitor.Component.tsx` at line 362, The
component is using a hardcoded minWidth in the sx prop (sx={{ minWidth: 140 }})
which violates theme-token usage; replace the literal with a theme spacing token
(e.g., theme.spacing(...) or a named token like 'sizes.xs' / 'spacing.14'
depending on your design system) accessed via the sx callback or token key so it
uses the app theme — locate the sx on ViewMonitor.Component (the element with
sx={{ minWidth: 140 }}) and change it to use the theme token equivalent
(sx={(theme) => ({ minWidth: theme.spacing(<n>) })} or sx={{ minWidth: theme =>
theme.tokens?.... }}) so spacing stays consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@console/workspaces/pages/eval/src/ViewMonitor.Component.tsx`:
- Around line 142-153: The historicalRangeLabel memo currently formats ISO
strings via new Date(iso).toLocaleDateString and can produce "Invalid Date" for
malformed input; update the inner formatter (fmt) used by historicalRangeLabel
to validate the Date: parse the iso, check isFinite(date.getTime()) (or
!isNaN(date.getTime())), and return the fallback "—" when the date is invalid or
iso is falsy; keep the same output shape `${fmt(monitorData?.traceStart)} –
${fmt(monitorData?.traceEnd)}` and only change the fmt implementation referenced
by historicalRangeLabel.

---

Nitpick comments:
In `@console/workspaces/pages/eval/src/ViewMonitor.Component.tsx`:
- Line 362: The component is using a hardcoded minWidth in the sx prop (sx={{
minWidth: 140 }}) which violates theme-token usage; replace the literal with a
theme spacing token (e.g., theme.spacing(...) or a named token like 'sizes.xs' /
'spacing.14' depending on your design system) accessed via the sx callback or
token key so it uses the app theme — locate the sx on ViewMonitor.Component (the
element with sx={{ minWidth: 140 }}) and change it to use the theme token
equivalent (sx={(theme) => ({ minWidth: theme.spacing(<n>) })} or sx={{
minWidth: theme => theme.tokens?.... }}) so spacing stays consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9bd66c3e-4d8b-4c89-9c47-8f9004c8c7b5

📥 Commits

Reviewing files that changed from the base of the PR and between 471990a and 221db6f.

📒 Files selected for processing (1)
  • console/workspaces/pages/eval/src/ViewMonitor.Component.tsx

@a5anka a5anka marked this pull request as draft March 5, 2026 06:51
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.

1 participant