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

   ### Which Issue(s) This PR Fixes
   
   - Fixes #5259
   
   ### Brief Description
   
   The subscription tables on the consumer page still matched `filterMode` 
against the pre-#3349
   display strings (`全量` / `Tag 过滤` / `SQL92 过滤`), while the API has long since 
normalized
   the broker expression types to `TAG` / `SQL` / `CLASS_FILTER`. Every row 
therefore missed the color
   map and echoed the raw code into the table:
   
   ```tsx
   const colorMap: Record<string, string> = {
     全量: 'default',
     'Tag 过滤': 'blue',
     'SQL92 过滤': 'purple',
   };
   return <Tag color={colorMap[mode] || 'default'}>{mode}</Tag>;   // mode === 
'TAG' | 'SQL' | 'CLASS_FILTER'
   ```
   
   The i18n keys for the labels already existed (`consumer.filterTag`, 
`consumer.filterSql92`) but were
   never referenced. This maps the three API values to those labels, adds a
   `consumer.filterClassFilter` entry for the third value, and keeps unknown 
values visible as-is.
   
   **Review follow-up (all four blocking items addressed):**
   
   1. **Tencent normalization is now part of this PR.** 
`TencentInstanceProvider` was the third
      producer of `filterMode` and bypassed the helper: it built the value 
directly from
      `subscription.getExpressionType()`, so a Tencent SQL subscription still 
reached the table as the
      raw string `SQL92`. `toSubscriptionEntry` now routes through
      `SubscriptionFilterModes.fromExpressionType` and a provider test pins the 
mapping (`SQL92` →
      `type=SQL92`, `filterMode=SQL`). The helper's javadoc now says "Apache, 
Aliyun and Tencent".
      The description's original "both providers have normalized" claim was 
wrong — there are three
      producers, and this PR now normalizes all three, so the title no longer 
says `fix(web)`.
   2. **§6.4 `type` row corrected.** All three producers set `type` from the 
expression type
      (`sd.getExpressionType()` / `data.getFilterExpressionType()` /
      `subscription.getExpressionType()`), not from a message type. The row now 
documents
      `TAG` / `SQL92` / `CLASS_FILTER` and says the value is passed through 
as-is.
   3. **`consistency` value domain widened.** Apache emits `consistent` or 
`null`; Aliyun and Tencent
      emit `String.valueOf(<vendor consistency value>)` (e.g. Aliyun sends 
`true` / `false`). The row
      now documents both, instead of swapping an incorrect domain for an 
incomplete one.
   4. **Mock fixtures migrated.** `web/src/mock/consumers.ts` typed 
`filterMode` as the pre-#3349
      display strings and carried `consistency: '一致'` rows. The union types and 
all fixture rows now
      use the API values (`TAG` / `SQL` / `CLASS_FILTER`, `consistent` / 
`inconsistent`), and the
      fixture `type` values follow the expression-type domain too, so mock mode 
no longer degrades the
      tag colors. The same migration was applied to the subscription fixtures 
inside
      `ConsumerPage.test.tsx`, which had been mocking the old contract.
   
   `consumer.filterAll` remains unreferenced on purpose (it was already 
unreferenced on trunk; left
   for a separate cleanup).
   
   ### How Did You Test This Change?
   
   ```
   $ mvn -B -ntp test 
-Dtest='TencentInstanceProviderTest#getGroupProgressAndSubscriptionsShouldMapSubscriptionDataTest'
 -Dspring.profiles.active=dev
   # before the fix: expected: "SQL" but was: "SQL92"  (mutation-sensitive, 
fails on base)
   # after the fix:  Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
   
   $ npx vitest run src/pages/instance/__tests__/ConsumerPage.test.tsx
    Test Files  1 passed (1)
         Tests  37 passed (37)
   
   $ npx vitest run src/services/consumerService.test.ts
    Test Files  1 passed (1)
         Tests  17 passed (17)
   
   $ npx tsc --noEmit            # no output, exit 0
   $ npx eslint src/mock/consumers.ts 
src/pages/instance/__tests__/ConsumerPage.test.tsx
   # no findings
   ```
   
   The new provider test asserts the Tencent mapping (`type` keeps the raw 
`SQL92`, `filterMode`
   becomes `SQL`) and fails on the base revision with `expected: "SQL" but was: 
"SQL92"`. The
   ConsumerPage suite covers the label rendering (added earlier in this PR) and 
the migrated fixtures.
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`fix:`)
   - [x] Tests added or updated for non-trivial changes, test methods named 
`...Test`
   - [x] New UI text has both Chinese and English entries under `web/src/i18n/`
   - [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit 
checks)
   - [ ] New source files carry the ASF license header
   - [x] Documentation touched where behaviour changed (README / `docs/` / 
in-app help)
   
   ---
   
   Re-submission of #4732: the original PR was closed by the stale bot after 7 
days without review activity, and GitHub now rejects reopening pull requests in 
this repository ("state cannot be changed"), so the same change is re-submitted 
rebased onto the current `rocketmq-studio` tip (`a460673f`). The original 
review thread stays available at #4732.
   


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