Kris20030907 commented on code in PR #7364:
URL:
https://github.com/apache/rocketmq-dashboard/pull/7364#discussion_r4388191998
##########
web/src/pages/instance/topic.tsx:
##########
@@ -669,26 +670,59 @@ const TopicPageContent = ({
sendForm.setFieldsValue({ topic: topic.name, tag: '', key: '', body: '',
properties: [] });
setSendModalOpen(true);
} else if (key === 'delete') {
- modal.confirm({
- title: '确认删除',
- content: `确定要删除 Topic「${topic.name}」吗?此操作不可撤销。`,
- okText: '删除',
- okType: 'danger',
- cancelText: '取消',
- onOk: async () => {
- try {
- await deleteTopic(topic.name, selectedInstanceId || undefined);
- // Drop the deleted row from the selection: a checked row that
disappears would
- // otherwise keep the batch delete armed with a name that no
longer exists, and its
- // failure path re-seeds that same selection - leaving nothing to
uncheck.
- setSelectedRowKeys((previous) => previous.filter((key) => key !==
topic.name));
- await reloadTopicPage();
- message.success(`Topic「${topic.name}」已删除`);
- } catch {
- message.error('删除 Topic 失败,请稍后重试');
- }
- },
- });
+ const openDeleteConfirm = (liteSummary: LiteTopicItem | undefined) => {
+ modal.confirm({
+ title: '确认删除',
Review Comment:
Thanks for the careful review! All three notes are addressed in 32aebb91.
**1. Batch warning count (the bug):** agreed the count must not come from a
filtered
projection of the selection. One nuance from tracing it: the
search/type/instance/
pagination handlers all clear the selection on scope change (pinned by
"clears
selected topics when the search scope changes"), so a filtered-out selection
can't
occur today. But the same class of bug is reachable another way: a reload
after a
create, CSV import or single delete reshuffles the server-paginated rows and
can push
a checked Lite parent off the current page while its name stays selected —
and the
batch delete submits every selected name. Counting from `topics` would still
miss
those rows, so the count now comes from the type recorded when each row was
checked.
Red test included: the warning still fires for a selected parent that fell
out of the
page.
**2. Stale counts in the LiteTopic delete dialog:** fixed — the dialog now
re-queries
`queryLiteTopicList` when it opens, mirroring the topic page, and falls back
to the
row counts if the lookup fails (the delete is never blocked).
**3. Hardcoded confirm strings (non-blocking):** extracted the single and
batch delete
dialogs (titles, content, ok/cancel, success/error) to `translations.ts`;
the Chinese
strings are unchanged. Reused the existing `topic.deleteContent` key, which
already
had exactly that text.
Suites for both touched pages pass (90 tests), plus the i18n key-consistency
tests and
`tsc -b`.
--
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]