Skip to content

Conversation

@Qxisylolo
Copy link
Contributor

Description

this pr simplifies threshold logic

Issues Resolved

Screenshot

Testing the changes

Changelog

  • feat: Simplify threshold logic

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@codecov
Copy link

codecov bot commented Nov 12, 2025

Codecov Report

❌ Patch coverage is 79.16667% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.76%. Comparing base (06a1ba8) to head (dc51eb1).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
.../components/visualizations/metric/to_expression.ts 16.66% 3 Missing and 2 partials ⚠️
...mponents/visualizations/bar_gauge/to_expression.ts 57.14% 0 Missing and 3 partials ⚠️
...onents/visualizations/bar_gauge/bar_gauge_utils.ts 97.05% 0 Missing and 1 partial ⚠️
...lizations/style_panel/threshold/threshold_utils.ts 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10909   +/-   ##
=======================================
  Coverage   60.75%   60.76%           
=======================================
  Files        4533     4533           
  Lines      122206   122229   +23     
  Branches    20481    20491   +10     
=======================================
+ Hits        74246    74267   +21     
- Misses      42719    42722    +3     
+ Partials     5241     5240    -1     
Flag Coverage Δ
Linux_1 26.57% <ø> (+<0.01%) ⬆️
Linux_2 38.92% <ø> (ø)
Linux_3 39.44% <ø> (+<0.01%) ⬆️
Linux_4 33.75% <79.16%> (+<0.01%) ⬆️
Windows_1 26.58% <ø> (+<0.01%) ⬆️
Windows_2 38.90% <ø> (ø)
Windows_3 39.45% <ø> (+<0.01%) ⬆️
Windows_4 33.75% <79.16%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

const newThreshold = threshold ?? [];

const newBaseColor = baseColor ?? getColors().statusGreen;
if (calculatedValue === undefined || calculatedValue < minBase) {
Copy link
Member

Choose a reason for hiding this comment

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

It seems we don't consider maxBase, I'm just thinking shall we also not consider minBase to make it consistent? so just make the text color solely based on thresholds.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, updated

result.unshift({ value: minBase, color: defaultColor });
}

const valueResults: Threshold[] = [];
Copy link
Member

Choose a reason for hiding this comment

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

I would create another function to calculate the valueResults separately

ruanyl
ruanyl previously approved these changes Nov 14, 2025
Signed-off-by: Qxisylolo <[email protected]>
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