tomsun28 commented on code in PR #2454:
URL: https://github.com/apache/hertzbeat/pull/2454#discussion_r1703525285


##########
alerter/src/main/java/org/apache/hertzbeat/alert/controller/AlertDefinesController.java:
##########
@@ -61,7 +64,13 @@ public ResponseEntity<Message<Page<AlertDefine>>> 
getAlertDefines(
             @Parameter(description = "List current page", example = "0") 
@RequestParam(defaultValue = "0") int pageIndex,
             @Parameter(description = "Number of list pages", example = "8") 
@RequestParam(defaultValue = "8") int pageSize) {
         Page<AlertDefine> alertDefinePage = 
alertDefineService.getAlertDefines(ids, search, priority, sort, order, 
pageIndex, pageSize);
-        return ResponseEntity.ok(Message.success(alertDefinePage));
+
+        return  ResponseEntity.ok(Message.success(
+                new PageImpl<>(
+                        alertDefinePage.getContent(),
+                        PageRequest.of(pageIndex, pageSize, Sort.by(new 
Sort.Order(Sort.Direction.fromString(order), sort))),
+                        alertDefinePage.getTotalElements()))
+        );

Review Comment:
   Hi, it maybe caused by test cases or other reasons. I feel that we cannot 
repeat the construction like this.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to