yuluo-yx commented on code in PR #2454:
URL: https://github.com/apache/hertzbeat/pull/2454#discussion_r1703687946
##########
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:
From the solution in the issue, this is one of the ways to solve the problem
🥲
--
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]