浏览代码

Add support for adding param rule / authority rule in resource page of dashboard

- Decouple rule checking from controller (now in service)

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
master
Eric Zhao 6 年前
父节点
当前提交
eace8ab2ff
共有 14 个文件被更改,包括 363 次插入150 次删除
  1. +1
    -1
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/datasource/entity/rule/ParamFlowRuleEntity.java
  2. +1
    -1
      sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/ParamFlowRuleController.java
  3. +2
    -18
      sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/authority.js
  4. +1
    -26
      sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/degrade.js
  5. +1
    -43
      sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/flow.js
  6. +192
    -16
      sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/identity.js
  7. +7
    -36
      sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/param_flow.js
  8. +16
    -0
      sentinel-dashboard/src/main/webapp/resources/app/scripts/services/authority_service.js
  9. +25
    -0
      sentinel-dashboard/src/main/webapp/resources/app/scripts/services/degradeservice.js
  10. +42
    -0
      sentinel-dashboard/src/main/webapp/resources/app/scripts/services/flowservice.js
  11. +62
    -0
      sentinel-dashboard/src/main/webapp/resources/app/scripts/services/param_flow_service.js
  12. +1
    -1
      sentinel-dashboard/src/main/webapp/resources/app/views/dialog/param-flow-rule-dialog.html
  13. +11
    -7
      sentinel-dashboard/src/main/webapp/resources/app/views/identity.html
  14. +1
    -1
      sentinel-dashboard/src/main/webapp/resources/dist/js/app.js

+ 1
- 1
sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/datasource/entity/rule/ParamFlowRuleEntity.java 查看文件

@@ -55,7 +55,7 @@ public class ParamFlowRuleEntity extends AbstractRuleEntity<ParamFlowRule> {
}

@JsonIgnore
public int getBlockGrade() {
public int getGrade() {
return rule.getGrade();
}



+ 1
- 1
sentinel-dashboard/src/main/java/com/taobao/csp/sentinel/dashboard/view/ParamFlowRuleController.java 查看文件

@@ -165,7 +165,7 @@ public class ParamFlowRuleController {
if (entity.getCount() < 0) {
return Result.ofFail(-1, "count should be valid");
}
if (entity.getBlockGrade() != RuleConstant.FLOW_GRADE_QPS) {
if (entity.getGrade() != RuleConstant.FLOW_GRADE_QPS) {
return Result.ofFail(-1, "Unknown mode (blockGrade) for parameter flow control");
}
if (entity.getParamIdx() == null || entity.getParamIdx() < 0) {


+ 2
- 18
sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/authority.js 查看文件

@@ -94,24 +94,8 @@ angular.module('sentinelDashboardApp').controller('AuthorityRuleController', ['$
});
};

function checkRuleValid(rule) {
if (rule.resource === undefined || rule.resource === '') {
alert('资源名称不能为空');
return false;
}
if (rule.limitApp === undefined || rule.limitApp === '') {
alert('流控针对应用不能为空');
return false;
}
if (rule.strategy === undefined) {
alert('必须选择黑白名单模式');
return false;
}
return true;
}

$scope.saveRule = function () {
if (!checkRuleValid($scope.currentRule.rule)) {
if (!AuthorityRuleService.checkRuleValid($scope.currentRule.rule)) {
return;
}
if ($scope.authorityRuleDialog.type === 'add') {
@@ -136,7 +120,7 @@ angular.module('sentinelDashboardApp').controller('AuthorityRuleController', ['$
alert("添加规则失败:未知错误");
}
});
};
}

function saveRuleAndPush(rule, edit) {
AuthorityRuleService.saveRule(rule).success(function (data) {


+ 1
- 26
sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/degrade.js 查看文件

@@ -81,33 +81,8 @@ app.controller('DegradeCtl', ['$scope', '$stateParams', 'DegradeService', 'ngDia
});
};

function checkRuleValid(rule) {
if (rule.resource === undefined || rule.resource === '') {
alert('资源名称不能为空');
return false;
}
if (rule.grade === undefined || rule.grade < 0) {
alert('未知的降级类型');
return false;
}
if (rule.count === undefined || rule.count === '' || rule.count < 0) {
alert('降级阈值不能为空或小于 0');
return false;
}
if (rule.timeWindow === undefined || rule.timeWindow === '' || rule.timeWindow <= 0) {
alert('降级时间窗口必须大于 0');
return false;
}
// 异常比率类型.
if (rule.grade == 1 && rule.count > 1) {
alert('异常比率超出范围:[0.0 - 1.0]');
return false;
}
return true;
}

$scope.saveRule = function () {
if (!checkRuleValid($scope.currentRule)) {
if (!DegradeService.checkRuleValid($scope.currentRule)) {
return;
}
if ($scope.degradeRuleDialog.type === 'add') {


+ 1
- 43
sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/flow.js 查看文件

@@ -88,50 +88,8 @@ app.controller('FlowCtl', ['$scope', '$stateParams', 'FlowService', 'ngDialog',
});
};

function notNumberAtLeastZero(num) {
return num === undefined || num === '' || isNaN(num) || num < 0;
}

function notNumberGreaterThanZero(num) {
return num === undefined || num === '' || isNaN(num) || num <= 0;
}

function checkRuleValid(rule) {
if (rule.resource === undefined || rule.resource === '') {
alert('资源名称不能为空');
return false;
}
if (rule.count === undefined || rule.count < 0) {
alert('限流阈值必须大于等于 0');
return false;
}
if (rule.strategy === undefined || rule.strategy < 0) {
alert('无效的流控模式');
return false;
}
if (rule.strategy == 1 || rule.strategy == 2) {
if (rule.refResource === undefined || rule.refResource === '') {
alert('请填写关联资源或入口');
return false;
}
}
if (rule.controlBehavior === undefined || rule.controlBehavior < 0) {
alert('无效的流控整形方式');
return false;
}
if (rule.controlBehavior == 1 && notNumberGreaterThanZero(rule.warmUpPeriodSec)) {
alert('预热时长必须大于 0');
return false;
}
if (rule.controlBehavior == 2 && notNumberGreaterThanZero(rule.maxQueueingTimeMs)) {
alert('排队超时时间必须大于 0');
return false;
}
return true;
}

$scope.saveRule = function () {
if (!checkRuleValid($scope.currentRule)) {
if (!FlowService.checkRuleValid($scope.currentRule)) {
return;
}
if ($scope.flowRuleDialog.type === 'add') {


+ 192
- 16
sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/identity.js 查看文件

@@ -1,18 +1,13 @@
var app = angular.module('sentinelDashboardApp');

app.controller('IdentityCtl', ['$scope', '$stateParams', 'IdentityService',
'ngDialog', 'FlowService', 'DegradeService', 'MachineService',
'ngDialog', 'FlowService', 'DegradeService', 'AuthorityRuleService', 'ParamFlowService', 'MachineService',
'$interval', '$location', '$timeout',
function ($scope, $stateParams, IdentityService, ngDialog,
FlowService, DegradeService, MachineService, $interval, $location, $timeout) {
FlowService, DegradeService, AuthorityRuleService, ParamFlowService, MachineService, $interval, $location, $timeout) {

$scope.app = $stateParams.app;
// $scope.rulesPageConfig = {
// pageSize : 10,
// currentPageIndex : 1,
// totalPage : 1,
// totalCount: 0,
// };

$scope.currentPage = 1;
$scope.pageSize = 16;
$scope.totalPage = 1;
@@ -90,10 +85,13 @@ app.controller('IdentityCtl', ['$scope', '$stateParams', 'IdentityService',
};

function saveFlowRule() {
if (!FlowService.checkRuleValid(flowRuleDialogScope.currentRule)) {
return;
}
FlowService.newRule(flowRuleDialogScope.currentRule).success(function (data) {
if (data.code == 0) {
flowRuleDialog.close();
var url = '/dashboard/flow/' + $scope.app;
let url = '/dashboard/flow/' + $scope.app;
$location.path(url);
} else {
alert('失败!');
@@ -102,6 +100,9 @@ app.controller('IdentityCtl', ['$scope', '$stateParams', 'IdentityService',
}

function saveFlowRuleAndContinue() {
if (!FlowService.checkRuleValid(flowRuleDialogScope.currentRule)) {
return;
}
FlowService.newRule(flowRuleDialogScope.currentRule).success(function (data) {
if (data.code == 0) {
flowRuleDialog.close();
@@ -148,6 +149,9 @@ app.controller('IdentityCtl', ['$scope', '$stateParams', 'IdentityService',
};

function saveDegradeRule() {
if (!DegradeService.checkRuleValid(degradeRuleDialogScope.currentRule)) {
return;
}
DegradeService.newRule(degradeRuleDialogScope.currentRule).success(function (data) {
if (data.code == 0) {
degradeRuleDialog.close();
@@ -160,6 +164,9 @@ app.controller('IdentityCtl', ['$scope', '$stateParams', 'IdentityService',
}

function saveDegradeRuleAndContinue() {
if (!DegradeService.checkRuleValid(degradeRuleDialogScope.currentRule)) {
return;
}
DegradeService.newRule(degradeRuleDialogScope.currentRule).success(function (data) {
if (data.code == 0) {
degradeRuleDialog.close();
@@ -169,9 +176,176 @@ app.controller('IdentityCtl', ['$scope', '$stateParams', 'IdentityService',
});
}

let authorityRuleDialog;
let authorityRuleDialogScope;

function saveAuthorityRule() {
let ruleEntity = authorityRuleDialogScope.currentRule;
if (!AuthorityRuleService.checkRuleValid(ruleEntity.rule)) {
return;
}
AuthorityRuleService.addNewRule(ruleEntity).success((data) => {
if (data.success) {
authorityRuleDialog.close();
let url = '/dashboard/authority/' + $scope.app;
$location.path(url);
} else {
alert('添加规则失败:' + data.msg);
}
}).error((data) => {
if (data) {
alert('添加规则失败:' + data.msg);
} else {
alert("添加规则失败:未知错误");
}
});
}

function saveAuthorityRuleAndContinue() {
let ruleEntity = authorityRuleDialogScope.currentRule;
if (!AuthorityRuleService.checkRuleValid(ruleEntity.rule)) {
return;
}
AuthorityRuleService.addNewRule(ruleEntity).success((data) => {
if (data.success) {
authorityRuleDialog.close();
} else {
alert('添加规则失败:' + data.msg);
}
}).error((data) => {
if (data) {
alert('添加规则失败:' + data.msg);
} else {
alert("添加规则失败:未知错误");
}
});
}

$scope.addNewAuthorityRule = function (resource) {
if (!$scope.macInputModel) {
return;
}
let mac = $scope.macInputModel.split(':');
authorityRuleDialogScope = $scope.$new(true);
authorityRuleDialogScope.currentRule = {
app: $scope.app,
ip: mac[0],
port: mac[1],
rule: {
resource: resource,
strategy: 0,
limitApp: '',
}
};

authorityRuleDialogScope.authorityRuleDialog = {
title: '新增授权规则',
type: 'add',
confirmBtnText: '新增',
saveAndContinueBtnText: '新增并继续添加'
};
authorityRuleDialogScope.saveRule = saveAuthorityRule;
authorityRuleDialogScope.saveRuleAndContinue = saveAuthorityRuleAndContinue;

authorityRuleDialog = ngDialog.open({
template: '/app/views/dialog/authority-rule-dialog.html',
width: 680,
overlay: true,
scope: authorityRuleDialogScope
});
};

let paramFlowRuleDialog;
let paramFlowRuleDialogScope;

function saveParamFlowRule() {
let ruleEntity = paramFlowRuleDialogScope.currentRule;
if (!ParamFlowService.checkRuleValid(ruleEntity.rule)) {
return;
}
ParamFlowService.addNewRule(ruleEntity).success((data) => {
if (data.success) {
paramFlowRuleDialog.close();
let url = '/dashboard/paramFlow/' + $scope.app;
$location.path(url);
} else {
alert('添加热点规则失败:' + data.msg);
}
}).error((data) => {
if (data) {
alert('添加热点规则失败:' + data.msg);
} else {
alert("添加热点规则失败:未知错误");
}
});
}

function saveParamFlowRuleAndContinue() {
let ruleEntity = paramFlowRuleDialogScope.currentRule;
if (!ParamFlowService.checkRuleValid(ruleEntity.rule)) {
return;
}
ParamFlowService.addNewRule(ruleEntity).success((data) => {
if (data.success) {
paramFlowRuleDialog.close();
} else {
alert('添加热点规则失败:' + data.msg);
}
}).error((data) => {
if (data) {
alert('添加热点规则失败:' + data.msg);
} else {
alert("添加热点规则失败:未知错误");
}
});
}

$scope.addNewParamFlowRule = function (resource) {
if (!$scope.macInputModel) {
return;
}
let mac = $scope.macInputModel.split(':');
paramFlowRuleDialogScope = $scope.$new(true);
paramFlowRuleDialogScope.currentRule = {
app: $scope.app,
ip: mac[0],
port: mac[1],
rule: {
resource: resource,
grade: 1,
paramFlowItemList: [],
count: 0,
limitApp: 'default',
}
};

paramFlowRuleDialogScope.paramFlowRuleDialog = {
title: '新增热点规则',
type: 'add',
confirmBtnText: '新增',
saveAndContinueBtnText: '新增并继续添加',
supportAdvanced: false,
showAdvanceButton: true
};
paramFlowRuleDialogScope.saveRule = saveParamFlowRule;
paramFlowRuleDialogScope.saveRuleAndContinue = saveParamFlowRuleAndContinue;
// paramFlowRuleDialogScope.onOpenAdvanceClick = function () {
// paramFlowRuleDialogScope.paramFlowRuleDialog.showAdvanceButton = false;
// };
// paramFlowRuleDialogScope.onCloseAdvanceClick = function () {
// paramFlowRuleDialogScope.paramFlowRuleDialog.showAdvanceButton = true;
// };

paramFlowRuleDialog = ngDialog.open({
template: '/app/views/dialog/param-flow-rule-dialog.html',
width: 680,
overlay: true,
scope: paramFlowRuleDialogScope
});
};

var searchHandler;
$scope.searchChange = function (searchKey) {
// console.info('searchKey=', searchKey);
$timeout.cancel(searchHandler);
searchHandler = $timeout(function () {
$scope.searchKey = searchKey;
@@ -180,14 +354,14 @@ app.controller('IdentityCtl', ['$scope', '$stateParams', 'IdentityService',
reInitIdentityDatas();
$scope.firstExpandAll = false;
}, 600);
}
};

$scope.initTreeTable = function () {
// if (!$scope.table) {
com_github_culmat_jsTreeTable.register(window);
$scope.table = window.treeTable($('#identities'));
// }
}
};

$scope.expandAll = function () {
$scope.isExpand = true;
@@ -198,13 +372,12 @@ app.controller('IdentityCtl', ['$scope', '$stateParams', 'IdentityService',
$scope.treeView = function () {
$scope.isTreeView = true;
queryIdentities();
}
};
$scope.listView = function () {
$scope.isTreeView = false;
queryIdentities();
}
};

queryAppMachines();
function queryAppMachines() {
MachineService.getAppMachines($scope.app).success(
function (data) {
@@ -230,7 +403,10 @@ app.controller('IdentityCtl', ['$scope', '$stateParams', 'IdentityService',
}
}
);
};
}

// Fetch all machines by current app name.
queryAppMachines();

$scope.$watch('macInputModel', function () {
if ($scope.macInputModel) {


+ 7
- 36
sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/param_flow.js 查看文件

@@ -122,7 +122,7 @@ angular.module('sentinelDashboardApp').controller('ParamFlowController', ['$scop
.error((data, header, config, status) => {
$scope.loadError = {message: "未知错误"}
});
};
}
$scope.getMachineRules = getMachineRules;
getMachineRules();

@@ -134,6 +134,7 @@ angular.module('sentinelDashboardApp').controller('ParamFlowController', ['$scop
title: '编辑热点规则',
type: 'edit',
confirmBtnText: '保存',
supportAdvanced: true,
showAdvanceButton: rule.rule.paramFlowItemList === undefined || rule.rule.paramFlowItemList.length <= 0
};
paramFlowRuleDialog = ngDialog.open({
@@ -152,7 +153,7 @@ angular.module('sentinelDashboardApp').controller('ParamFlowController', ['$scop
ip: mac[0],
port: mac[1],
rule: {
blockGrade: 1,
grade: 1,
paramFlowItemList: [],
count: 0,
limitApp: 'default',
@@ -180,38 +181,8 @@ angular.module('sentinelDashboardApp').controller('ParamFlowController', ['$scop
$scope.paramFlowRuleDialog.showAdvanceButton = true;
};

function checkRuleValid(rule) {
if (!rule.resource || rule.resource === '') {
alert('资源名称不能为空');
return false;
}
if (rule.blockGrade !== 1) {
alert('未知的限流模式');
return false;
}
if (rule.count < 0) {
alert('限流阈值必须大于等于 0');
return false;
}
if (rule.paramIdx === undefined || rule.paramIdx === '' || isNaN(rule.paramIdx) || rule.paramIdx < 0) {
alert('热点参数索引必须大于等于 0');
return false;
}
if (rule.paramFlowItemList !== undefined) {
for (let i = 0; i < rule.paramFlowItemList.length; i++) {
let item = rule.paramFlowItemList[i];
if ($scope.notValidParamItem(item)) {
alert('热点参数例外项不合法,请检查值和类型是否正确:参数为 ' + item.object + ', 类型为 ' +
item.classType + ', 限流阈值为 ' + item.count);
return false;
}
}
}
return true;
}

$scope.saveRule = function () {
if (!checkRuleValid($scope.currentRule.rule)) {
if (!ParamFlowService.checkRuleValid($scope.currentRule.rule)) {
return;
}
if ($scope.paramFlowRuleDialog.type === 'add') {
@@ -236,7 +207,7 @@ angular.module('sentinelDashboardApp').controller('ParamFlowController', ['$scop
alert("添加规则失败:未知错误");
}
});
};
}

function saveRuleAndPush(rule, edit) {
ParamFlowService.saveRule(rule).success(function (data) {
@@ -290,7 +261,7 @@ angular.module('sentinelDashboardApp').controller('ParamFlowController', ['$scop
type: 'delete_rule',
attentionTitle: '请确认是否删除如下热点参数限流规则',
attention: '资源名: ' + ruleEntity.rule.resource + ', 热点参数索引: ' + ruleEntity.rule.paramIdx +
', 限流模式: ' + (ruleEntity.rule.blockGrade === 1 ? 'QPS' : '未知') + ', 限流阈值: ' + ruleEntity.rule.count,
', 限流模式: ' + (ruleEntity.rule.grade === 1 ? 'QPS' : '未知') + ', 限流阈值: ' + ruleEntity.rule.count,
confirmBtnText: '删除',
};
confirmDialog = ngDialog.open({
@@ -301,7 +272,7 @@ angular.module('sentinelDashboardApp').controller('ParamFlowController', ['$scop
};

$scope.confirm = function () {
if ($scope.confirmDialog.type == 'delete_rule') {
if ($scope.confirmDialog.type === 'delete_rule') {
deleteRuleAndPush($scope.currentRule);
} else {
console.error('error');


+ 16
- 0
sentinel-dashboard/src/main/webapp/resources/app/scripts/services/authority_service.js 查看文件

@@ -37,4 +37,20 @@ angular.module('sentinelDashboardApp').service('AuthorityRuleService', ['$http',
method: 'DELETE'
});
};

this.checkRuleValid = function checkRuleValid(rule) {
if (rule.resource === undefined || rule.resource === '') {
alert('资源名称不能为空');
return false;
}
if (rule.limitApp === undefined || rule.limitApp === '') {
alert('流控针对应用不能为空');
return false;
}
if (rule.strategy === undefined) {
alert('必须选择黑白名单模式');
return false;
}
return true;
};
}]);

+ 25
- 0
sentinel-dashboard/src/main/webapp/resources/app/scripts/services/degradeservice.js 查看文件

@@ -60,4 +60,29 @@ app.service('DegradeService', ['$http', function ($http) {
method: 'GET'
});
};

this.checkRuleValid = function (rule) {
if (rule.resource === undefined || rule.resource === '') {
alert('资源名称不能为空');
return false;
}
if (rule.grade === undefined || rule.grade < 0) {
alert('未知的降级类型');
return false;
}
if (rule.count === undefined || rule.count === '' || rule.count < 0) {
alert('降级阈值不能为空或小于 0');
return false;
}
if (rule.timeWindow === undefined || rule.timeWindow === '' || rule.timeWindow <= 0) {
alert('降级时间窗口必须大于 0');
return false;
}
// 异常比率类型.
if (rule.grade == 1 && rule.count > 1) {
alert('异常比率超出范围:[0.0 - 1.0]');
return false;
}
return true;
};
}]);

+ 42
- 0
sentinel-dashboard/src/main/webapp/resources/app/scripts/services/flowservice.js 查看文件

@@ -70,4 +70,46 @@ app.service('FlowService', ['$http', function ($http) {
method: 'GET'
});
};

function notNumberAtLeastZero(num) {
return num === undefined || num === '' || isNaN(num) || num < 0;
}

function notNumberGreaterThanZero(num) {
return num === undefined || num === '' || isNaN(num) || num <= 0;
}

this.checkRuleValid = function (rule) {
if (rule.resource === undefined || rule.resource === '') {
alert('资源名称不能为空');
return false;
}
if (rule.count === undefined || rule.count < 0) {
alert('限流阈值必须大于等于 0');
return false;
}
if (rule.strategy === undefined || rule.strategy < 0) {
alert('无效的流控模式');
return false;
}
if (rule.strategy == 1 || rule.strategy == 2) {
if (rule.refResource === undefined || rule.refResource == '') {
alert('请填写关联资源或入口');
return false;
}
}
if (rule.controlBehavior === undefined || rule.controlBehavior < 0) {
alert('无效的流控整形方式');
return false;
}
if (rule.controlBehavior == 1 && notNumberGreaterThanZero(rule.warmUpPeriodSec)) {
alert('预热时长必须大于 0');
return false;
}
if (rule.controlBehavior == 2 && notNumberGreaterThanZero(rule.maxQueueingTimeMs)) {
alert('排队超时时间必须大于 0');
return false;
}
return true;
};
}]);

+ 62
- 0
sentinel-dashboard/src/main/webapp/resources/app/scripts/services/param_flow_service.js 查看文件

@@ -39,4 +39,66 @@ angular.module('sentinelDashboardApp').service('ParamFlowService', ['$http', fun
method: 'DELETE'
});
};

function isNumberClass(classType) {
return classType === 'int' || classType === 'double' ||
classType === 'float' || classType === 'long' || classType === 'short';
}

function isByteClass(classType) {
return classType === 'byte';
}

function notNumberAtLeastZero(num) {
return num === undefined || num === '' || isNaN(num) || num < 0;
}

function notGoodNumber(num) {
return num === undefined || num === '' || isNaN(num);
}

function notGoodNumberBetweenExclusive(num, l ,r) {
return num === undefined || num === '' || isNaN(num) || num < l || num > r;
}

function notValidParamItem(curExItem) {
if (isNumberClass(curExItem.classType) && notGoodNumber(curExItem.object)) {
return true;
}
if (isByteClass(curExItem.classType) && notGoodNumberBetweenExclusive(curExItem.object, -128, 127)) {
return true;
}
return curExItem.object === undefined || curExItem.classType === undefined ||
notNumberAtLeastZero(curExItem.count);
}

this.checkRuleValid = function (rule) {
if (!rule.resource || rule.resource === '') {
alert('资源名称不能为空');
return false;
}
if (rule.grade != 1) {
alert('未知的限流模式');
return false;
}
if (rule.count < 0) {
alert('限流阈值必须大于等于 0');
return false;
}
if (rule.paramIdx === undefined || rule.paramIdx === '' || isNaN(rule.paramIdx) || rule.paramIdx < 0) {
alert('热点参数索引必须大于等于 0');
return false;
}
if (rule.paramFlowItemList !== undefined) {
for (var i = 0; i < rule.paramFlowItemList.length; i++) {
var item = rule.paramFlowItemList[i];
if (notValidParamItem(item)) {
alert('热点参数例外项不合法,请检查值和类型是否正确:参数为 ' + item.object + ', 类型为 ' +
item.classType + ', 限流阈值为 ' + item.count);
return false;
}
}
}
return true;
};
}]);

+ 1
- 1
sentinel-dashboard/src/main/webapp/resources/app/views/dialog/param-flow-rule-dialog.html 查看文件

@@ -101,7 +101,7 @@
</div>

<!-- exclusion item part end -->
<div class="form-group text-center">
<div class="form-group text-center" ng-if="paramFlowRuleDialog.supportAdvanced">
<a ng-click="onOpenAdvanceClick()" ng-if="paramFlowRuleDialog.showAdvanceButton">高级选项</a>
<a ng-click="onCloseAdvanceClick()" ng-if="!paramFlowRuleDialog.showAdvanceButton">关闭高级选项</a>
</div>


+ 11
- 7
sentinel-dashboard/src/main/webapp/resources/app/views/identity.html 查看文件

@@ -41,13 +41,13 @@
<td style="width: 40%;">
资源名
</td>
<td style="width: 8%;">通过QPS</td>
<td style="width: 8%;">拒绝QPS</td>
<td style="width: 8%;">线程数</td>
<td style="width: 8%;">平均RT</td>
<td style="width: 8%;">分钟通过</td>
<td style="width: 8%;">分钟拒绝</td>
<td style="width: 12%">操作</td>
<td style="width: 7%;">通过QPS</td>
<td style="width: 7%;">拒绝QPS</td>
<td style="width: 5%;">线程数</td>
<td style="width: 6%;">平均RT</td>
<td style="width: 6%;">分钟通过</td>
<td style="width: 6%;">分钟拒绝</td>
<td style="width: 23%">操作</td>
</tr>
<tr></tr>
</thead>
@@ -74,6 +74,10 @@
<i class="fa fa-plus"></i>&nbsp;流控</button>
<button class="btn btn-xs btn-default" type="button" ng-click="addNewDegradeRule(resource.resource)" style="font-size: 12px; height:25px;">
<i class="fa fa-plus"></i>&nbsp;降级</button>
<button class="btn btn-xs btn-default" type="button" ng-click="addNewParamFlowRule(resource.resource)" style="font-size: 12px; height:25px;">
<i class="fa fa-plus"></i>&nbsp;热点</button>
<button class="btn btn-xs btn-default" type="button" ng-click="addNewAuthorityRule(resource.resource)" style="font-size: 12px; height:25px;">
<i class="fa fa-plus"></i>&nbsp;授权</button>
</div>
</td>
</tr>


+ 1
- 1
sentinel-dashboard/src/main/webapp/resources/dist/js/app.js
文件差异内容过多而无法显示
查看文件


正在加载...
取消
保存