Merge pull request #1320 from nkorange/feature_search_with_keyword_and_instances

Close #1319
This commit is contained in:
Fury Zhu 2019-06-04 15:21:35 +08:00 committed by GitHub
commit c97e216158
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -148,22 +148,24 @@ public class CatalogController {
String namespaceId = WebUtils.optional(request, CommonParams.NAMESPACE_ID,
Constants.DEFAULT_NAMESPACE_ID);
List<ServiceDetailInfo> serviceDetailInfoList = new ArrayList<>();
int pageNo = Integer.parseInt(WebUtils.required(request, "pageNo"));
int pageSize = Integer.parseInt(WebUtils.required(request, "pageSize"));
String keyword = WebUtils.optional(request, "keyword", StringUtils.EMPTY);
serviceManager
.getServiceMap(namespaceId)
.forEach(
(serviceName, service) -> {
List<Service> serviceList = new ArrayList<>(8);
serviceManager.getPagedService(namespaceId, pageNo, pageSize, keyword, StringUtils.EMPTY, serviceList);
ServiceDetailInfo serviceDetailInfo = new ServiceDetailInfo();
serviceDetailInfo.setServiceName(NamingUtils.getServiceName(serviceName));
serviceDetailInfo.setGroupName(NamingUtils.getGroupName(serviceName));
serviceDetailInfo.setMetadata(service.getMetadata());
for (Service service : serviceList) {
ServiceDetailInfo serviceDetailInfo = new ServiceDetailInfo();
serviceDetailInfo.setServiceName(NamingUtils.getServiceName(service.getName()));
serviceDetailInfo.setGroupName(NamingUtils.getGroupName(service.getName()));
serviceDetailInfo.setMetadata(service.getMetadata());
Map<String, ClusterInfo> clusterInfoMap = getStringClusterInfoMap(service);
serviceDetailInfo.setClusterMap(clusterInfoMap);
Map<String, ClusterInfo> clusterInfoMap = getStringClusterInfoMap(service);
serviceDetailInfo.setClusterMap(clusterInfoMap);
serviceDetailInfoList.add(serviceDetailInfo);
});
serviceDetailInfoList.add(serviceDetailInfo);
}
return serviceDetailInfoList;
} else {