74 lines
2.1 KiB
Markdown
74 lines
2.1 KiB
Markdown
|
|
# Legacy Menu Code Navigation Implementation Plan
|
||
|
|
|
||
|
|
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||
|
|
|
||
|
|
**Goal:** Prevent legacy business menu codes from being rendered as artificial English parent menus.
|
||
|
|
|
||
|
|
**Architecture:** Keep the existing page-design navigation group builder, but
|
||
|
|
derive parent relationships only from explicit navigation metadata. Preserve
|
||
|
|
`menu_code` as the stable key for primary groups.
|
||
|
|
|
||
|
|
**Tech Stack:** Java 8, Apache Velocity, JUnit 4, Maven
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### Task 1: Add the regression test
|
||
|
|
|
||
|
|
**Files:**
|
||
|
|
- Test: `ruoyi-generator/src/test/java/com/ruoyi/generator/util/QingTemplateSupportTest.java`
|
||
|
|
|
||
|
|
- [ ] **Step 1: Write the failing test**
|
||
|
|
|
||
|
|
Create a frontend page design with:
|
||
|
|
|
||
|
|
```java
|
||
|
|
page.setPageCode("announcement_list_page");
|
||
|
|
page.setMenuCode("announcements");
|
||
|
|
page.setPageName("\u516c\u544a\u5217\u8868");
|
||
|
|
page.setLayoutJson("{\"canvas\":\"frontend-list-v1\",\"regions\":[]}");
|
||
|
|
```
|
||
|
|
|
||
|
|
Render `qing/vue-app.vue.vm` and assert that the page name is a clickable
|
||
|
|
primary menu, while `announcements` is not rendered as a directory.
|
||
|
|
|
||
|
|
- [ ] **Step 2: Run the test to verify it fails**
|
||
|
|
|
||
|
|
Run:
|
||
|
|
|
||
|
|
```text
|
||
|
|
mvn -pl ruoyi-generator -Dtest=QingTemplateSupportTest#qingPortalTreatsLegacyMenuCodeAsPrimaryMenu test
|
||
|
|
```
|
||
|
|
|
||
|
|
Expected: FAIL because the rendered application contains an
|
||
|
|
`announcements` directory.
|
||
|
|
|
||
|
|
### Task 2: Correct the hierarchy inference
|
||
|
|
|
||
|
|
**Files:**
|
||
|
|
- Modify: `ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java`
|
||
|
|
|
||
|
|
- [ ] **Step 1: Write the minimal implementation**
|
||
|
|
|
||
|
|
Change `pageDesignParentMenuCode` so it returns only the explicit
|
||
|
|
`navigation.parentMenuCode`. Do not infer parentage from `menu_code`.
|
||
|
|
|
||
|
|
- [ ] **Step 2: Run the regression test**
|
||
|
|
|
||
|
|
Run:
|
||
|
|
|
||
|
|
```text
|
||
|
|
mvn -pl ruoyi-generator -Dtest=QingTemplateSupportTest#qingPortalTreatsLegacyMenuCodeAsPrimaryMenu test
|
||
|
|
```
|
||
|
|
|
||
|
|
Expected: PASS.
|
||
|
|
|
||
|
|
- [ ] **Step 3: Run related menu hierarchy tests**
|
||
|
|
|
||
|
|
Run:
|
||
|
|
|
||
|
|
```text
|
||
|
|
mvn -pl ruoyi-generator -Dtest=QingTemplateSupportTest test
|
||
|
|
```
|
||
|
|
|
||
|
|
Expected: all `QingTemplateSupportTest` tests pass.
|