Skip to content

fix(frontend): admin custom menu items not showing in sidebar#729

Merged
Wei-Shaw merged 1 commit intoWei-Shaw:mainfrom
touwaeriol:pr/fix-admin-menu-visibility
Mar 3, 2026
Merged

fix(frontend): admin custom menu items not showing in sidebar#729
Wei-Shaw merged 1 commit intoWei-Shaw:mainfrom
touwaeriol:pr/fix-admin-menu-visibility

Conversation

@touwaeriol
Copy link
Contributor

背景 / Background

自定义菜单功能(#727)合并后,公开设置 API(/api/v1/settings/public)在服务端过滤掉了 visibility='admin' 的菜单项。但前端侧边栏的管理员菜单仍然从公开 API 数据中读取,导致管理员菜单项永远为空。

After the custom menu feature (#727) was merged, the public settings API (/api/v1/settings/public) filters out menu items with visibility='admin' on the server side. However, the frontend sidebar still reads admin menu items from the public API data, causing admin menu items to never appear.


目的 / Purpose

修复管理员自定义菜单项在侧边栏中不显示的问题。管理员菜单项应从管理员设置 API 获取(该接口返回全量数据,不过滤)。

Fix admin custom menu items not showing in the sidebar. Admin menu items should be loaded from the admin settings API, which returns all items without filtering.


改动内容 / Changes

前端 / Frontend

  • adminSettings store:在 fetch 中存储 custom_menu_items,并导出 customMenuItems 供侧边栏使用
  • AppSidebar.vuecustomMenuItemsForAdmin 改为从 adminSettingsStore.customMenuItems 读取,而非从 cachedPublicSettings 读取
  • CustomPageView.vue:管理员访问自定义页面时,合并公开和管理员菜单项进行查找,确保 admin-only 页面不会 404

  • adminSettings store: Store custom_menu_items in fetch and export customMenuItems for sidebar use
  • AppSidebar.vue: Read customMenuItemsForAdmin from adminSettingsStore.customMenuItems instead of cachedPublicSettings
  • CustomPageView.vue: Merge public and admin menu items when admin users access custom pages, preventing 404 on admin-only pages

The public settings API filters out menu items with visibility='admin',
so customMenuItemsForAdmin was always empty when reading from
cachedPublicSettings. Fix by loading custom menu items from the admin
settings API (via adminSettingsStore) which returns all items unfiltered.

Changes:
- adminSettings store: store custom_menu_items from admin settings API
- AppSidebar: read admin menu items from adminSettingsStore instead of
  cachedPublicSettings
- CustomPageView: merge public and admin menu items so admin users can
  access admin-only custom pages
@Wei-Shaw Wei-Shaw merged commit 9792b17 into Wei-Shaw:main Mar 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants