unbridled-41 opened a new pull request, #4249:
URL: https://github.com/apache/rocketmq-dashboard/pull/4249

   Fixes #4248.
   
   ## Source
   
   - Parent project (classic dashboard, `master` of this repo): the topic 
list's row action "Topic CONFIG" 
(`frontend-new/src/pages/Topic/topic.jsx:498-500`) opens `TopicModifyDialog` in 
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 via `createOrUpdateTopic` 
(`frontend-new/src/api/remoteApi/remoteApi.js:674`). Verified with `git show 
master:...`.
   - In-repo evidence that this is an omission, not a design decision: `POST 
/api/topics/update` is documented in the project's own API reference 
(`docs/api-spec.md` §5.4), implemented for all three providers 
(`ApacheInstanceProvider.updateTopic` → `RocketMQAdminClientImpl.updateTopic`, 
plus `AliyunInstanceProvider` / `TencentInstanceProvider`), and the web service 
wrapper `topicService.updateTopic` exists with demo-mode support — but `git 
grep updateTopic -- web/src` shows **no page ever calls it**. 
`RocketMQAdminClientImpl.updateTopic` even 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
   
   - Zero new server code: this wires the UI to an endpoint the project already 
ships and documents.
   - Follows the established Studio pattern of reusing the create dialog for 
resource management (vendor gating, in-flight guard, server-page reload) rather 
than porting the classic per-broker dialog wholesale.
   - Cloud instances are covered honestly: the Aliyun/Tencent providers accept 
remark(-only) updates, so the edit dialog keeps the create dialog's vendor 
gating (no queue/perm fields for cloud), exactly matching what those APIs 
accept.
   
   ## Scope
   
   Included: a 配置 row action opening the create dialog in edit mode (prefilled, 
name/type disabled per classic semantics), submit through `updateTopic` with 
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`: `editingTopic` state; `openEditConfig` 
prefills the form and opens the shared dialog; `handleCreate` branches to 
`topicService.updateTopic` when editing; modal title/okText switch (编辑 Topic / 
保存); name input and type Segmented disabled in edit mode; the toolbar create 
button and dialog cancel clear `editingTopic` so the create flow can never 
submit an update; 配置 row button (all vendors, mirroring the server-side 
provider support).
   - Tests in `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 at `getByRole('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 with `updateTopic` called with the changed 
queues/perm; cloud edit hides broker-only fields and submits remark-only; a 
cancelled edit leaves a clean create dialog — `updateTopic` not called).
   - Full web `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 with 
`npm run build`, the same overload pattern recorded in previous rounds).
   - `npx tsc --noEmit` clean; 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
   
   - Additive UI only; no API or data-model changes. Users of the existing 
create dialog see identical behavior (title, OK label and validation unchanged 
in create mode).
   - The update call relies on the existing partial-update semantics of 
`UpdateTopicDTO` (cloud payloads omit queue/perm fields; the Apache provider 
preserves unset values) — the exact path its own comments were written for.
   - Head: 3696930d (single commit, branch `feat/topic-config-edit` off 
`rocketmq-studio` @ 6c24d2ed).
   
   


-- 
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]

Reply via email to