Remove unnecessary code
This commit is contained in:
parent
8d2711ae60
commit
d9d79dd21c
@ -151,10 +151,9 @@ public class CatalogController {
|
|||||||
int pageNo = Integer.parseInt(WebUtils.required(request, "pageNo"));
|
int pageNo = Integer.parseInt(WebUtils.required(request, "pageNo"));
|
||||||
int pageSize = Integer.parseInt(WebUtils.required(request, "pageSize"));
|
int pageSize = Integer.parseInt(WebUtils.required(request, "pageSize"));
|
||||||
String serviceName = WebUtils.optional(request, "serviceName", StringUtils.EMPTY);
|
String serviceName = WebUtils.optional(request, "serviceName", StringUtils.EMPTY);
|
||||||
String groupName = WebUtils.optional(request, "groupName", StringUtils.EMPTY);
|
|
||||||
|
|
||||||
List<Service> serviceList = new ArrayList<>(8);
|
List<Service> serviceList = new ArrayList<>(8);
|
||||||
serviceManager.getPagedService(namespaceId, pageNo, pageSize, serviceName, groupName, StringUtils.EMPTY, serviceList, false);
|
serviceManager.getPagedService(namespaceId, pageNo, pageSize, serviceName, StringUtils.EMPTY, serviceList, false);
|
||||||
|
|
||||||
for (Service service : serviceList) {
|
for (Service service : serviceList) {
|
||||||
ServiceDetailInfo serviceDetailInfo = new ServiceDetailInfo();
|
ServiceDetailInfo serviceDetailInfo = new ServiceDetailInfo();
|
||||||
@ -259,12 +258,11 @@ public class CatalogController {
|
|||||||
int page = Integer.parseInt(WebUtils.required(request, "pageNo"));
|
int page = Integer.parseInt(WebUtils.required(request, "pageNo"));
|
||||||
int pageSize = Integer.parseInt(WebUtils.required(request, "pageSize"));
|
int pageSize = Integer.parseInt(WebUtils.required(request, "pageSize"));
|
||||||
String serviceName = WebUtils.optional(request, "serviceName", StringUtils.EMPTY);
|
String serviceName = WebUtils.optional(request, "serviceName", StringUtils.EMPTY);
|
||||||
String groupName = WebUtils.optional(request, "groupName", StringUtils.EMPTY);
|
|
||||||
String containedInstance = WebUtils.optional(request, "instance", StringUtils.EMPTY);
|
String containedInstance = WebUtils.optional(request, "instance", StringUtils.EMPTY);
|
||||||
boolean hasIpCount = Boolean.parseBoolean(WebUtils.optional(request, "hasIpCount", "false"));
|
boolean hasIpCount = Boolean.parseBoolean(WebUtils.optional(request, "hasIpCount", "false"));
|
||||||
|
|
||||||
List<Service> services = new ArrayList<>();
|
List<Service> services = new ArrayList<>();
|
||||||
int total = serviceManager.getPagedService(namespaceId, page - 1, pageSize, serviceName, groupName, containedInstance, services, hasIpCount);
|
int total = serviceManager.getPagedService(namespaceId, page - 1, pageSize, serviceName, containedInstance, services, hasIpCount);
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(services)) {
|
if (CollectionUtils.isEmpty(services)) {
|
||||||
result.put("serviceList", Collections.emptyList());
|
result.put("serviceList", Collections.emptyList());
|
||||||
|
@ -676,7 +676,7 @@ public class ServiceManager implements RecordListener<Service> {
|
|||||||
return serviceMap.get(namespaceId);
|
return serviceMap.get(namespaceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPagedService(String namespaceId, int startPage, int pageSize, String serviceName, String groupName, String containedInstance, List<Service> serviceList, boolean hasIpCount) {
|
public int getPagedService(String namespaceId, int startPage, int pageSize, String serviceName, String containedInstance, List<Service> serviceList, boolean hasIpCount) {
|
||||||
|
|
||||||
List<Service> matchList;
|
List<Service> matchList;
|
||||||
|
|
||||||
@ -684,8 +684,8 @@ public class ServiceManager implements RecordListener<Service> {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(serviceName) || StringUtils.isNotBlank(groupName)) {
|
if (StringUtils.isNotBlank(serviceName)) {
|
||||||
matchList = searchServices(namespaceId, StringUtils.isNotBlank(serviceName) ? ".*" + serviceName + ".*" : null, groupName);
|
matchList = searchServices(namespaceId, ".*" + serviceName + ".*");
|
||||||
} else {
|
} else {
|
||||||
matchList = new ArrayList<>(chooseServiceMap(namespaceId).values());
|
matchList = new ArrayList<>(chooseServiceMap(namespaceId).values());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user