From 4a9543fd1f05674c86ab67c2939cb6e8bdccbfa0 Mon Sep 17 00:00:00 2001 From: Eric Zhao Date: Wed, 10 Jul 2019 10:14:11 +0800 Subject: [PATCH] dashboard: improvements for gateway flow control pages Signed-off-by: Eric Zhao --- .../app/scripts/controllers/gateway/api.js | 8 +++---- .../scripts/directives/sidebar/sidebar.html | 20 ++++++++-------- .../app/scripts/directives/sidebar/sidebar.js | 23 ++++++++----------- .../app/views/dialog/gateway/api-dialog.html | 7 +++--- .../dialog/gateway/flow-rule-dialog.html | 22 +++++++++--------- .../resources/app/views/gateway/api.html | 12 +++++----- .../resources/app/views/gateway/flow.html | 14 +++++------ .../resources/app/views/gateway/identity.html | 16 ++++++------- 8 files changed, 60 insertions(+), 62 deletions(-) diff --git a/sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/gateway/api.js b/sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/gateway/api.js index 8e66b113..ccf2497c 100644 --- a/sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/gateway/api.js +++ b/sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/gateway/api.js @@ -72,13 +72,13 @@ app.controller('GatewayApiCtl', ['$scope', '$stateParams', 'GatewayApiService', $scope.editApi = function (api) { $scope.currentApi = angular.copy(api); $scope.gatewayApiDialog = { - title: '编辑自定义API', + title: '编辑自定义 API', type: 'edit', confirmBtnText: '保存' }; gatewayApiDialog = ngDialog.open({ template: '/app/views/dialog/gateway/api-dialog.html', - width: 840, + width: 900, overlay: true, scope: $scope }); @@ -94,13 +94,13 @@ app.controller('GatewayApiCtl', ['$scope', '$stateParams', 'GatewayApiService', predicateItems: [{matchStrategy: 0, pattern: ''}] }; $scope.gatewayApiDialog = { - title: '新增自定义API', + title: '新增自定义 API', type: 'add', confirmBtnText: '新增' }; gatewayApiDialog = ngDialog.open({ template: '/app/views/dialog/gateway/api-dialog.html', - width: 840, + width: 900, overlay: true, scope: $scope }); diff --git a/sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.html b/sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.html index 623e889a..a7212629 100755 --- a/sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.html +++ b/sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.html @@ -19,7 +19,7 @@  {{entry.app}} - ({{entry.heathyCount}}/{{entry.machines.length}}) + ({{entry.healthyCount}}/{{entry.machines.length}}) @@ -29,12 +29,12 @@   实时监控 -
  • +
  •   簇点链路
  • -
  • +
  •   请求链路
  • @@ -44,16 +44,16 @@ -
  • +
  • -    API管理 +    API 管理
  • -
  • +
  •   流控规则
  • -
  • +
  •   流控规则
  • @@ -62,7 +62,7 @@   降级规则 -
  • +
  •   热点规则
  • @@ -70,11 +70,11 @@   系统规则 -
  • +
  •   授权规则
  • -
  • +
  •   集群流控
  • diff --git a/sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.js b/sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.js index 64ed684b..7ef57401 100755 --- a/sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.js +++ b/sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.js @@ -1,9 +1,3 @@ -/** - * @ngdoc directive - * @name izzyposWebApp.directive:adminPosHeader - * @description # adminPosHeader - */ - angular.module('sentinelDashboardApp') .directive('sidebar', ['$location', '$stateParams', 'AppService', function () { return { @@ -20,20 +14,23 @@ angular.module('sentinelDashboardApp') AppService.getApps().success( function (data) { if (data.code === 0) { - var path = $location.path().split('/'); + let path = $location.path().split('/'); let initHashApp = path[path.length - 1]; $scope.apps = data.data; $scope.apps = $scope.apps.map(function (item) { if (item.app === initHashApp) { item.active = true; } - var heathyCount = 0; - for (var i in item.machines) { + let healthyCount = 0; + for (let i in item.machines) { if (item.machines[i].healthy) { - heathyCount++; + healthyCount++; } } - item.heathyCount = heathyCount; + item.healthyCount = healthyCount; + // Handle appType + item.isGateway = item.appType === 1 || item.appType === 11 || item.appType === 12; + if (item.shown) { return item; } @@ -47,8 +44,8 @@ angular.module('sentinelDashboardApp') let entry = angular.element($event.target).scope().entry; entry.active = !entry.active;// toggle this clicked app bar - $scope.apps.forEach(function (item) {// collapse other app bars - if (item != entry) { + $scope.apps.forEach(function (item) { // collapse other app bars + if (item !== entry) { item.active = false; } }); diff --git a/sentinel-dashboard/src/main/webapp/resources/app/views/dialog/gateway/api-dialog.html b/sentinel-dashboard/src/main/webapp/resources/app/views/dialog/gateway/api-dialog.html index d58f48f9..fb0edb59 100644 --- a/sentinel-dashboard/src/main/webapp/resources/app/views/dialog/gateway/api-dialog.html +++ b/sentinel-dashboard/src/main/webapp/resources/app/views/dialog/gateway/api-dialog.html @@ -5,7 +5,7 @@
    - +
    @@ -27,13 +27,14 @@
    - +
    diff --git a/sentinel-dashboard/src/main/webapp/resources/app/views/dialog/gateway/flow-rule-dialog.html b/sentinel-dashboard/src/main/webapp/resources/app/views/dialog/gateway/flow-rule-dialog.html index bbaeab48..7dca16d7 100644 --- a/sentinel-dashboard/src/main/webapp/resources/app/views/dialog/gateway/flow-rule-dialog.html +++ b/sentinel-dashboard/src/main/webapp/resources/app/views/dialog/gateway/flow-rule-dialog.html @@ -5,7 +5,7 @@
    - +
     Route ID    API分组   + disabled="" title="API分组" /> API 分组    API分组   + title="API分组" ng-click="useCustormAPI()"/> API 分组  
    - +
    - - +  Client IP    Remote Host    Header   -  URL参数   +  URL 参数    Cookie  
    @@ -61,9 +61,9 @@
    @@ -108,7 +108,7 @@
    diff --git a/sentinel-dashboard/src/main/webapp/resources/app/views/gateway/api.html b/sentinel-dashboard/src/main/webapp/resources/app/views/gateway/api.html index 0316e689..b4e101c9 100644 --- a/sentinel-dashboard/src/main/webapp/resources/app/views/gateway/api.html +++ b/sentinel-dashboard/src/main/webapp/resources/app/views/gateway/api.html @@ -3,8 +3,8 @@ {{app}}
    - +
    @@ -15,7 +15,7 @@
    - API管理 + API 分组管理
    @@ -30,7 +30,7 @@ - API名称 + API 名称 匹配模式 @@ -54,8 +54,8 @@ {{api.pattern}} - - + + diff --git a/sentinel-dashboard/src/main/webapp/resources/app/views/gateway/flow.html b/sentinel-dashboard/src/main/webapp/resources/app/views/gateway/flow.html index 9bd4c232..62708c41 100644 --- a/sentinel-dashboard/src/main/webapp/resources/app/views/gateway/flow.html +++ b/sentinel-dashboard/src/main/webapp/resources/app/views/gateway/flow.html @@ -3,8 +3,8 @@ {{app}}
    - +
    @@ -30,10 +30,10 @@ - API名称 + API 名称 - API类型 + API 类型 阈值类型 @@ -53,7 +53,7 @@ {{rule.resource}} Route ID - API分组 + API 分组 QPS @@ -61,8 +61,8 @@ {{rule.count}} - - + + diff --git a/sentinel-dashboard/src/main/webapp/resources/app/views/gateway/identity.html b/sentinel-dashboard/src/main/webapp/resources/app/views/gateway/identity.html index a36c39ec..0736adc2 100644 --- a/sentinel-dashboard/src/main/webapp/resources/app/views/gateway/identity.html +++ b/sentinel-dashboard/src/main/webapp/resources/app/views/gateway/identity.html @@ -27,18 +27,18 @@ - 资源名 + API 名称 - - 资源类型 + + API 类型 - 通过QPS - 拒绝QPS + 通过 QPS + 拒绝 QPS 线程数 - 平均RT + 平均 RT 分钟通过 分钟拒绝 - 操作 + 操作 @@ -50,7 +50,7 @@ Route ID - 自定义API + 自定义 API {{resource.passQps}} {{resource.blockQps}}