Merge branch 'dhk-1' of http://192.168.0.200/knowledge-base-bj/deerflow-server into dhk-1
This commit is contained in:
commit
1214ea0d91
1 file changed
+34
-48
@@ -1,10 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* 全局侧边栏菜单数据与权限过滤逻辑。
|
* 全局侧边栏菜单数据与权限过滤逻辑。
|
||||||
*
|
*
|
||||||
* 浅色 PageSidebar 和深色 PageSidebarDark 共用这份数据,菜单结构与
|
* 浅色 ``PageSidebar`` 和深色 ``PageSidebarDark`` 共用这份数据 —— 菜单结构与
|
||||||
* adminOnly 权限策略对两种皮肤一致;UI 渲染在各自组件里实现。
|
* adminOnly 权限策略对两种皮肤完全一致;UI 渲染(icon 显示/折叠样式/hover flyout)
|
||||||
|
* 在各自组件里实现。
|
||||||
*
|
*
|
||||||
* 修改菜单只需要改这一处,两个 sidebar 自动同步。
|
* 修改菜单只需改这一处,两个 sidebar 自动同步。
|
||||||
*/
|
*/
|
||||||
import type { ElementType } from "react";
|
import type { ElementType } from "react";
|
||||||
import {
|
import {
|
||||||
@@ -23,13 +24,11 @@ import {
|
|||||||
History,
|
History,
|
||||||
Layers,
|
Layers,
|
||||||
Layout,
|
Layout,
|
||||||
|
Library,
|
||||||
List,
|
List,
|
||||||
ListChecks,
|
ListChecks,
|
||||||
ListTodo,
|
ListTodo,
|
||||||
MessageSquareCode,
|
|
||||||
Network,
|
Network,
|
||||||
NotebookPen,
|
|
||||||
Plus,
|
|
||||||
Settings,
|
Settings,
|
||||||
Sparkles,
|
Sparkles,
|
||||||
Target,
|
Target,
|
||||||
@@ -66,49 +65,10 @@ export const sidebarMenuItems: MenuItem[] = [
|
|||||||
icon: Bot,
|
icon: Bot,
|
||||||
path: "/page/strategy/agents/6bf/chats/new",
|
path: "/page/strategy/agents/6bf/chats/new",
|
||||||
},
|
},
|
||||||
{
|
{ id: "qa-zzxd", label: "zzXD应用", icon: Layout, path: "/page/strategy/agents/10d69686718349688e58a8790cb61024/chats/new", },
|
||||||
id: "qa-zzxd",
|
|
||||||
label: "zzXD应用",
|
|
||||||
icon: Layout,
|
|
||||||
path: "/page/strategy/agents/10d69686718349688e58a8790cb61024/chats/new",
|
|
||||||
},
|
|
||||||
{ id: "qa-research", label: "课题研究", icon: FileText, path: "/page/canvas/ai-writing" },
|
{ id: "qa-research", label: "课题研究", icon: FileText, path: "/page/canvas/ai-writing" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// id: "light-app-center",
|
|
||||||
// label: "应用中心",
|
|
||||||
// icon: Grid3X3,
|
|
||||||
// children: [
|
|
||||||
// {
|
|
||||||
// id: "light-app-note-management",
|
|
||||||
// label: "笔记管理",
|
|
||||||
// icon: NotebookPen,
|
|
||||||
// children: [
|
|
||||||
// {
|
|
||||||
// id: "light-app-new-note",
|
|
||||||
// label: "新建笔记",
|
|
||||||
// icon: Plus,
|
|
||||||
// path: "/page/strategy/light-app/new-note",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// id: "light-app-note-list",
|
|
||||||
// label: "笔记列表",
|
|
||||||
// icon: List,
|
|
||||||
// path: "/page/strategy/light-app/notes",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// id: "light-app-note-qa",
|
|
||||||
// label: "笔记问答",
|
|
||||||
// icon: MessageSquareCode,
|
|
||||||
// path: "/page/strategy/light-app/note-qa",
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// },
|
|
||||||
// { id: "light-app-square", label: "应用广场", icon: Layout },
|
|
||||||
// { id: "light-app-records", label: "使用记录", icon: History },
|
|
||||||
// ],
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
id: "task-management",
|
id: "task-management",
|
||||||
label: "任务管理",
|
label: "任务管理",
|
||||||
@@ -210,6 +170,26 @@ export const sidebarMenuItems: MenuItem[] = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: "light-app-center",
|
||||||
|
label: "应用中心",
|
||||||
|
icon: Grid3X3,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
id: "light-app-management",
|
||||||
|
label: "应用管理",
|
||||||
|
icon: Layout,
|
||||||
|
path: "/page/strategy/light-app/management",
|
||||||
|
adminOnly: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "light-app-apps",
|
||||||
|
label: "应用列表",
|
||||||
|
icon: List,
|
||||||
|
path: "/page/strategy/light-app/apps",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "comprehensive-management",
|
id: "comprehensive-management",
|
||||||
label: "综合管理",
|
label: "综合管理",
|
||||||
@@ -290,6 +270,12 @@ export const sidebarMenuItems: MenuItem[] = [
|
|||||||
icon: BookOpen,
|
icon: BookOpen,
|
||||||
path: "/page/workspace/knowledge",
|
path: "/page/workspace/knowledge",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: "resource-knowledge-base",
|
||||||
|
label: "知识库资源管理",
|
||||||
|
icon: Library,
|
||||||
|
path: "/page/strategy/resource-management/resource-knowledge-base",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "resource-evaluation-index",
|
id: "resource-evaluation-index",
|
||||||
label: "作战资源管理",
|
label: "作战资源管理",
|
||||||
@@ -300,7 +286,7 @@ export const sidebarMenuItems: MenuItem[] = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
/** 默认展开的菜单 id 集合。 */
|
/** 默认展开的菜单 id 集合(浅色版可折叠交互的初始状态) */
|
||||||
export const defaultExpandedIds: ReadonlySet<string> = new Set([
|
export const defaultExpandedIds: ReadonlySet<string> = new Set([
|
||||||
"qa-center",
|
"qa-center",
|
||||||
"light-app-center",
|
"light-app-center",
|
||||||
@@ -310,7 +296,7 @@ export const defaultExpandedIds: ReadonlySet<string> = new Set([
|
|||||||
"comprehensive-management",
|
"comprehensive-management",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/** 按 admin 角色过滤菜单:非 admin 不展示 ``adminOnly: true`` 的项及其子项。 */
|
/** 按 admin 角色过滤菜单:非 admin 不展示 ``adminOnly: true`` 的项及其子项 */
|
||||||
export function filterMenuItemsByRole(items: MenuItem[], isAdmin: boolean): MenuItem[] {
|
export function filterMenuItemsByRole(items: MenuItem[], isAdmin: boolean): MenuItem[] {
|
||||||
return items
|
return items
|
||||||
.filter((item) => !item.adminOnly || isAdmin)
|
.filter((item) => !item.adminOnly || isAdmin)
|
||||||
|
|||||||
Reference in new issue
Block a user