Skip to content

[ISSUE #886] Export filtered topics as CSV - #887

Closed
Aias00 wants to merge 1 commit into
apache:rocketmq-studiofrom
Aias00:fix/studio-topic-export-csv-886
Closed

[ISSUE #886] Export filtered topics as CSV#887
Aias00 wants to merge 1 commit into
apache:rocketmq-studiofrom
Aias00:fix/studio-topic-export-csv-886

Conversation

@Aias00

@Aias00 Aias00 commented Aug 3, 2026

Copy link
Copy Markdown

Summary

  • replace the Topic export success-only toast with a real CSV download
  • export the currently filtered Topic list with CSV escaping and formula-prefix protection
  • add regression coverage for filtered export behavior

Tests

  • npm test -- --run src/pages/instance/tests/TopicPage.test.tsx
  • npm run lint -- src/pages/instance/topic.tsx src/pages/instance/tests/TopicPage.test.tsx
  • git diff --check

Closes #886

Copilot AI review requested due to automatic review settings August 3, 2026 23:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Not ready to approve

There are confirmed issues in the new CSV formula-injection protection consistency and the test’s global URL mocking configurability that can break other tests depending on execution order.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

This PR fixes Topic export on the Studio Topic management page by generating and downloading a real CSV file for the currently filtered Topic list, addressing Issue #886’s “success toast without artifact” problem.

Changes:

  • Add CSV column mapping, CSV escaping, and client-side download via Blob + URL.createObjectURL in the Topic page.
  • Update the export button to download the filtered Topic rows and keep the existing success toast.
  • Add a regression test ensuring export downloads only the filtered rows and validates CSV escaping / cleanup behavior.
File summaries
File Description
web/src/pages/instance/topic.tsx Implements CSV building + download for filtered Topic export.
web/src/pages/instance/tests/TopicPage.test.tsx Adds regression coverage validating filtered export + CSV escaping and download flow.
Review details

Suppressed comments (1)

web/src/pages/instance/tests/TopicPage.test.tsx:59

  • 同上:URL.revokeObjectURL 的 defineProperty 未设置 configurable:true,可能影响其他测试文件在同一 worker 中重新 mock。建议与其他测试保持一致显式设置 configurable:true。
  Object.defineProperty(URL, 'revokeObjectURL', {
    writable: true,
    value: vi.fn(),
  });
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment on lines +116 to +118
const text = value == null ? '' : String(value);
const formulaSafeText = /^[=+\-@]/.test(text) ? `'${text}` : text;
return `"${formulaSafeText.replace(/"/g, '""')}"`;
Comment on lines +52 to +55
Object.defineProperty(URL, 'createObjectURL', {
writable: true,
value: vi.fn(() => 'blob:topic-export'),
});
@Aias00

Aias00 commented Aug 4, 2026

Copy link
Copy Markdown
Author

Superseded by consolidated PR #927, which contains this change and has passing checks. Closing this narrower PR to keep review focused.

@Aias00 Aias00 closed this Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants