ctripcorp / apollo

@@ -20,6 +20,8 @@
Loading
20 20
21 21
  private String operator;
22 22
23 +
  private String operatorPreferredUsername;
24 +
23 25
  private long releaseId;
24 26
25 27
  private String releaseTitle;
@@ -81,44 +83,28 @@
Loading
81 83
    this.branchName = branchName;
82 84
  }
83 85
84 -
  public long getReleaseId() {
85 -
    return releaseId;
86 -
  }
87 -
88 -
  public void setReleaseId(long releaseId) {
89 -
    this.releaseId = releaseId;
90 -
  }
91 -
92 -
  public long getPreviousReleaseId() {
93 -
    return previousReleaseId;
94 -
  }
95 -
96 -
  public void setPreviousReleaseId(long previousReleaseId) {
97 -
    this.previousReleaseId = previousReleaseId;
98 -
  }
99 -
100 -
  public int getOperation() {
101 -
    return operation;
86 +
  public String getOperator() {
87 +
    return operator;
102 88
  }
103 89
104 -
  public void setOperation(int operation) {
105 -
    this.operation = operation;
90 +
  public void setOperator(String operator) {
91 +
    this.operator = operator;
106 92
  }
107 93
108 -
  public Map<String, Object> getOperationContext() {
109 -
    return operationContext;
94 +
  public String getOperatorPreferredUsername() {
95 +
    return operatorPreferredUsername;
110 96
  }
111 97
112 -
  public void setOperationContext(Map<String, Object> operationContext) {
113 -
    this.operationContext = operationContext;
98 +
  public void setOperatorPreferredUsername(String operatorPreferredUsername) {
99 +
    this.operatorPreferredUsername = operatorPreferredUsername;
114 100
  }
115 101
116 -
  public String getOperator() {
117 -
    return operator;
102 +
  public long getReleaseId() {
103 +
    return releaseId;
118 104
  }
119 105
120 -
  public void setOperator(String operator) {
121 -
    this.operator = operator;
106 +
  public void setReleaseId(long releaseId) {
107 +
    this.releaseId = releaseId;
122 108
  }
123 109
124 110
  public String getReleaseTitle() {
@@ -169,4 +155,28 @@
Loading
169 155
  public void setReleaseAbandoned(boolean releaseAbandoned) {
170 156
    isReleaseAbandoned = releaseAbandoned;
171 157
  }
158 +
159 +
  public long getPreviousReleaseId() {
160 +
    return previousReleaseId;
161 +
  }
162 +
163 +
  public void setPreviousReleaseId(long previousReleaseId) {
164 +
    this.previousReleaseId = previousReleaseId;
165 +
  }
166 +
167 +
  public int getOperation() {
168 +
    return operation;
169 +
  }
170 +
171 +
  public void setOperation(int operation) {
172 +
    this.operation = operation;
173 +
  }
174 +
175 +
  public Map<String, Object> getOperationContext() {
176 +
    return operationContext;
177 +
  }
178 +
179 +
  public void setOperationContext(Map<String, Object> operationContext) {
180 +
    this.operationContext = operationContext;
181 +
  }
172 182
}

@@ -1,27 +1,38 @@
Loading
1 1
package com.ctrip.framework.apollo.portal.controller;
2 2
3 3
4 -
import com.ctrip.framework.apollo.portal.environment.Env;
5 4
import com.ctrip.framework.apollo.portal.component.PermissionValidator;
6 5
import com.ctrip.framework.apollo.portal.entity.bo.ReleaseHistoryBO;
6 +
import com.ctrip.framework.apollo.portal.environment.Env;
7 7
import com.ctrip.framework.apollo.portal.service.ReleaseHistoryService;
8 +
import com.ctrip.framework.apollo.portal.spi.UserService;
9 +
import org.springframework.util.CollectionUtils;
10 +
import org.springframework.util.StringUtils;
8 11
import org.springframework.web.bind.annotation.GetMapping;
9 12
import org.springframework.web.bind.annotation.PathVariable;
10 13
import org.springframework.web.bind.annotation.RequestParam;
11 14
import org.springframework.web.bind.annotation.RestController;
12 15
16 +
import java.util.ArrayList;
13 17
import java.util.Collections;
14 18
import java.util.List;
19 +
import java.util.Map;
20 +
import java.util.Set;
21 +
import java.util.stream.Collectors;
15 22
16 23
@RestController
17 24
public class ReleaseHistoryController {
18 25
19 26
  private final ReleaseHistoryService releaseHistoryService;
20 27
  private final PermissionValidator permissionValidator;
28 +
  private final UserService userService;
21 29
22 -
  public ReleaseHistoryController(final ReleaseHistoryService releaseHistoryService, final PermissionValidator permissionValidator) {
30 +
  public ReleaseHistoryController(final ReleaseHistoryService releaseHistoryService,
31 +
      final PermissionValidator permissionValidator,
32 +
      final UserService userService) {
23 33
    this.releaseHistoryService = releaseHistoryService;
24 34
    this.permissionValidator = permissionValidator;
35 +
    this.userService = userService;
25 36
  }
26 37
27 38
  @GetMapping("/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/releases/histories")
@@ -35,8 +46,29 @@
Loading
35 46
    if (permissionValidator.shouldHideConfigToCurrentUser(appId, env, namespaceName)) {
36 47
      return Collections.emptyList();
37 48
    }
38 -
39 -
   return releaseHistoryService.findNamespaceReleaseHistory(appId, Env.valueOf(env), clusterName ,namespaceName, page, size);
49 +
    List<ReleaseHistoryBO> releaseHistoryList = releaseHistoryService
50 +
        .findNamespaceReleaseHistory(appId, Env.valueOf(env), clusterName, namespaceName, page,
51 +
            size);
52 +
    if (CollectionUtils.isEmpty(releaseHistoryList)) {
53 +
      return Collections.emptyList();
54 +
    }
55 +
    Set<String> operatorIdSet = releaseHistoryList.stream()
56 +
        .map(ReleaseHistoryBO::getOperator)
57 +
        .collect(Collectors.toSet());
58 +
    Map<String, String> preferredUsernameMap = this.userService
59 +
        .findPreferredUsernameMapByUserIds(new ArrayList<>(operatorIdSet));
60 +
    if (CollectionUtils.isEmpty(preferredUsernameMap)) {
61 +
      return releaseHistoryList;
62 +
    }
63 +
    releaseHistoryList.forEach(releaseHistory -> {
64 +
      if (StringUtils.hasText(releaseHistory.getOperator())) {
65 +
        String preferredUsername = preferredUsernameMap.get(releaseHistory.getOperator());
66 +
        if (StringUtils.hasText(preferredUsername)) {
67 +
          releaseHistory.setOperatorPreferredUsername(preferredUsername);
68 +
        }
69 +
      }
70 +
    });
71 +
    return releaseHistoryList;
40 72
  }
41 73
42 74
}

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading