Repository navigation
feat(topic): edit topic configuration from the topic page - #4249
unbridled-41 wants to merge 1 commit into
Conversation
The classic dashboard exposes a per-row CONFIG action that reopens the topic dialog in update mode (name and type fixed, queue counts, perm and remark editable). Studio's server side already implements the update API for Apache, Aliyun and Tencent providers and its own api-spec documents POST /api/topics/update, but the service wrapper has no caller — the topic page only offers detail, send and delete. Reuse the create dialog in edit mode: a 配置 row action prefills the saved values, disables name and type like the classic dialog, submits through topicService.updateTopic with the selected instance, and reloads the server-paged list. Cloud instances keep the create dialog's vendor gating, so their edit is remark-only, matching what the Aliyun/Tencent providers accept. Fixes apache#4248.
Verification evidenceCI: head Red (baseline
Green (module run):
Full suite + baseline comparison:
Build: Diff self-check ( |
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Wires the existing updateTopic backend endpoint to a new "配置" row action on the topic page, reusing the create dialog in edit mode with name/type disabled — matching classic dashboard semantics.
The implementation is clean and well-tested:
- Proper state management with
editingTopicto distinguish create vs edit - Form fields correctly disabled based on mode
- State reset on cancel/switch prevents stale data
- Three test cases covering update flow, cloud vendor gating, and state isolation
LGTM.
Automated review by github-manager-bot
#4331) Incorporates ten related front-end fixes from the same author: - #4175 render the rule last-triggered time as UTC - #4189 keep the selected range when the metrics instance changes - #4245 reload the paginated group list after creating groups - #4249 edit topic configuration from the topic page - #4254 reset the silence form when the maintenance dialog is dismissed - #4263 export users against the committed search term - #4265 re-run the custom query when the dashboard instance changes - #4283 reset the queue browser pull indicators when the queue list reloads - #4285 surface the validation reason when a silence cannot be built - #4322 invalidate the in-flight connection query when the topic changes
|
Merged as part of #4331 — squashed into Your change here (editing topic configuration from the topic page) is included. One adjustment was needed on top of your patch: the action column now renders four buttons but still declared We grouped 11 of your related front-end fixes into a single commit so the history stays reviewable; the other PRs in the group are closed with the same note. Everything was cherry-picked onto the current baseline with you kept as the author, and your tests came along with the change. Thanks for the consistently well-tested patches. |
Fixes #4248.
Source
masterof this repo): the topic list's row action "Topic CONFIG" (frontend-new/src/pages/Topic/topic.jsx:498-500) opensTopicModifyDialogin update mode (frontend-new/src/components/topic/TopicModifyDialog.jsx,bIsUpdate) — name and message type are disabled while write/read queue counts and perm stay editable, submitted viacreateOrUpdateTopic(frontend-new/src/api/remoteApi/remoteApi.js:674). Verified withgit show master:....POST /api/topics/updateis documented in the project's own API reference (docs/api-spec.md§5.4), implemented for all three providers (ApacheInstanceProvider.updateTopic→RocketMQAdminClientImpl.updateTopic, plusAliyunInstanceProvider/TencentInstanceProvider), and the web service wrappertopicService.updateTopicexists with demo-mode support — butgit grep updateTopic -- web/srcshows no page ever calls it.RocketMQAdminClientImpl.updateTopiceven comments on preserving values "on partial updates (e.g. perm or remark only)", written for update callers that never arrived in the UI.Current gap
Studio's topic page row actions are detail / send / delete only. Resizing queues, tightening permission (RW → RO/WO) or fixing a remark requires CLI access, while the whole backend path for it already exists.
Project fit
Scope
Included: a 配置 row action opening the create dialog in edit mode (prefilled, name/type disabled per classic semantics), submit through
updateTopicwith the selected instance id, server-page reload, success/error feedback, and a state reset that keeps the create flow independent.Not included: per-broker queue editing (Studio updates the topic through the provider API, not per broker), message-type changes (classic also disables them on update), AI tool surface changes, new server endpoints.
Implementation
web/src/pages/instance/topic.tsx:editingTopicstate;openEditConfigprefills the form and opens the shared dialog;handleCreatebranches totopicService.updateTopicwhen editing; modal title/okText switch (编辑 Topic / 保存); name input and type Segmented disabled in edit mode; the toolbar create button and dialog cancel cleareditingTopicso the create flow can never submit an update; 配置 row button (all vendors, mirroring the server-side provider support).web/src/pages/instance/__tests__/TopicPage.test.tsx(3 new cases).Tests
Red first (feature absent on baseline
6c24d2ed):npx vitest run src/pages/instance/__tests__/TopicPage.test.tsx -t "topic"→Tests 2 failed | 13 passed | 11 skipped (26): both new edit cases failed atgetByRole('button', { name: /配\s*置/ })(no such row button on baseline).-t "clean create dialog"→Tests 1 failed | 25 skipped (26)(same missing action).Green after the change:
npx vitest run src/pages/instance/__tests__/TopicPage.test.tsx→Test Files 1 passed (1),Tests 26 passed (26)(23 pre-existing + 3 new: edit submit reloads the server page withupdateTopiccalled with the changed queues/perm; cloud edit hides broker-only fields and submits remark-only; a cancelled edit leaves a clean create dialog —updateTopicnot called).npx vitest run: 984 tests, 8 failures / 7 files — 6 failures in files untouched by this change (MetricsExplorer, ClientsPage, ClusterPage, MessagePage, AuditPage, NotificationDeliveriesPage — the documented load-flaky family) and 2 in TopicPage; TopicPage re-run in isolation right after:Tests 26 passed (26)(the full run executed concurrently withnpm run build, the same overload pattern recorded in previous rounds).npx tsc --noEmitclean; eslint clean on both touched files;npm run build✓ (built in 1m 21s). No backend changes — the update endpoint was already tested server-side.Compatibility & Risk
UpdateTopicDTO(cloud payloads omit queue/perm fields; the Apache provider preserves unset values) — the exact path its own comments were written for.feat/topic-config-editoffrocketmq-studio@ 6c24d2e).