chunhai1127 opened a new issue, #669:
URL: https://github.com/apache/rocketmq-dashboard/issues/669

   **BUG REPORT**
   
   1. Please describe the issue you observed:
   
   - What did you do (The steps to reproduce)?
   
     1. Deploy rocketmq-dashboard 2.1.0 (docker image 
`apacherocketmq/rocketmq-dashboard:2.1.0`).
     2. Connect it to a RocketMQ 4.x cluster (or any cluster whose topics 
report `UNSPECIFIED` message type, e.g. 5.x topics created without message type 
attributes).
     3. Open the Topic page.
   
   - What did you expect to see?
   
     The topic list renders all topics of the cluster.
   
   - What did you see instead?
   
     The topic table is empty, while the backend API 
`/topic/list.queryTopicType` returns the full data (`{status:0, 
data:{topicNameList, messageTypeList}}`). Ticking the `UNSPECIFIED` checkbox in 
the type filter makes all topics appear immediately.
   
   2. Please tell us about your environment:
   
     - rocketmq-dashboard 2.1.0 (docker image 
`apacherocketmq/rocketmq-dashboard:2.1.0`, deployed on Kubernetes)
     - RocketMQ 4.x cluster (all topics have messageType `UNSPECIFIED` / 
`RETRY` / `DLQ` / `SYSTEM`)
     - The same problem exists on the current master branch 
(`frontend-new/src/pages/Topic/topic.jsx` is identical)
   
   3. Other information (e.g. detailed explanation, logs, related issues, 
suggestions how to fix, etc):
   
     Root cause: in `frontend-new/src/pages/Topic/topic.jsx`, the `rmqVersion` 
state is hardcoded to `true` and `setRmqVersion` is never called anywhere, so 
the fallback branch for 4.x clusters is dead code:
   
     ```js
     const [rmqVersion, setRmqVersion] = useState(true);  // setRmqVersion is 
never called
   
     const filterByType = (topic, type) => {
         ...
         if (filterNormal && type.includes("NORMAL")) return true;              
// the only way out with the default filter
         if (!rmqVersion && filterNormal && type.includes("UNSPECIFIED")) 
return true;  // dead code: rmqVersion is always true
         ...
     };
     ```
   
     By default only the `NORMAL` checkbox is ticked, so every topic whose 
messageType is `UNSPECIFIED` (i.e. all normal topics on 4.x clusters) is 
filtered out and the page shows nothing.
   
     Suggested fix: treat `UNSPECIFIED` as `NORMAL` in `filterByType`:
   
     ```diff
     -        if (filterNormal && type.includes("NORMAL")) return true;
     -        if (!rmqVersion && filterNormal && type.includes("UNSPECIFIED")) 
return true;
     +        // UNSPECIFIED is treated as NORMAL (topics on 4.x clusters or 
without message type attributes)
     +        if (filterNormal && (type.includes("NORMAL") || 
type.includes("UNSPECIFIED"))) return true;
     ```
   
     I will submit a PR to fix this.
   


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