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

   ## PR Info
   PR Number: PR-WEB-2
   Branch: pr-web-2-api (target repo: rocketmq-studio)
   Total changes: 8 files, +401 / -25 lines
   Commit sequence: feat → fix → test
   
   ## Objective
   1. Align frontend API request paths with actual backend controller endpoints 
(LoginController, ProxyController).
   2. Complete all placeholder TODO formatting utility functions in format.ts 
to fully functional implementations.
   
   ## Core File Changes
   | File | Modification Details |
   |------|----------------------|
   | auth.ts | Extend `LoginResponse` type: add `type` (ADMIN / ORDINARY) and 
`contextPath` fields; mark `token` and `role` as optional to support both 
session-based and JWT authentication. Update login API path from `/auth/login` 
to `/login/shturl.c` to match LoginController; add comment annotations for 
`/logout` and `/check` endpoints. |
   | instance.ts | Sync API paths with ProxyController: map `listInstances` to 
`/proxy/homePage.query`, `createInstance` to `/proxy/addProxyAddr.do`, 
`updateInstance` to `/proxy/updateProxyAddr.do`; add mapping comments 
referencing backend controllers. |
   | format.ts | Complete 6 placeholder TODO formatter utilities: <br>• 
formatDateTime: output `YYYY-MM-DD HH:mm:ss`<br>• formatDate: output 
`YYYY-MM-DD`<br>• formatBytes: base-1024 unit conversion<br>• formatNumber: 
thousand separator formatting<br>• formatDelay: bilingual human-readable 
duration (Chinese & English)<br>• formatPercent: percentage value formatting |
   | consumerService.ts | Adjust function export order: swap `getConsumerGroup` 
and `getConsumerProgress`; remove duplicate function declarations. |
   | aclService.ts | Supplement missing import statements. |
   | login/index.tsx | Adapt component logic for optional fields in 
LoginResponse: use fallback `data.token ?? ''` and `data.role ?? data.type`. |
   
   ## Build Fix Commit Changes
   1. Mark `token` and `role` optional inside LoginResponse to resolve TS2339 
missing property error.
   2. Delete duplicated `getConsumerGroup` definition in consumerService.ts to 
fix TS2323 / TS2393 duplicate identifier errors.
   
   ## Unit Test Coverage (34 total test cases)
   ### auth.test.ts (5 cases)
   1. Validate type structure of LoginRequest and LoginResponse
   2. Verify request parameters passed by login API function
   3. Validate invocation logic of logout function
   
   ### format.test.ts (29 cases)
   Full coverage for all formatting utilities:
   - formatDateTime: valid timestamp, invalid input, native Date object
   - formatDate standard date formatting
   - formatBytes: zero value, negative number, all binary unit tiers
   - formatNumber thousand separator formatting
   - formatDelay: mixed day/hour/minute/second durations for both Chinese and 
English locales
   - formatPercent percentage value formatting


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