From 2c7750ebc37cb70ce69b787c8b2f43dd46f7126a Mon Sep 17 00:00:00 2001 From: "jianfei.zhang" Date: Fri, 1 Jul 2022 15:22:51 +0800 Subject: [PATCH 1/7] =?UTF-8?q?feat:=E5=85=B3=E8=81=94=20namespace?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=EF=BC=8C=E5=8F=AF=E4=BB=A5=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=A4=9A=E4=B8=AAnamespace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jianfei.zhang jianfei.zhang@daocloud.io --- .../src/main/resources/static/namespace.html | 2 +- .../scripts/controller/NamespaceController.js | 34 +++++++++++-------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/apollo-portal/src/main/resources/static/namespace.html b/apollo-portal/src/main/resources/static/namespace.html index 6d5688ece18..8bddbfcd225 100644 --- a/apollo-portal/src/main/resources/static/namespace.html +++ b/apollo-portal/src/main/resources/static/namespace.html @@ -186,7 +186,7 @@ {{'Namespace.Namespace' | translate }}
-
diff --git a/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js b/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js index d33ef21922c..9add65bcb74 100644 --- a/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js +++ b/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js @@ -94,32 +94,38 @@ namespace_module.controller("LinkNamespaceController", selectedClusters = data; }; $scope.createNamespace = function () { - if ($scope.type == 'link') { - if (selectedClusters.length == 0) { + if ($scope.type === 'link') { + if (selectedClusters.length === 0) { toastr.warning($translate.instant('Namespace.PleaseChooseCluster')); return; } - if ($scope.namespaceType == 1) { - var selectedNamespaceName = $('#namespaces').select2('data')[0].id; - if (!selectedNamespaceName) { + if ($scope.namespaceType === 1) { + var selectedNamespaceNames = $('#namespaces').select2('data'); + var ids = [] + selectedNamespaceNames.map().forEach(function (namespace) { + ids.push(namespace.id) + }) + if (ids.length === 0) { toastr.warning($translate.instant('Namespace.PleaseChooseNamespace')); return; } - $scope.namespaceName = selectedNamespaceName; + $scope.namespaceNames = ids; } var namespaceCreationModels = []; selectedClusters.forEach(function (cluster) { - namespaceCreationModels.push({ - env: cluster.env, - namespace: { - appId: $scope.appId, - clusterName: cluster.clusterName, - namespaceName: $scope.namespaceName - } - }); + $scope.namespaceNames.forEach(function (namespace) { + namespaceCreationModels.push({ + env: cluster.env, + namespace: { + appId: $scope.appId, + clusterName: cluster.clusterName, + namespaceName: namespace + } + }); + }) }); $scope.submitBtnDisabled = true; From 2172a963cb588aac216a8bcd7698ea72ba456a6f Mon Sep 17 00:00:00 2001 From: "jianfei.zhang" Date: Fri, 1 Jul 2022 17:14:52 +0800 Subject: [PATCH 2/7] feat:CHANGES.md Signed-off-by: jianfei.zhang jianfei.zhang@daocloud.io --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index c65704e7b1d..8481549b25e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,5 +13,6 @@ Apollo 2.1.0 * [Upgrade mysql-connector-java version to fix possible transaction rollback failure issue](https://github.com/apolloconfig/apollo/pull/4425) * [Remove database migration tool Flyway](https://github.com/apolloconfig/apollo/pull/4361) * [Optimize Spring-Security Firewall Deny Request Response 400](https://github.com/apolloconfig/apollo/pull/4428) +* [On the Namespace association screen, you can select multiple namespaces at a time](https://github.com/apolloconfig/apollo/pull/4437) ------------------ All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/11?closed=1) From 06c63ebfa7abe650c2fb1f80414bd5cd6d61091c Mon Sep 17 00:00:00 2001 From: falser101 <62228193+falser101@users.noreply.github.com> Date: Fri, 1 Jul 2022 19:53:19 +0800 Subject: [PATCH 3/7] fix: remove error function --- .../resources/static/scripts/controller/NamespaceController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js b/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js index 9add65bcb74..3e3f5f23d6a 100644 --- a/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js +++ b/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js @@ -103,7 +103,7 @@ namespace_module.controller("LinkNamespaceController", if ($scope.namespaceType === 1) { var selectedNamespaceNames = $('#namespaces').select2('data'); var ids = [] - selectedNamespaceNames.map().forEach(function (namespace) { + selectedNamespaceNames.forEach(function (namespace) { ids.push(namespace.id) }) if (ids.length === 0) { From bf0e0872ddc4d17f83fbcccdd8b5617bfb831fc1 Mon Sep 17 00:00:00 2001 From: falser101 <62228193+falser101@users.noreply.github.com> Date: Sat, 2 Jul 2022 11:29:11 +0800 Subject: [PATCH 4/7] =?UTF-8?q?feat:=20=E5=90=8E=E7=AB=AF=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=A4=9Anamespace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apollo/portal/controller/NamespaceController.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceController.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceController.java index f4f56dd1f2d..19f5f5a00f9 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceController.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceController.java @@ -143,14 +143,12 @@ public ResponseEntity createNamespace(@PathVariable String appId, @RequestBody List models) { checkModel(!CollectionUtils.isEmpty(models)); - - String namespaceName = models.get(0).getNamespace().getNamespaceName(); String operator = userInfoHolder.getUser().getUserId(); - roleInitializationService.initNamespaceRoles(appId, namespaceName, operator); - roleInitializationService.initNamespaceEnvRoles(appId, namespaceName, operator); - for (NamespaceCreationModel model : models) { + String namespaceName = model.getNamespace().getNamespaceName(); + roleInitializationService.initNamespaceRoles(appId, namespaceName, operator); + roleInitializationService.initNamespaceEnvRoles(appId, namespaceName, operator); NamespaceDTO namespace = model.getNamespace(); RequestPrecondition.checkArgumentsNotEmpty(model.getEnv(), namespace.getAppId(), namespace.getClusterName(), namespace.getNamespaceName()); @@ -163,10 +161,9 @@ public ResponseEntity createNamespace(@PathVariable String appId, String.format("create namespace fail. (env=%s namespace=%s)", model.getEnv(), namespace.getNamespaceName()), e); } + namespaceService.assignNamespaceRoleToOperator(appId, namespaceName,userInfoHolder.getUser().getUserId()); } - namespaceService.assignNamespaceRoleToOperator(appId, namespaceName,userInfoHolder.getUser().getUserId()); - return ResponseEntity.ok().build(); } From 2a97b97d26a44afba224cf59719c99de4ae024ee Mon Sep 17 00:00:00 2001 From: falser101 Date: Sat, 2 Jul 2022 20:31:30 +0800 Subject: [PATCH 5/7] fix: redirect to config html Signed-off-by: jianfei.zhang --- .../resources/static/scripts/controller/NamespaceController.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js b/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js index 3e3f5f23d6a..9daca0279a7 100644 --- a/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js +++ b/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js @@ -136,8 +136,7 @@ namespace_module.controller("LinkNamespaceController", setInterval(function () { $scope.submitBtnDisabled = false; $window.location.href = - AppUtil.prefixPath() + '/namespace/role.html?#appid=' + $scope.appId - + "&namespaceName=" + $scope.namespaceName; + AppUtil.prefixPath() + '/config.html?#/appid=' + $scope.appId; }, 1000); }, function (result) { $scope.submitBtnDisabled = false; From 47f35ff6c90d8c29acf439a68aeba251600b516d Mon Sep 17 00:00:00 2001 From: falser101 Date: Sat, 2 Jul 2022 20:38:41 +0800 Subject: [PATCH 6/7] fix: redirect to html Signed-off-by: jianfei.zhang --- .../static/scripts/controller/NamespaceController.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js b/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js index 9daca0279a7..30c60e8a08b 100644 --- a/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js +++ b/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js @@ -135,8 +135,14 @@ namespace_module.controller("LinkNamespaceController", $scope.step = 2; setInterval(function () { $scope.submitBtnDisabled = false; - $window.location.href = - AppUtil.prefixPath() + '/config.html?#/appid=' + $scope.appId; + if ($scope.namespaceNames.length === 1) { + $window.location.href = + AppUtil.prefixPath() + '/namespace/role.html?#appid=' + $scope.appId + + "&namespaceName=" + $scope.namespaceNames[0]; + } else { + $window.location.href = + AppUtil.prefixPath() + '/config.html?#/appid=' + $scope.appId; + } }, 1000); }, function (result) { $scope.submitBtnDisabled = false; From 61353b13a88be917d83384df71529abd9238e5ef Mon Sep 17 00:00:00 2001 From: falser101 <62228193+falser101@users.noreply.github.com> Date: Sun, 3 Jul 2022 13:30:40 +0800 Subject: [PATCH 7/7] Update CHANGES.md --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 8481549b25e..26b16d67e89 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,6 @@ Apollo 2.1.0 * [Upgrade mysql-connector-java version to fix possible transaction rollback failure issue](https://github.com/apolloconfig/apollo/pull/4425) * [Remove database migration tool Flyway](https://github.com/apolloconfig/apollo/pull/4361) * [Optimize Spring-Security Firewall Deny Request Response 400](https://github.com/apolloconfig/apollo/pull/4428) -* [On the Namespace association screen, you can select multiple namespaces at a time](https://github.com/apolloconfig/apollo/pull/4437) +* [Allow users to associate multiple public namespaces at a time](https://github.com/apolloconfig/apollo/pull/4437) ------------------ All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/11?closed=1)