Преглед изворни кода

feat(sidebar): 添加监控外部链接菜单项

在管理员菜单区域新增「监控」入口,仅 root 用户可见,
点击后在新窗口打开外部监控面板。支持在侧边栏模块管理中切换显示/隐藏。
同时在 renderWrapper 中添加外部链接的通用支持。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
master
fengsilin пре 3 дана
родитељ
комит
69ed7d85d7
4 измењених фајлова са 34 додато и 0 уклоњено
  1. +22
    -0
      web/src/components/layout/SiderBar.jsx
  2. +3
    -0
      web/src/helpers/render.jsx
  3. +1
    -0
      web/src/hooks/common/useSidebar.js
  4. +8
    -0
      web/src/pages/Setting/Operation/SettingsSidebarModulesAdmin.jsx

+ 22
- 0
web/src/components/layout/SiderBar.jsx Прегледај датотеку

@@ -49,6 +49,7 @@ const routerMap = {
deployment: '/console/deployment',
playground: '/console/playground',
personal: '/console/personal',
monitoring: 'https://monitor.lancerouter.ai/',
};

const SiderBar = ({ onNavigate = () => {} }) => {
@@ -189,6 +190,12 @@ const SiderBar = ({ onNavigate = () => {} }) => {
to: '/setting',
className: isRoot() ? '' : 'tableHiddle',
},
{
text: t('监控'),
itemKey: 'monitoring',
to: 'https://monitor.lancerouter.ai/',
className: isRoot() ? '' : 'tableHiddle',
},
];

// 根据配置过滤项目
@@ -416,6 +423,21 @@ const SiderBar = ({ onNavigate = () => {} }) => {
// 如果没有路由,直接返回元素
if (!to) return itemElement;

// 外部链接用 <a> 在新窗口打开
if (to.startsWith('http')) {
return (
<a
style={{ textDecoration: 'none' }}
href={to}
target='_blank'
rel='noopener noreferrer'
onClick={onNavigate}
>
{itemElement}
</a>
);
}

return (
<Link
style={{ textDecoration: 'none' }}


+ 3
- 0
web/src/helpers/render.jsx Прегледај датотеку

@@ -75,6 +75,7 @@ import {
Package,
Server,
CalendarClock,
Activity,
} from 'lucide-react';
import {
SiAtlassian,
@@ -146,6 +147,8 @@ export function getLucideIcon(key, selected = false) {
return <CalendarClock {...commonProps} color={iconColor} />;
case 'setting':
return <Settings {...commonProps} color={iconColor} />;
case 'monitoring':
return <Activity {...commonProps} color={iconColor} />;
default:
return <CircleUser {...commonProps} color={iconColor} />;
}


+ 1
- 0
web/src/hooks/common/useSidebar.js Прегледај датотеку

@@ -53,6 +53,7 @@ export const DEFAULT_ADMIN_CONFIG = {
user: true,
subscription: true,
setting: true,
monitoring: true,
},
};



+ 8
- 0
web/src/pages/Setting/Operation/SettingsSidebarModulesAdmin.jsx Прегледај датотеку

@@ -67,6 +67,7 @@ export default function SettingsSidebarModulesAdmin(props) {
user: true,
subscription: true,
setting: true,
monitoring: true,
},
});

@@ -128,6 +129,7 @@ export default function SettingsSidebarModulesAdmin(props) {
user: true,
subscription: true,
setting: true,
monitoring: true,
},
};
setSidebarModulesAdmin(defaultModules);
@@ -197,6 +199,7 @@ export default function SettingsSidebarModulesAdmin(props) {
user: true,
subscription: true,
setting: true,
monitoring: true,
},
};
setSidebarModulesAdmin(defaultModules);
@@ -276,6 +279,11 @@ export default function SettingsSidebarModulesAdmin(props) {
title: t('系统设置'),
description: t('系统参数配置'),
},
{
key: 'monitoring',
title: t('监控'),
description: t('外部监控面板'),
},
],
},
];


Loading…
Откажи
Сачувај