You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@airavata.apache.org by "lahirujayathilake (via GitHub)" <gi...@apache.org> on 2025/02/25 18:58:35 UTC
Re: [PR] Added pagination feature [airavata-data-catalog]
lahirujayathilake commented on code in PR #47:
URL: https://github.com/apache/airavata-data-catalog/pull/47#discussion_r1970362691
##########
data-catalog-api/server/service/src/main/java/org/apache/airavata/datacatalog/api/service/DataCatalogAPIService.java:
##########
@@ -194,20 +194,53 @@ public void searchDataProducts(DataProductSearchRequest request,
StreamObserver<DataProductSearchResponse> responseObserver) {
try {
+ // takeout all the DataProduct
MetadataSchemaQueryResult searchResult = dataCatalogService.searchDataProducts(request.getUserInfo(),
request.getSql());
- List<DataProduct> dataProducts = searchResult.dataProducts();
- responseObserver.onNext(DataProductSearchResponse.newBuilder().addAllDataProducts(dataProducts).build());
+ List<DataProduct> allDataProducts = searchResult.dataProducts();
+
+ // if the frontend did not specifyp page / page_size,page=1,page_size=20
+ int page = request.getPage();
+ if (page <= 0) {
+ page = 1;
+ }
Review Comment:
You can update the similar way for the other occurrences too
##########
data-catalog-api/server/service/src/main/java/org/apache/airavata/datacatalog/api/service/DataCatalogAPIService.java:
##########
@@ -194,20 +194,53 @@ public void searchDataProducts(DataProductSearchRequest request,
StreamObserver<DataProductSearchResponse> responseObserver) {
try {
+ // takeout all the DataProduct
MetadataSchemaQueryResult searchResult = dataCatalogService.searchDataProducts(request.getUserInfo(),
request.getSql());
- List<DataProduct> dataProducts = searchResult.dataProducts();
- responseObserver.onNext(DataProductSearchResponse.newBuilder().addAllDataProducts(dataProducts).build());
+ List<DataProduct> allDataProducts = searchResult.dataProducts();
+
+ // if the frontend did not specifyp page / page_size,page=1,page_size=20
+ int page = request.getPage();
+ if (page <= 0) {
+ page = 1;
+ }
Review Comment:
you can simplify this
`int page = request.getPage() > 0 ? page : 1`
--
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: issues-unsubscribe@airavata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org