Frun1na opened a new issue, #6787: URL: https://github.com/apache/rocketmq-dashboard/issues/6787
### Before Creating the Bug Report - [x] I have searched the [open issues](https://github.com/apache/rocketmq-dashboard/issues) of this repository and believe that this is not a duplicate. - [x] This is a defect in RocketMQ Studio, not a usage question and not a defect in another Apache RocketMQ repository. - [x] I can reproduce this on the current `rocketmq-studio` branch, or I have stated the exact version I am running below. ### Studio Version branch: rocketmq-studio git commit id: a92c2314 deployed as: built from source (the web service module only, no server or web dev server running) ### Runtime Environment OS: Ubuntu on WSL2 (linux/amd64) MySQL: not applicable - the defect is in the web mock data source browser (for UI issues): not applicable - reproduced by a unit test against the mock branch ### Connected RocketMQ Cluster not applicable - no cluster is reached; the defect is that mock mode talks to the real backend instead of the demo data source ### Describe the Bug Four functions of `web/src/services/clusterService.ts` have no mock branch while every other call in the same file has one: `listNameserverRegistry` (:54), `createNameserverRegistry` (:58), `updateNameserverRegistry` (:67) and `deleteNameserverRegistry` (:77) call the API directly. There is no request interception layer (`web/src/mocks/` does not exist; `isMockMode()` only reads the Zustand store), so in mock-data mode these four calls leave the demo data source and go to the real backend. Two consequences, both reachable from the cluster page: 1. Read path: the NameServer registry tab loads through `loadNsRegistry` (`web/src/pages/cluster/index.tsx:239-247`), whose catch clears the failure to `[]` - with no backend reachable the demo shows "no registry entries", and with a backend reachable it shows the real registry, not demo data. 2. Write path: creating, editing or deleting a registry entry in the demo submits to the real backend and the real database, or fails with a request error when none is reachable. There is also a type-level part of the same drift: the page's create/edit payload carries `k8sId` (`web/src/pages/cluster/index.tsx:304-310`, the edit modal reads it back at :347) and both the API function and `CreateNameserverRegistryDTO` accept it, but the service's parameter type for the two mutations does not declare it, so the service cannot forward the field faithfully. ### Steps to Reproduce 1. Switch the app to mock data mode and open the cluster page's NameServer registry tab: the list request goes to `/api/nameservers` instead of the mock. 2. Create or edit an entry in that tab: the POST goes to `/api/nameservers/registry/create` (or `/update`) - the real backend, or a network error without one. 3. Or run the unit test: `cd web && npx vitest run src/services/clusterService.test.ts` - on `a92c2314` the two registry cases fail with `AxiosError: Network Error` and the stack points at `Module.listNameserverRegistry src/api/cluster.ts:267`. ### What Did You Expect to See? In mock-data mode the registry tab lists demo entries derived from the mock clusters, and create/update/delete mutate only the demo store, following the endpoint's rules (blank name, duplicate name and unknown id are refused with the endpoint's messages). ### What Did You See Instead? The demo data source has no registry at all: the read leaves mock mode (and its failure is rendered as an empty registry) and the three writes reach the real backend. ### Additional Context The fix derives a module-level demo registry from the `nameServers` the mock clusters already declare - no new fixture file - and adds the mock branches, following the certificate store pattern in the same file (`clusterService.ts:16-19`). A fix with regression tests follows in a pull request; it does not touch the load-failure state that #6090 changes. ### Are You Willing to Submit a Pull Request? - [x] Yes, I am willing to submit a pull request. -- 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]
