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

   ### Which Issue(s) This PR Fixes
   
   - Fixes #6140
   
   ### Brief Description
   
   Both TPS columns on the broker/cluster page sorted a broker whose runtime 
stats are unavailable as the lowest
   value. The record keeps `tpsIn`/`tpsOut` as `null` for such a broker and the 
cells render `-`
   (`web/src/pages/studio/BrokerCluster.tsx:378-397`), but the sorter used 
`(a.tpsIn ?? -1) - (b.tpsIn ?? -1)`,
   so an ascending sort led with rows that have no measurement — they were 
presented as the lowest TPS.
   
   The sorter now uses a direction-aware key, so an unavailable value sorts 
after every measured one in both
   directions: this is the same rule `onlineInstancesSortValue` and 
`lagSortValue` follow on the consumer page
   (the latter fixed for the descending direction in #5902). User-visible 
change: sorting by TPS keeps the `-`
   rows at the end instead of presenting them as the smallest values. No 
user-facing copy changes.
   
   ### How Did You Test This Change?
   
   ```
   $ cd web && npx eslint src/pages/studio/BrokerCluster.tsx
   # clean
   
   $ cd web && npx prettier --check src/pages/studio/BrokerCluster.tsx
   # clean
   
   $ cd web && npx vitest related --run src/pages/studio/BrokerCluster.tsx 
--maxWorkers=1 --fileParallelism=false
    ✓ src/pages/studio/__tests__/BrokerCluster.test.tsx (17 tests) 10496ms
    ✓ src/pages/studio/__tests__/BrokerClusterInstanceScope.test.tsx (2 tests) 
1511ms
    ✓ src/App.test.tsx (10 tests) 469ms
    Test Files  3 passed (3)
         Tests  29 passed (29)
   
   $ cd web && npx tsc -b
   # clean
   ```
   
   The new test fails without the fix:
   
   ```
   $ cd web && npx vitest run src/pages/studio/__tests__/BrokerCluster.test.tsx
    FAIL src/pages/studio/__tests__/BrokerCluster.test.tsx > BrokerCluster Page 
> keeps a broker without runtime stats after the measured ones when sorting by 
TPS
    AssertionError: expected 1 to be greater than 2
     ❯ src/pages/studio/__tests__/BrokerCluster.test.tsx:217:29
    Test Files  1 failed (1)
         Tests  1 failed | 16 passed (17)
   ```
   
   (That run is `pages/studio/BrokerCluster.tsx` reverted and the test kept, 
which is also the mutation check; the
   case is green again once the fix is restored.)
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`feat:` / `fix:` / 
`refactor:` / `chore:` / `docs:` / `perf:`)
   - [x] Tests added or updated for non-trivial changes, test methods named 
`...Test`
   - [ ] 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
   - [ ] 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