Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add revoke item API. #2856 #2952

Merged
merged 5 commits into from
Mar 22, 2020
Merged

add revoke item API. #2856 #2952

merged 5 commits into from
Mar 22, 2020

Conversation

Accelerator96
Copy link
Contributor

What's the purpose of this PR

add revoke item API.

Which issue(s) this PR fixes:
Fixes #2856 #2595

@codecov-io
Copy link

codecov-io commented Mar 10, 2020

Codecov Report

Merging #2952 into master will increase coverage by 8.06%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2952      +/-   ##
============================================
+ Coverage     51.33%   59.39%   +8.06%     
+ Complexity     2228     1240     -988     
============================================
  Files           432      203     -229     
  Lines         13335     6155    -7180     
  Branches       1368      654     -714     
============================================
- Hits           6846     3656    -3190     
+ Misses         6011     2226    -3785     
+ Partials        478      273     -205     
Impacted Files Coverage Δ Complexity Δ
.../portal/spi/configuration/LdapGroupProperties.java
...lo/portal/controller/ReleaseHistoryController.java
...trip/framework/apollo/portal/enums/ChangeType.java
...mework/apollo/portal/controller/AppController.java
...trip/framework/apollo/portal/entity/vo/Number.java
...ponent/emailbuilder/ConfigPublishEmailBuilder.java
...nfigservice/ConfigServerEurekaServerConfigure.java
...mework/apollo/portal/service/NamespaceService.java
...mework/apollo/portal/entity/vo/EnvClusterInfo.java
...rk/apollo/metaservice/ApolloMetaServiceConfig.java
... and 219 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f3395f0...709ba8e. Read the comment docs.

@coveralls
Copy link

coveralls commented Mar 10, 2020

Coverage Status

Coverage decreased (-0.2%) to 54.769% when pulling 709ba8e on Accelerater:#2856 into f3395f0 on ctripcorp:master.

Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice try, however I think we need to combine the ui part to see how we could make this function work.

@JaredTan95 JaredTan95 added enhancement feature Categorizes issue as related to a new feature. labels Mar 17, 2020
@JaredTan95 JaredTan95 added this to the 1.7.0 milestone Mar 17, 2020
@Accelerator96
Copy link
Contributor Author

感谢 @bigflybrother 提供Portal页面支持。

Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically it works nicely. However, there are some suggestions as below, please take a look.

BTW, would you please squash the commits so that one commit from @bigflybrother and one commit from @Accelerater? Because for each pr we would only record one commit per author.

Env env = model.getEnv();
String clusterName = model.getClusterName();
String namespaceName = model.getNamespaceName();
long namespaceId = model.getNamespaceId();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please load the namespace and get the namespaceId instead of just using what's passed in since the namespaceId might not match the namespaceName

NamespaceDTO namespace = namespaceAPI.loadNamespace(appId, env, clusterName, namespaceName);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,modifyItemsByText这个也有潜在的安全风险

@@ -345,6 +347,8 @@
"Config.ClusterIsDefaultTipContent": "所有不属于 '{{name}}' 集群的实例会使用default集群(当前页面)的配置,属于 '{{name}}' 的实例会使用对应集群的配置!",
"Config.ClusterIsCustomTipContent": "属于 '{{name}}' 集群的实例只会使用 '{{name}}' 集群(当前页面)的配置,只有当对应namespace在当前集群没有发布过配置时,才会使用default集群的配置。",
"Config.HasNotPublishNamespace": "以下环境/集群有未发布的配置,客户端获取不到未发布的配置,请及时发布。",
"Config.RevokeItem.DialogTitle": "撤销配置",
"Config.RevokeItem.DialogContent": "当前命名空间下已修改但尚未未发布的配置将被撤销,确定要撤销么?",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当前命名空间下已修改但尚未发布的配置将被撤销,确定要撤销么?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个中文提示有什么不对的地方么?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

尚未未发布 => 尚未发布撤销,确定 => 撤销,确定

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我的 眼瞎了😖

@@ -178,6 +180,37 @@ function controller($rootScope, $scope, $translate, toastr, AppUtil, EventManage
});
}

function preRevokeItem(namespace) {
console.log("xxx")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove the debug message

ItemDTO oldItem = oldKeyMapItem.get(key);
if (oldItem == null) {
ItemDTO deletedItemDto = deletedItemDTOs.computeIfAbsent(key, k -> new ItemDTO());
changeSets.addCreateItem(buildNormalItem(0L,namespaceId,key,value,deletedItemDto.getComment(),lineNum.get()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the format doesn't look right here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是为了获取到已删除配置的comment. 有哪里不对么..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code format is not right, e.g, 0L,namespaceId => 0L, namespaceId

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂okay

@@ -187,6 +187,8 @@
"Component.Namespace.Master.Items.FilterItem": "过滤配置",
"Component.Namespace.Master.Items.SyncItemTips": "同步各环境间配置",
"Component.Namespace.Master.Items.SyncItem": "同步配置",
"Component.Namespace.Master.Items.RevokeItemTips": "撤销配置的修改",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add the English translations to en.json

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

@@ -345,6 +347,8 @@
"Config.ClusterIsDefaultTipContent": "All instances that do not belong to the '{{name}}' cluster will fetch the default cluster (current page) configuration, and those that belong to the '{{name}}' cluster will use the corresponding cluster configuration!",
"Config.ClusterIsCustomTipContent": "Instances belonging to the '{{name}}' cluster will only fetch the configuration of the '{{name}}' cluster (the current page), and the default cluster configuration will only be fetched when the corresponding namespace has not been released in the current cluster.",
"Config.HasNotPublishNamespace": "The following environment/cluster has unreleased configurations, the client will not fetch the unreleased configurations, please release them in time.",
"Config.RevokeItem.DialogTitle": "Revoke configuration",
"Config.RevokeItem.DialogContent": "Modified but unpublished configurations in the current namespace will be revoked. Are you sure to revoke the configuration?",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Revoke.RevokeFailed and Revoke.RevokeSuccessfully are still missing?

@@ -185,6 +185,8 @@
"Component.Namespace.Master.Items.SummitChanged": "Submit",
"Component.Namespace.Master.Items.SortByKey": "Filter the configurations by key",
"Component.Namespace.Master.Items.FilterItem": "Filter",
"Component.Namespace.Master.Items.RevokeItemTips": "Revoke configurations",
Copy link
Member

@nobodyiam nobodyiam Mar 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about Revoke configuration changes?

@@ -345,6 +347,8 @@
"Config.ClusterIsDefaultTipContent": "All instances that do not belong to the '{{name}}' cluster will fetch the default cluster (current page) configuration, and those that belong to the '{{name}}' cluster will use the corresponding cluster configuration!",
"Config.ClusterIsCustomTipContent": "Instances belonging to the '{{name}}' cluster will only fetch the configuration of the '{{name}}' cluster (the current page), and the default cluster configuration will only be fetched when the corresponding namespace has not been released in the current cluster.",
"Config.HasNotPublishNamespace": "The following environment/cluster has unreleased configurations, the client will not fetch the unreleased configurations, please release them in time.",
"Config.RevokeItem.DialogTitle": "Revoke configuration",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about Revoke configuration changes?

@@ -345,6 +347,8 @@
"Config.ClusterIsDefaultTipContent": "All instances that do not belong to the '{{name}}' cluster will fetch the default cluster (current page) configuration, and those that belong to the '{{name}}' cluster will use the corresponding cluster configuration!",
"Config.ClusterIsCustomTipContent": "Instances belonging to the '{{name}}' cluster will only fetch the configuration of the '{{name}}' cluster (the current page), and the default cluster configuration will only be fetched when the corresponding namespace has not been released in the current cluster.",
"Config.HasNotPublishNamespace": "The following environment/cluster has unreleased configurations, the client will not fetch the unreleased configurations, please release them in time.",
"Config.RevokeItem.DialogTitle": "Revoke configuration",
"Config.RevokeItem.DialogContent": "Modified but unpublished configurations in the current namespace will be revoked. Are you sure to revoke the configuration?",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about Modified but unpublished configurations in the current namespace will be revoked. Are you sure to revoke the configuration changes?

Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature Categorizes issue as related to a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

撤销操作
5 participants