yyqdbngt opened a new pull request, #5344:
URL: https://github.com/apache/rocketmq-dashboard/pull/5344

   ### Which Issue(s) This PR Fixes
   
   - Fixes #5268
   
   ### Brief Description
   
   Documentation only - the deliverable is the corrected API list in
   `docs/studio-native-alerting-design.md`, so there is no test to add and no 
red/green run.
   The evidence is the implementation the list is checked against, quoted below.
   
   **Rules.** `AlertRuleController` maps both prefixes and has no `PUT` mapping 
at all; the
   mutations are `POST` actions and `test` takes the rule body, not an `{id}`:
   
   ```java
   @RequestMapping({"/api/alert-rules", "/api/business-alert-rules"})
   public class AlertRuleController {
       @GetMapping                 public Result<List<AlertRuleVO>> 
listRules(...)
       @GetMapping("/page")        public Result<PageResult<AlertRuleVO>> 
listRulesPage(...)
       @PostMapping("/create")     public Result<AlertRuleVO> createRule(...)
       @PostMapping("/update")     public Result<AlertRuleVO> updateRule(...)   
// id inside the body
       @PostMapping("/test")       public Result<AlertRuleTestResultVO> 
testRule(...)
   ```
   
   `ClusterAlertRuleController` (`/api/cluster-alert-rules`) has the same 
shape. The web client
   agrees, and is what the documented list is read by:
   
   ```ts
   // web/src/api/ops.ts
   const alertRulePath = (domain: AlertRuleDomain) =>
     domain === 'BUSINESS' ? '/business-alert-rules' : '/cluster-alert-rules';
   // web/src/api/ops.test.ts
   mock.onGet('/business-alert-rules/page', { params: { page: 2, pageSize: 10, 
search: 'lag' } })
   mock.onPost('/cluster-alert-rules/update').reply(...)
   ```
   
   **System alerts.** The documented `status`, `severity` and `page` parameters 
do not exist on
   the list endpoint and Spring ignores unknown request parameters silently, so 
a client
   following the old text would get unfiltered results:
   
   ```java
   @GetMapping
   public Result<List<SystemAlertVO>> listAlerts(
           @RequestParam(required = false) String level,
           @RequestParam(required = false) AlertDomain domain,
           @RequestParam(required = false) String instanceId,
           @RequestParam(required = false) String transition) { ... }
   
   @GetMapping("/page")   // paging, plus 
labelKey/labelValue/from/to/notificationSuppressed
   @PostMapping("/acknowledge")   // id travels in AcknowledgeSystemAlertDTO, 
not in the path
   ```
   
   ```ts
   // web/src/api/ops.ts - the id is in the body
   await client.post('/system-alerts/acknowledge', { id });
   ```
   
   **Metric catalog.** `NativeAlertMetricCatalogController` is 
`@RequestMapping("/api/native-alert-metrics")`
   with two *required* parameters, `instanceId` and `domain`; no controller in 
the tree maps
   `/api/alert-metric-catalog`.
   
   **Service name.** The section said both menus delegate to 
`AlertRuleService`, which exists
   nowhere in the tree; the field is `private final AlertService alertService;` 
in both rule
   controllers, and `ops/alert/AlertService.java` is the only such class. I 
corrected the
   name in the prose and in the component tree of the same document.
   
   ### How Did You Test This Change?
   
   Documentation-only: no test was added and no source file was touched, so 
there is no
   red -> green pair to show. Instead I ran the controller tests that already 
pin the mappings
   I documented, on the unmodified tree, so the code the document now describes 
is the code
   that passes today:
   
   ```
   $ cd server && mvn -B -ntp test 
-Dtest=SystemAlertControllerTest,AlertRuleControllerTest,ClusterAlertRuleControllerTest,AlertSilenceControllerTest
   [INFO] Tests run: 22, Failures: 0, Errors: 0, Skipped: 0 -- in 
AlertRuleControllerTest
   [INFO] Tests run: 2,  Failures: 0, Errors: 0, Skipped: 0 -- in 
AlertSilenceControllerTest
   [INFO] Tests run: 6,  Failures: 0, Errors: 0, Skipped: 0 -- in 
ClusterAlertRuleControllerTest
   [INFO] Tests run: 12, Failures: 0, Errors: 0, Skipped: 0 -- in 
SystemAlertControllerTest
   [INFO] Tests run: 42, Failures: 0, Errors: 0, Skipped: 0
   [INFO] BUILD SUCCESS
   ```
   
   `SystemAlertControllerTest` in particular drives `GET 
/api/system-alerts?level=`,
   `GET /api/system-alerts/page?...` and `POST /api/system-alerts/acknowledge` 
with a body,
   which is exactly the list this PR writes down.
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits
   - [ ] Tests added or updated for non-trivial changes - not applicable, docs 
only; the mappings are evidenced above and pinned by the existing controller 
tests
   - [ ] New UI text has both Chinese and English entries under `web/src/i18n/` 
- not applicable, no UI text
   - [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit 
checks) - no source file changed
   - [ ] New source files carry the ASF license header - no new file
   - [x] Documentation touched where behaviour changed (README / `docs/` / 
in-app help)
   


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

Reply via email to