From 42e5e60eb62e7392d48c6446fba53c8188c2ae09 Mon Sep 17 00:00:00 2001 From: daguimu Date: Wed, 25 Mar 2026 23:34:47 +0800 Subject: [PATCH] fix(dashboard): reset field values when switching circuit breaker strategy 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 #3582 --- .../webapp/resources/app/scripts/controllers/degrade.js | 5 +++++ .../resources/app/views/dialog/degrade-rule-dialog.html | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/degrade.js b/sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/degrade.js index 204c5c01a6..7e9beac5f3 100755 --- a/sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/degrade.js +++ b/sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/degrade.js @@ -83,6 +83,11 @@ app.controller('DegradeCtl', ['$scope', '$stateParams', 'DegradeService', 'ngDia }); }; + $scope.onGradeChange = function () { + $scope.currentRule.count = undefined; + $scope.currentRule.slowRatioThreshold = undefined; + }; + $scope.saveRule = function () { if (!DegradeService.checkRuleValid($scope.currentRule)) { return; diff --git a/sentinel-dashboard/src/main/webapp/resources/app/views/dialog/degrade-rule-dialog.html b/sentinel-dashboard/src/main/webapp/resources/app/views/dialog/degrade-rule-dialog.html index a013762e9e..f9154f7b3d 100755 --- a/sentinel-dashboard/src/main/webapp/resources/app/views/dialog/degrade-rule-dialog.html +++ b/sentinel-dashboard/src/main/webapp/resources/app/views/dialog/degrade-rule-dialog.html @@ -32,9 +32,9 @@
-  慢调用比例   -  异常比例   -  异常数 +  慢调用比例   +  异常比例   +  异常数