fix(dashboard): reset field values when switching circuit breaker strategy#3605
Open
daguimu wants to merge 1 commit intoalibaba:masterfrom
Open
fix(dashboard): reset field values when switching circuit breaker strategy#3605daguimu wants to merge 1 commit intoalibaba:masterfrom
daguimu wants to merge 1 commit intoalibaba:masterfrom
Conversation
…ategy When switching between circuit breaker strategies (slow call ratio / exception ratio / exception count) in the degrade rule dialog, the count and slowRatioThreshold fields were not reset. This caused the previous strategy's value (e.g., RT=1000) to remain in the input field when switching to a different strategy (e.g., exception ratio where the valid range is [0.0, 1.0]). Add ng-change handler on the strategy radio buttons to clear both count and slowRatioThreshold when the user switches strategies. Fixes alibaba#3582
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When editing or adding a circuit breaker (degrade) rule in the Sentinel dashboard, switching between strategies (slow call ratio / exception ratio / exception count) does not reset the threshold input field. For example, after setting max RT to 1000ms for slow call ratio strategy, switching to exception ratio still shows 1000 in the ratio threshold field, which is invalid since the valid range is [0.0, 1.0].
Root Cause
All three circuit breaker strategies share the same
currentRule.countmodel in the dialog template. When the user switches the strategy via radio buttons, thecountvalue is not cleared, causing the previous strategy's value to persist in the input field.Fix
onGradeChange()handler inDegradeCtlcontroller that resetscurrentRule.countandcurrentRule.slowRatioThresholdtoundefinedwhen the strategy changes.ng-change="onGradeChange()"to all three strategy radio buttons indegrade-rule-dialog.html.ng-changedirective only fires on user interaction, so existing values are preserved when editing a rule (no reset on initial dialog load).Tests
The dashboard frontend has no test infrastructure (
"test": "echo no test case"in package.json). Manual verification steps:Impact
Only affects the circuit breaker rule dialog UI in the dashboard. No backend or core logic changes.
Fixes #3582