From 13d8609131d71928836100b11eedcc8cebb74f7b Mon Sep 17 00:00:00 2001 From: lishanglin Date: Tue, 21 May 2024 14:07:19 +0800 Subject: [PATCH] import iam server (#800) * only allow migrate to dc in the same region * import DLP --------- Co-authored-by: lishanglin --- .../package/redis-console-package/src/main/scripts/startup.sh | 2 +- redis/redis-console/src/main/resources/static/401.html | 3 ++- redis/redis-console/src/main/resources/static/dist/bundle.js | 2 +- redis/redis-console/src/main/resources/static/index.html | 1 + .../static/scripts/controllers/ActiveDcMigrationIndexCtl.ts | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/redis/package/redis-console-package/src/main/scripts/startup.sh b/redis/package/redis-console-package/src/main/scripts/startup.sh index acca1e6617..453e59ac53 100644 --- a/redis/package/redis-console-package/src/main/scripts/startup.sh +++ b/redis/package/redis-console-package/src/main/scripts/startup.sh @@ -61,7 +61,7 @@ function changeAndMakeLogDir(){ #../xx.conf sed -i 's#LOG_FOLDER=\(.*\)#LOG_FOLDER='"$logdir"'#' $current/../*.conf - // + # sed -i 's#name="baseDir">.*#name="baseDir">'$logdir'#' $current/../config/log4j2.xml sed -i 's|||' $current/../config/arthas-logback.xml } diff --git a/redis/redis-console/src/main/resources/static/401.html b/redis/redis-console/src/main/resources/static/401.html index b5928dbaca..3d93f91063 100644 --- a/redis/redis-console/src/main/resources/static/401.html +++ b/redis/redis-console/src/main/resources/static/401.html @@ -37,7 +37,7 @@

Oops...

-

您没有操作权限.详情请联系 [ wcmeng@ctrip.com ]

+

您没有操作权限.详情请联系 [ sl_li@trip.com ]

@@ -52,5 +52,6 @@

Oops...

+ diff --git a/redis/redis-console/src/main/resources/static/dist/bundle.js b/redis/redis-console/src/main/resources/static/dist/bundle.js index 8fc58a451d..3d3c28cd28 100644 --- a/redis/redis-console/src/main/resources/static/dist/bundle.js +++ b/redis/redis-console/src/main/resources/static/dist/bundle.js @@ -9013,7 +9013,7 @@ eval("angular\n .module('index')\n .controller('ActiveDcMigrationEventList \**********************************************************/ /***/ (() => { -eval("angular\n .module('index')\n .controller('ActiveDcMigrationIndexCtl', ActiveDcMigrationIndexCtl);\nActiveDcMigrationIndexCtl.$inject = ['$rootScope', '$scope', '$window', '$stateParams', '$interval', 'AppUtil',\n 'toastr', 'NgTableParams', 'ClusterService', 'DcService', 'MigrationService', 'ClusterType'];\nfunction ActiveDcMigrationIndexCtl($rootScope, $scope, $window, $stateParams, $interval, AppUtil, toastr, NgTableParams, ClusterService, DcService, MigrationService, ClusterType) {\n $scope.sourceDcSelected = sourceDcSelected;\n $scope.targetDcSelected = targetDcSelected;\n $scope.availableTargetDcs = availableTargetDcs;\n $scope.preMigrate = preMigrate;\n $scope.doMigrate = doMigrate;\n $scope.clusterOrgNameSelected = clusterOrgNameSelected;\n $scope.getMasterUnhealthyClusters = getMasterUnhealthyClusters;\n $scope.migrationUnsupportedClusters = [];\n $scope.migrationSysCheckResp = {};\n $scope.enableMigrationButton = false;\n init();\n var SUCCESS_STATE = 0;\n var WARNING_STATE = 1;\n function init() {\n checkMigrationSystem();\n DcService.loadAllDcs().then(function (data) {\n $scope.dcs = data;\n ClusterService.getInvolvedOrgs().then(function (result) {\n $scope.organizations = result;\n $scope.organizations.push({ \"orgName\": \"不选择\" });\n });\n if (!!$stateParams.clusters && $stateParams.clusters.length > 0) {\n showClusters($stateParams.clusters);\n }\n else if ($stateParams.clusterName != undefined) {\n ClusterService.load_cluster($stateParams.clusterName).then(showCluster);\n }\n else {\n MigrationService.getDefaultMigrationCluster().then(showCluster);\n }\n });\n MigrationService.getMigrationUnsupportedClusters().then(function (result) {\n $scope.migrationUnsupportedClusters = result;\n });\n intervalRetriveInfo();\n }\n function focusDcByCluster(cluster) {\n $scope.sourceDcInfo = $scope.dcs.filter(function (dcInfo) {\n return dcInfo.id === cluster.activedcId;\n })[0];\n }\n function showCluster(cluster) {\n showClusters([cluster]);\n }\n function showClusters(clusters) {\n if (!clusters || clusters.length == 0)\n return;\n focusDcByCluster(clusters[0]);\n var clusterNames = clusters.map(function (c) { return c.clusterName; });\n ClusterService.findClustersByNames.apply(ClusterService, clusterNames).then(function (result) {\n $scope.clusters = result.filter(function (c) { return ClusterType.lookup(c.clusterType).supportMigration && !$scope.migrationUnsupportedClusters.includes(c.clusterName.toLowerCase()) && !!c.activedcId && !!$scope.sourceDcInfo && c.activedcId == $scope.sourceDcInfo.id; });\n $scope.tableParams.reload();\n });\n }\n $scope.$on('$destroy', function () {\n $interval.cancel($scope.scheduledWork);\n });\n $scope.scheduledWork;\n function intervalRetriveInfo() {\n $scope.scheduledWork = $interval(checkMigrationSystem, 1500);\n }\n function checkMigrationSystem() {\n MigrationService.checkMigrationSystem().then(function (value) {\n $scope.migrationSysCheckResp = value;\n if (value.state === SUCCESS_STATE) {\n $scope.enableMigrationButton = true;\n $scope.migrationSysCheckResp.success = true;\n }\n else if (value.state === WARNING_STATE) {\n $scope.enableMigrationButton = true;\n $scope.migrationSysCheckResp.warning = true;\n }\n else {\n $scope.enableMigrationButton = false;\n $scope.migrationSysCheckResp.error = true;\n }\n });\n }\n $scope.showErrorMessage = function () {\n if ($scope.migrationSysCheckResp.message) {\n $('#errorMessage').modal('show');\n }\n };\n $scope.hideErrorMessage = function () {\n $scope.migrationSysCheckResp.message = '';\n $('#errorMessage').modal('hide');\n };\n $scope.clusterOrgName = '';\n function clusterOrgNameSelected() {\n var dcName = $scope.sourceDc;\n if (dcName) {\n sourceDcSelected();\n }\n }\n $scope.masterUnhealthyClusters = [];\n $scope.masterUnhealthyClusterStateLevels = [\n { \"name\": \"至少一个Master不可用\", \"level\": \"LEAST_ONE_DOWN\" },\n { \"name\": \"25%以上Master不可用\", \"level\": \"QUARTER_DOWN\" },\n { \"name\": \"50%以上Master不可用\", \"level\": \"HALF_DOWN\" },\n { \"name\": \"75%以上Master不可用\", \"level\": \"THREE_QUARTER_DOWN\" },\n { \"name\": \"100%Master不可用\", \"level\": \"FULL_DOWN\" },\n { \"name\": \"不选\", \"level\": \"NORMAL\" }\n ];\n $scope.masterUnhealthyClusterState = '';\n function getMasterUnhealthyClusters() {\n var level = $scope.masterUnhealthyClusterState;\n if (level && level !== \"NORMAL\") {\n ClusterService.getMasterUnhealthyClusters(level)\n .then(function (targetClusters) {\n $scope.masterUnhealthyClusters = targetClusters;\n if ($scope.sourceDc) {\n sourceDcSelected();\n }\n });\n }\n else if (level === \"NORMAL\") {\n $scope.masterUnhealthyClusters = [];\n if ($scope.sourceDc) {\n sourceDcSelected();\n }\n }\n }\n function sourceDcSelected() {\n var dcName = $scope.sourceDc;\n var orgName = $scope.clusterOrgName;\n var clusterNameFilter = $scope.masterUnhealthyClusters;\n var level = $scope.masterUnhealthyClusterState;\n $scope.sourceDcInfo = $scope.dcs.filter(function (dcInfo) {\n return dcInfo.dcName === dcName;\n })[0];\n ClusterService.findClustersByActiveDcName(dcName).then(function (data) {\n var result = data;\n if (orgName && orgName !== \"不选择\") {\n result = result.filter(function (localCluster) {\n return localCluster.clusterOrgName === orgName;\n });\n }\n if (level && level !== \"NORMAL\") {\n result = result.filter(function (localCluster) {\n return clusterNameFilter.includes(localCluster.clusterName);\n });\n }\n $scope.clusters = result.filter(function (c) { return ClusterType.lookup(c.clusterType).supportMigration; });\n $scope.tableParams.reload();\n });\n }\n function targetDcSelected(cluster) {\n if (cluster.targetDc == \"-\") {\n cluster.selected = false;\n }\n else {\n cluster.selected = true;\n }\n }\n function availableTargetDcs(cluster) {\n var dcs = [];\n cluster.dcClusterInfo.forEach(function (dcCluster) {\n if (dcCluster.dcInfo.dcName !== $scope.sourceDcInfo.dcName) {\n dcs.push(dcCluster.dcInfo);\n }\n });\n return dcs;\n }\n function preMigrate() {\n var selectedClusters = $scope.clusters.filter(function (cluster) {\n return cluster.selected;\n });\n var targetedClusters = $scope.clusters.filter(function (cluster) {\n return cluster.selected && (cluster.targetDc !== \"-\");\n });\n if (!(selectedClusters.length === targetedClusters.length)) {\n $('#createEventWithLostConfirm').modal('show');\n }\n else {\n doMigrate();\n }\n }\n function doMigrate() {\n var selectedClusters = $scope.clusters.filter(function (cluster) {\n return cluster.selected && (cluster.targetDc !== \"-\");\n });\n var migrationClusters = [];\n selectedClusters.forEach(function (cluster) {\n migrationClusters.push({\n clusterId: cluster.id,\n sourceDcId: cluster.activedcId,\n destinationDcId: getDcId(cluster.targetDc),\n cluster: cluster,\n });\n });\n MigrationService.createEvent(migrationClusters)\n .then(function (result) {\n $('#createEventWithLostConfirm').modal('hide');\n toastr.success('创建成功');\n $window.location.href = '/#/migration_event_details/' + result.value;\n }, function (result) {\n toastr.error(AppUtil.errorMsg(result), '创建失败');\n });\n }\n function getDcId(destinationDc) {\n var res = -1;\n $scope.dcs.forEach(function (dc) {\n if (dc.dcName === destinationDc) {\n res = dc.id;\n }\n });\n return res;\n }\n $scope.sourceDc = '';\n $scope.clusters = [];\n $scope.sourceDcInfo = {};\n $scope.toggle = function (cluster) {\n cluster.selected = !cluster.selected;\n };\n $scope.isIndeterminate = function () {\n var selectedClusters = $scope.clusters.filter(function (cluster) {\n return cluster.selected;\n });\n return (selectedClusters.length !== $scope.clusters.length) &&\n (selectedClusters.length > 0);\n };\n $scope.isChecked = function () {\n var selectedClusters = $scope.clusters.filter(function (cluster) {\n return cluster.selected;\n });\n return (selectedClusters.length === $scope.clusters.length) &&\n (selectedClusters.length !== 0);\n };\n $scope.toggleAll = function () {\n if ($scope.isIndeterminate()) {\n $scope.clusters.forEach(function (cluster) {\n cluster.selected = true;\n });\n }\n else {\n $scope.clusters.forEach(function (cluster) {\n cluster.selected = !cluster.selected;\n });\n }\n };\n $scope.tableParams = new NgTableParams({\n page: 1,\n count: 10\n }, {\n filterDelay: 100,\n getData: function (params) {\n // TODO [marsqing] paging control\n // params.total(1);\n return $scope.clusters;\n }\n });\n}\n\n\n//# sourceURL=webpack://XPipe-Console/./scripts/controllers/ActiveDcMigrationIndexCtl.ts?"); +eval("angular\n .module('index')\n .controller('ActiveDcMigrationIndexCtl', ActiveDcMigrationIndexCtl);\nActiveDcMigrationIndexCtl.$inject = ['$rootScope', '$scope', '$window', '$stateParams', '$interval', 'AppUtil',\n 'toastr', 'NgTableParams', 'ClusterService', 'DcService', 'MigrationService', 'ClusterType'];\nfunction ActiveDcMigrationIndexCtl($rootScope, $scope, $window, $stateParams, $interval, AppUtil, toastr, NgTableParams, ClusterService, DcService, MigrationService, ClusterType) {\n $scope.sourceDcSelected = sourceDcSelected;\n $scope.targetDcSelected = targetDcSelected;\n $scope.availableTargetDcs = availableTargetDcs;\n $scope.preMigrate = preMigrate;\n $scope.doMigrate = doMigrate;\n $scope.clusterOrgNameSelected = clusterOrgNameSelected;\n $scope.getMasterUnhealthyClusters = getMasterUnhealthyClusters;\n $scope.migrationUnsupportedClusters = [];\n $scope.migrationSysCheckResp = {};\n $scope.enableMigrationButton = false;\n init();\n var SUCCESS_STATE = 0;\n var WARNING_STATE = 1;\n function init() {\n checkMigrationSystem();\n DcService.loadAllDcs().then(function (data) {\n $scope.dcs = data;\n ClusterService.getInvolvedOrgs().then(function (result) {\n $scope.organizations = result;\n $scope.organizations.push({ \"orgName\": \"不选择\" });\n });\n if (!!$stateParams.clusters && $stateParams.clusters.length > 0) {\n showClusters($stateParams.clusters);\n }\n else if ($stateParams.clusterName != undefined) {\n ClusterService.load_cluster($stateParams.clusterName).then(showCluster);\n }\n else {\n MigrationService.getDefaultMigrationCluster().then(showCluster);\n }\n });\n MigrationService.getMigrationUnsupportedClusters().then(function (result) {\n $scope.migrationUnsupportedClusters = result;\n });\n intervalRetriveInfo();\n }\n function focusDcByCluster(cluster) {\n $scope.sourceDcInfo = $scope.dcs.filter(function (dcInfo) {\n return dcInfo.id === cluster.activedcId;\n })[0];\n }\n function showCluster(cluster) {\n showClusters([cluster]);\n }\n function showClusters(clusters) {\n if (!clusters || clusters.length == 0)\n return;\n focusDcByCluster(clusters[0]);\n var clusterNames = clusters.map(function (c) { return c.clusterName; });\n ClusterService.findClustersByNames.apply(ClusterService, clusterNames).then(function (result) {\n $scope.clusters = result.filter(function (c) { return ClusterType.lookup(c.clusterType).supportMigration && !$scope.migrationUnsupportedClusters.includes(c.clusterName.toLowerCase()) && !!c.activedcId && !!$scope.sourceDcInfo && c.activedcId == $scope.sourceDcInfo.id; });\n $scope.tableParams.reload();\n });\n }\n $scope.$on('$destroy', function () {\n $interval.cancel($scope.scheduledWork);\n });\n $scope.scheduledWork;\n function intervalRetriveInfo() {\n $scope.scheduledWork = $interval(checkMigrationSystem, 1500);\n }\n function checkMigrationSystem() {\n MigrationService.checkMigrationSystem().then(function (value) {\n $scope.migrationSysCheckResp = value;\n if (value.state === SUCCESS_STATE) {\n $scope.enableMigrationButton = true;\n $scope.migrationSysCheckResp.success = true;\n }\n else if (value.state === WARNING_STATE) {\n $scope.enableMigrationButton = true;\n $scope.migrationSysCheckResp.warning = true;\n }\n else {\n $scope.enableMigrationButton = false;\n $scope.migrationSysCheckResp.error = true;\n }\n });\n }\n $scope.showErrorMessage = function () {\n if ($scope.migrationSysCheckResp.message) {\n $('#errorMessage').modal('show');\n }\n };\n $scope.hideErrorMessage = function () {\n $scope.migrationSysCheckResp.message = '';\n $('#errorMessage').modal('hide');\n };\n $scope.clusterOrgName = '';\n function clusterOrgNameSelected() {\n var dcName = $scope.sourceDc;\n if (dcName) {\n sourceDcSelected();\n }\n }\n $scope.masterUnhealthyClusters = [];\n $scope.masterUnhealthyClusterStateLevels = [\n { \"name\": \"至少一个Master不可用\", \"level\": \"LEAST_ONE_DOWN\" },\n { \"name\": \"25%以上Master不可用\", \"level\": \"QUARTER_DOWN\" },\n { \"name\": \"50%以上Master不可用\", \"level\": \"HALF_DOWN\" },\n { \"name\": \"75%以上Master不可用\", \"level\": \"THREE_QUARTER_DOWN\" },\n { \"name\": \"100%Master不可用\", \"level\": \"FULL_DOWN\" },\n { \"name\": \"不选\", \"level\": \"NORMAL\" }\n ];\n $scope.masterUnhealthyClusterState = '';\n function getMasterUnhealthyClusters() {\n var level = $scope.masterUnhealthyClusterState;\n if (level && level !== \"NORMAL\") {\n ClusterService.getMasterUnhealthyClusters(level)\n .then(function (targetClusters) {\n $scope.masterUnhealthyClusters = targetClusters;\n if ($scope.sourceDc) {\n sourceDcSelected();\n }\n });\n }\n else if (level === \"NORMAL\") {\n $scope.masterUnhealthyClusters = [];\n if ($scope.sourceDc) {\n sourceDcSelected();\n }\n }\n }\n function sourceDcSelected() {\n var dcName = $scope.sourceDc;\n var orgName = $scope.clusterOrgName;\n var clusterNameFilter = $scope.masterUnhealthyClusters;\n var level = $scope.masterUnhealthyClusterState;\n $scope.sourceDcInfo = $scope.dcs.filter(function (dcInfo) {\n return dcInfo.dcName === dcName;\n })[0];\n ClusterService.findClustersByActiveDcName(dcName).then(function (data) {\n var result = data;\n if (orgName && orgName !== \"不选择\") {\n result = result.filter(function (localCluster) {\n return localCluster.clusterOrgName === orgName;\n });\n }\n if (level && level !== \"NORMAL\") {\n result = result.filter(function (localCluster) {\n return clusterNameFilter.includes(localCluster.clusterName);\n });\n }\n $scope.clusters = result.filter(function (c) { return ClusterType.lookup(c.clusterType).supportMigration; });\n $scope.tableParams.reload();\n });\n }\n function targetDcSelected(cluster) {\n if (cluster.targetDc == \"-\") {\n cluster.selected = false;\n }\n else {\n cluster.selected = true;\n }\n }\n function availableTargetDcs(cluster) {\n var dcs = [];\n cluster.dcClusterInfo.forEach(function (dcCluster) {\n if (dcCluster.dcInfo.dcName !== $scope.sourceDcInfo.dcName && dcCluster.dcInfo.zoneId === $scope.sourceDcInfo.zoneId) {\n dcs.push(dcCluster.dcInfo);\n }\n });\n return dcs;\n }\n function preMigrate() {\n var selectedClusters = $scope.clusters.filter(function (cluster) {\n return cluster.selected;\n });\n var targetedClusters = $scope.clusters.filter(function (cluster) {\n return cluster.selected && (cluster.targetDc !== \"-\");\n });\n if (!(selectedClusters.length === targetedClusters.length)) {\n $('#createEventWithLostConfirm').modal('show');\n }\n else {\n doMigrate();\n }\n }\n function doMigrate() {\n var selectedClusters = $scope.clusters.filter(function (cluster) {\n return cluster.selected && (cluster.targetDc !== \"-\");\n });\n var migrationClusters = [];\n selectedClusters.forEach(function (cluster) {\n migrationClusters.push({\n clusterId: cluster.id,\n sourceDcId: cluster.activedcId,\n destinationDcId: getDcId(cluster.targetDc),\n cluster: cluster,\n });\n });\n MigrationService.createEvent(migrationClusters)\n .then(function (result) {\n $('#createEventWithLostConfirm').modal('hide');\n toastr.success('创建成功');\n $window.location.href = '/#/migration_event_details/' + result.value;\n }, function (result) {\n toastr.error(AppUtil.errorMsg(result), '创建失败');\n });\n }\n function getDcId(destinationDc) {\n var res = -1;\n $scope.dcs.forEach(function (dc) {\n if (dc.dcName === destinationDc) {\n res = dc.id;\n }\n });\n return res;\n }\n $scope.sourceDc = '';\n $scope.clusters = [];\n $scope.sourceDcInfo = {};\n $scope.toggle = function (cluster) {\n cluster.selected = !cluster.selected;\n };\n $scope.isIndeterminate = function () {\n var selectedClusters = $scope.clusters.filter(function (cluster) {\n return cluster.selected;\n });\n return (selectedClusters.length !== $scope.clusters.length) &&\n (selectedClusters.length > 0);\n };\n $scope.isChecked = function () {\n var selectedClusters = $scope.clusters.filter(function (cluster) {\n return cluster.selected;\n });\n return (selectedClusters.length === $scope.clusters.length) &&\n (selectedClusters.length !== 0);\n };\n $scope.toggleAll = function () {\n if ($scope.isIndeterminate()) {\n $scope.clusters.forEach(function (cluster) {\n cluster.selected = true;\n });\n }\n else {\n $scope.clusters.forEach(function (cluster) {\n cluster.selected = !cluster.selected;\n });\n }\n };\n $scope.tableParams = new NgTableParams({\n page: 1,\n count: 10\n }, {\n filterDelay: 100,\n getData: function (params) {\n // TODO [marsqing] paging control\n // params.total(1);\n return $scope.clusters;\n }\n });\n}\n\n\n//# sourceURL=webpack://XPipe-Console/./scripts/controllers/ActiveDcMigrationIndexCtl.ts?"); /***/ }), diff --git a/redis/redis-console/src/main/resources/static/index.html b/redis/redis-console/src/main/resources/static/index.html index ab9d513fbb..108571e7fe 100644 --- a/redis/redis-console/src/main/resources/static/index.html +++ b/redis/redis-console/src/main/resources/static/index.html @@ -201,6 +201,7 @@ + diff --git a/redis/redis-console/src/main/resources/static/scripts/controllers/ActiveDcMigrationIndexCtl.ts b/redis/redis-console/src/main/resources/static/scripts/controllers/ActiveDcMigrationIndexCtl.ts index 15a6a4a72a..0f18d19031 100644 --- a/redis/redis-console/src/main/resources/static/scripts/controllers/ActiveDcMigrationIndexCtl.ts +++ b/redis/redis-console/src/main/resources/static/scripts/controllers/ActiveDcMigrationIndexCtl.ts @@ -181,7 +181,7 @@ function ActiveDcMigrationIndexCtl($rootScope, $scope, $window, $stateParams, $i var dcs = []; cluster.dcClusterInfo.forEach(function(dcCluster) { - if(dcCluster.dcInfo.dcName !== $scope.sourceDcInfo.dcName) { + if(dcCluster.dcInfo.dcName !== $scope.sourceDcInfo.dcName && dcCluster.dcInfo.zoneId === $scope.sourceDcInfo.zoneId) { dcs.push(dcCluster.dcInfo); } });