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

   ### Which Issue(s) This PR Fixes
   
   - Fixes #6674
   
   ### Brief Description
   
   The 服务端查询历史 drawer printed the stored query mode as its wire code: the 类型 
column showed `TOPIC` / `KEY` /
   `MSG_ID` while the mode selector directly above it names the same three 
values 按 Topic 查询 / 按 Message Key /
   按 Message ID (Query by Topic / Query by Message Key / Query by Message ID in 
English). The drawer therefore
   disagreed with the control that produced every row, and an operator reading 
the history had to decode `MSG_ID`.
   
   - `web/src/components/MessageQueryHistoryDrawer.tsx` resolves the three 
codes through the selector's existing
     dictionary entries (`messagePage.queryMode.topic|key|msgid`), so no new UI 
text is introduced and the two
     surfaces name the same value the same way. A mode without a mapping is 
still printed unchanged rather than
     hidden, so a future mode stays visible.
   - The filter parameters sent to `/api/query-history/messages` are untouched 
— the API's wire values stay
     `TOPIC | KEY | MSG_ID`, only the cell rendering changed.
   
   ### How Did You Test This Change?
   
   Red first, on the current `rocketmq-studio` tip (e2f815fb), with the added 
test in place and only the component
   reverted:
   
   ```
   $ cd web && npx vitest run 
src/components/__tests__/MessageQueryHistoryDrawer.test.tsx --maxWorkers=1
    × renders query history drawer copy in English mode
      TestingLibraryElementError: Unable to find an element with the text: 
Query by Message Key.
    × names the recorded query mode instead of printing its wire code
      TestingLibraryElementError: Unable to find an element with the text: 按 
Message Key.
    Test Files  1 failed (1)
         Tests  2 failed | 5 passed (7)
   ```
   
   Green with the change:
   
   ```
   $ cd web && npx vitest run 
src/components/__tests__/MessageQueryHistoryDrawer.test.tsx --maxWorkers=1
    Test Files  1 passed (1)
         Tests  7 passed (7)
   $ npx tsc -b
     (clean)
   $ npx eslint src/components/MessageQueryHistoryDrawer.tsx 
src/components/__tests__/MessageQueryHistoryDrawer.test.tsx
     (0 problems)
   $ npx prettier --check src/components/MessageQueryHistoryDrawer.tsx 
src/components/__tests__/MessageQueryHistoryDrawer.test.tsx
    All matched files use Prettier code style!
   ```
   
   Against a running stack (this commit + MySQL + a 5.3.2 broker), with four 
rows already recorded, the 类型 column
   of the message-queries table reads:
   
   | before | after |
   | --- | --- |
   | `KEY`, `TOPIC`, `TOPIC`, `KEY` | 按 Message Key, 按 Topic 查询, 按 Topic 查询, 按 
Message Key |
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`fix(web): ...`)
   - [x] Tests added or updated for non-trivial changes — the existing 
English-mode case now pins the English
         label and a new case pins the Chinese one together with the absence of 
the raw code
   - [x] New UI text has both Chinese and English entries under `web/src/i18n/` 
— no new text; the three selector
         entries are reused
   - [x] Architecture constraints stay green — no Java/backend change, so the 
ArchUnit checks are untouched
   - [x] New source files carry the ASF license header — no new files
   - [x] Documentation touched where behaviour changed — not applicable; the 
column shows the same value under a
         name instead of a code
   
   Disclosed rather than left to be discovered on merge, because these open PRs 
touch the same component:
   
   - #5156 (feat: manage query history), #5586 (keyboard-operable mouse-only 
affordances) and #5790 (recover
     pagination when result totals shrink) all edit 
`MessageQueryHistoryDrawer.tsx`; this change touches only the
     type cell's `render`, so whichever merges second may need a small rebase.
   - #6583 is a backend test for the history VO and does not touch this file.
   
   AI assistance: the analysis, the change and the tests were produced with AI 
assistance (an agent working in this
   repository) and reviewed by me before submission; the verification output 
above is from the actual runs.
   


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