Skip to content

Commit

Permalink
dashboard: make fallbackToLocalWhenFail be configurable in dashboard …
Browse files Browse the repository at this point in the history
…and fix edit rule issue when cancel (alibaba#370)

- Make fallbackToLocalWhenFail of cluster rules configurable in dashboard
- Fix edit rule when hit cancel button (object share problem solved by deep copy)
- Add metric table td header's title for friendly prompt info
  • Loading branch information
cdfive authored and sczyh30 committed Jan 7, 2019
1 parent c06aa6e commit 5a69114
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ angular.module('sentinelDashboardApp').controller('AuthorityRuleController', ['$
var authorityRuleDialog;

$scope.editRule = function (rule) {
$scope.currentRule = rule;
$scope.currentRule = angular.copy(rule);
$scope.authorityRuleDialog = {
title: '编辑授权规则',
type: 'edit',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ app.controller('DegradeCtl', ['$scope', '$stateParams', 'DegradeService', 'ngDia

var degradeRuleDialog;
$scope.editRule = function (rule) {
$scope.currentRule = rule;
$scope.currentRule = angular.copy(rule);
$scope.degradeRuleDialog = {
title: '编辑降级规则',
type: 'edit',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ app.controller('FlowControllerV1', ['$scope', '$stateParams', 'FlowServiceV1', '

var flowRuleDialog;
$scope.editRule = function (rule) {
$scope.currentRule = rule;
$scope.currentRule = angular.copy(rule);
$scope.flowRuleDialog = {
title: '编辑流控规则',
type: 'edit',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ app.controller('FlowControllerV2', ['$scope', '$stateParams', 'FlowServiceV2', '

var flowRuleDialog;
$scope.editRule = function (rule) {
$scope.currentRule = rule;
$scope.currentRule = angular.copy(rule);
$scope.flowRuleDialog = {
title: '编辑流控规则',
type: 'edit',
Expand All @@ -88,7 +88,8 @@ app.controller('FlowControllerV2', ['$scope', '$stateParams', 'FlowServiceV2', '
limitApp: 'default',
clusterMode: false,
clusterConfig: {
thresholdType: 0
thresholdType: 0,
fallbackToLocalWhenFail: true
}
};
$scope.flowRuleDialog = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ angular.module('sentinelDashboardApp').controller('ParamFlowController', ['$scop
var paramFlowRuleDialog;

$scope.editRule = function (rule) {
$scope.currentRule = rule;
$scope.currentRule = angular.copy(rule);
$scope.paramFlowRuleDialog = {
title: '编辑热点规则',
type: 'edit',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ app.controller('SystemCtl', ['$scope', '$stateParams', 'SystemService', 'ngDialo
$scope.getMachineRules = getMachineRules;
var systemRuleDialog;
$scope.editRule = function (rule) {
$scope.currentRule = rule;
$scope.currentRule = angular.copy(rule);
$scope.systemRuleDialog = {
title: '编辑系统保护规则',
type: 'edit',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
<div class="form-group">
<label class="col-sm-2 control-label">是否集群</label>
<div class="col-sm-2">
<label class="checkbox-inline">
<input type="checkbox" name="clusterMode" ng-model="currentRule.clusterMode">
</label>
</div>
<div ng-if="currentRule.clusterMode">
<label class="col-sm-3 control-label">集群阈值模式</label>
Expand All @@ -66,6 +68,16 @@
</div>
</div>

<div class="form-group" ng-if="currentRule.clusterMode">
<label class="col-sm-2 control-label">失败退化</label>
<div class="col-sm-8">
<label class="checkbox-inline">
<input type="checkbox" name="clusterMode" ng-model="currentRule.clusterConfig.fallbackToLocalWhenFail">
<i class="glyphicon glyphicon-info-sign"></i>如果集群限流失败是否退化到单机限流
</label>
</div>
</div>

<div ng-if="!flowRuleDialog.showAdvanceButton">
<div class="form-group">
<label class="col-sm-2 control-label" title="调用关系流控模式">流控模式</label>
Expand Down Expand Up @@ -133,4 +145,4 @@
</div>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
<thead>
<tr style="font-size: 13px;text-align:center;font-weight: bold;">
<td style="word-wrap:break-word;word-break:break-all;">时间</td>
<td style="word-wrap:break-word;word-break:break-all;">p_qps</td>
<td style="word-wrap:break-word;word-break:break-all;">b_qps</td>
<td style="word-wrap:break-word;word-break:break-all;">rt(ms)</td>
<td style="word-wrap:break-word;word-break:break-all;" title="passQps: 通过的qps">p_qps</td>
<td style="word-wrap:break-word;word-break:break-all;" title="blockQps: 拦截的qps">b_qps</td>
<td style="word-wrap:break-word;word-break:break-all;" title="responseTime: 响应时间(毫秒)">rt(ms)</td>
</tr>
</thead>
<!-- thead -->
Expand Down

0 comments on commit 5a69114

Please sign in to comment.