fix(plugin-chart-table): allow numerical sorting on Time-series Table metrics#38828
fix(plugin-chart-table): allow numerical sorting on Time-series Table metrics#38828nireknj wants to merge 2 commits intoapache:masterfrom
Conversation
… metrics The 'Time-series Table' visualization was locked to sorting by the first column because react-table failed to resolve nested/dot-notation accessor keys for metric columns. This fix allows sorting by resolving cell values directly from row.original when the default lookup fails. - Update sortNumberWithMixedTypes to fallback to row.original - Update compareValues to handle string comparison for non-numeric data - Fix jest.config.js to support Windows-style paths for unit tests - Add regression tests for complex column identifiers Signed-off-by: Nirek Jaiswal , nirekjaiswal110106@gmail.com
Code Review Agent Run #2fa2d2Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Sequence DiagramThis PR fixes metric-column sorting by making the comparator read cell data from the original row when standard lookup fails, then applying numeric comparison with string fallback. As a result, clicking metric headers now correctly reorders rows for complex time-series column keys. sequenceDiagram participant User participant TimeSeriesTable participant ReactTable participant SortUtils User->>TimeSeriesTable: Click metric column header TimeSeriesTable->>ReactTable: Request sort for selected metric column ReactTable->>SortUtils: Compare rows for column alt Cell found in original row SortUtils->>SortUtils: Resolve cell from row original else Otherwise SortUtils->>SortUtils: Resolve cell from row values end SortUtils->>SortUtils: Compare as numbers with string fallback SortUtils-->>ReactTable: Return comparison result ReactTable-->>TimeSeriesTable: Render sorted rows Generated by CodeAnt AI |
User description
SUMMARY
The Time-series Table visualization was previously locked to sorting only by the first column (dimensions). Clicking on metric headers (time-series values) displayed a sort indicator but did not actually re-order the rows.
This was caused by a failure in
react-tablevalue resolution when using complex/nested accessor keys (e.g., date-prefixed metric keys). The custom sortNumberWithMixedTypes utility was returning0(equality) because it couldn't resolve the cell data from the standardrow.valueslookup.Changes introduced in this PR:
row.originalas a fallback. This reliably sidesteps nested dot-notation parsing issues in React Table.NaNvalues.TESTING INSTRUCTIONS
npm run test -- src/visualizations/TimeTable/utils/sortUtils/ADDITIONAL INFORMATION
Signed-off-by: Nirek Jaiswal nirekjaiswal110106@gmail.com
CodeAnt-AI Description
Allow Time-series Table to sort metric columns correctly
What Changed
Impact
✅ Correct metric sorting in time-series tables✅ Clearer row ordering for text and mixed-value columns✅ Fewer sorting regressions in table charts💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.