yyqdbngt opened a new pull request, #2871:
URL: https://github.com/apache/rocketmq-dashboard/pull/2871
## Summary
- Make the cluster overview page's shared `searchText` normalizer trim user
input in addition to being null-safe and lower-casing it
(`pages/cluster/index.tsx`).
- Export `searchText` for unit coverage and add regression tests:
- new unit suite `pages/cluster/clusterSearchText.test.ts` (trim / empty /
whitespace-only / null / undefined input);
- new page-level test in `ClusterPage.test.tsx`: submitting a
whitespace-only broker search keeps all broker rows visible.
## Why
The broker / NameServer / Proxy panels all use `Input.Search` with
`onSearch`, so a submission of only spaces previously produced a non-empty
normalized keyword. Since `"".includes(" ")` is `false` for every row, a
whitespace-only search silently hid the entire table until the user cleared the
box. The certs and clients pages already trim their search input; the overview
page was the remaining outlier in the cluster domain.
## Testing
- `cd web && ./node_modules/.bin/vitest run
src/pages/cluster/clusterSearchText.test.ts
src/pages/cluster/__tests__/ClusterPage.test.tsx` — 2 files, 24 tests passed (3
new unit tests, 1 new page-level regression test; all pre-existing tests still
pass).
- `cd web && ./node_modules/.bin/tsc --noEmit` — clean.
- `cd web && ./node_modules/.bin/eslint src/pages/cluster/index.tsx
src/pages/cluster/clusterSearchText.test.ts
src/pages/cluster/__tests__/ClusterPage.test.tsx` — 0 errors (1 react-refresh
warning for the exported helper, same precedent as other page-level helper
exports).
--
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]