wolfboys commented on code in PR #1881:
URL:
https://github.com/apache/incubator-streampark/pull/1881#discussion_r1002510402
##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/TeamServiceImpl.java:
##########
@@ -74,9 +95,23 @@ public void createTeam(Team team) {
}
@Override
- public void deleteTeam(Team team) {
- // TODO 查询 app 和 project,如果还有 app 或 project 没有删除,则 team 不能被删除。
- this.removeById(team);
+ public void deleteTeam(Long teamId) {
+ log.info("{} Proceed delete team[Id={}]",
commonService.getCurrentUser().getUsername(), teamId);
+ Team team = this.getById(teamId);
+ // TODO The AssertUtils.checkApiAlert can simplify the exception.
+ if (team == null) {
+ throw new ApiAlertException(String.format("The team[Id=%s] doesn't
exists.", teamId));
+ }
+ if (applicationService.countByTeamId(teamId) > 0) {
+ throw new ApiAlertException(String.format("Please delete the
applications under the team[name=%s] first!", team.getTeamName()));
+ }
+ if (projectService.countByTeamId(teamId) > 0) {
+ throw new ApiAlertException(String.format("Please delete the
projects under the team[name=%s] first!", team.getTeamName()));
+ }
+
+ memberService.deleteByTeamId(teamId);
+ variableService.deleteByTeamId(teamId);
Review Comment:
Delete the variables created under the team directly without reminding the
user. I am worried that this will cause trouble to the user's operation. I
suggest that before deleting, if any variable under the team, we can ask the
user whether to confirm the deletion, After get the user's confirmation then
delete the operation, may be a better way
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]