Frun1na opened a new pull request, #6531:
URL: https://github.com/apache/rocketmq-dashboard/pull/6531
### Which Issue(s) This PR Fixes
- Fixes #6530
### Brief Description
Both delete flows on the consumer page ran their request inside
`Modal.confirm`'s `onOk` without
handling a rejection — deleting one group ("确认删除消费组",
`web/src/pages/instance/consumer.tsx:1086`) and the toolbar's batch delete
("确认批量删除", `:1527`).
antd awaits that promise, reports a rejection only through `console.error`
and leaves the dialog
open, so a failed request produced no message at all and the operator had to
click again to learn
anything; in the batch flow the request-level failure also skipped the
partial-result reporting that
sits below it.
Both handlers now catch and report through `common.operationFailed`, the key
the ACL deletes already
use, which keeps the page's own partial-result branch (`deleted`/`failed`)
untouched. The sibling
create confirm in this page and the topic, alert and instance deletes
already catch; the proxy
restart confirm in `cluster/index.tsx` has the same shape and is covered by
#5809, so it is not
touched here.
User-visible change: a consumer-group deletion whose request fails now shows
an error message and
leaves the row (and the batch selection) in place instead of failing
silently. No new copy is added.
### How Did You Test This Change?
```
$ cd web && npx eslint src/pages/instance/consumer.tsx
src/pages/instance/__tests__/ConsumerPage.test.tsx
# clean
$ cd web && npx prettier --check src/pages/instance/consumer.tsx
src/pages/instance/__tests__/ConsumerPage.test.tsx
# clean
$ cd web && npx vitest run
src/pages/instance/__tests__/ConsumerPage.test.tsx --maxWorkers=1
--fileParallelism=false
✓ src/pages/instance/__tests__/ConsumerPage.test.tsx (56 tests) 87.7s
✓ reports a failed consumer group deletion instead of swallowing it
✓ reports a failed batch deletion instead of swallowing it
✓ reloads the server page after deleting one consumer group
✓ keeps failed consumer groups selected after a partially successful
batch deletion
Test Files 1 passed (1)
Tests 56 passed (56)
$ cd web && npx tsc -b
# clean
```
The two new tests fail without the fix (this is the mutation check: the two
`try`/`catch` blocks are
removed, the tests are kept):
```
$ cd web && npx vitest run
src/pages/instance/__tests__/ConsumerPage.test.tsx --maxWorkers=1
--fileParallelism=false
FAIL src/pages/instance/__tests__/ConsumerPage.test.tsx > Consumer page >
reports a failed consumer group deletion instead of swallowing it
AssertionError: expected "Mock" to be called with arguments: [ '操作失败' ]
FAIL src/pages/instance/__tests__/ConsumerPage.test.tsx > Consumer page >
reports a failed batch deletion instead of swallowing it
AssertionError: expected "Mock" to be called with arguments: [ '操作失败' ]
⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯
Error: delete failed
Test Files 1 failed (1)
Tests 2 failed | 54 passed (56)
Errors 2 errors
```
The assertions are the error text the fix emits plus the row and the batch
selection remaining (the
failed batch must not clear the selection), and the unhandled rejections
disappear with the fix;
the existing delete, partial-deletion and reload cases pin that both flows
still work on success.
### 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]