在管理员菜单区域新增「监控」入口,仅 root 用户可见, 点击后在新窗口打开外部监控面板。支持在侧边栏模块管理中切换显示/隐藏。 同时在 renderWrapper 中添加外部链接的通用支持。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>master
| @@ -49,6 +49,7 @@ const routerMap = { | |||||
| deployment: '/console/deployment', | deployment: '/console/deployment', | ||||
| playground: '/console/playground', | playground: '/console/playground', | ||||
| personal: '/console/personal', | personal: '/console/personal', | ||||
| monitoring: 'https://monitor.lancerouter.ai/', | |||||
| }; | }; | ||||
| const SiderBar = ({ onNavigate = () => {} }) => { | const SiderBar = ({ onNavigate = () => {} }) => { | ||||
| @@ -189,6 +190,12 @@ const SiderBar = ({ onNavigate = () => {} }) => { | |||||
| to: '/setting', | to: '/setting', | ||||
| className: isRoot() ? '' : 'tableHiddle', | 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; | 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 ( | return ( | ||||
| <Link | <Link | ||||
| style={{ textDecoration: 'none' }} | style={{ textDecoration: 'none' }} | ||||
| @@ -75,6 +75,7 @@ import { | |||||
| Package, | Package, | ||||
| Server, | Server, | ||||
| CalendarClock, | CalendarClock, | ||||
| Activity, | |||||
| } from 'lucide-react'; | } from 'lucide-react'; | ||||
| import { | import { | ||||
| SiAtlassian, | SiAtlassian, | ||||
| @@ -146,6 +147,8 @@ export function getLucideIcon(key, selected = false) { | |||||
| return <CalendarClock {...commonProps} color={iconColor} />; | return <CalendarClock {...commonProps} color={iconColor} />; | ||||
| case 'setting': | case 'setting': | ||||
| return <Settings {...commonProps} color={iconColor} />; | return <Settings {...commonProps} color={iconColor} />; | ||||
| case 'monitoring': | |||||
| return <Activity {...commonProps} color={iconColor} />; | |||||
| default: | default: | ||||
| return <CircleUser {...commonProps} color={iconColor} />; | return <CircleUser {...commonProps} color={iconColor} />; | ||||
| } | } | ||||
| @@ -53,6 +53,7 @@ export const DEFAULT_ADMIN_CONFIG = { | |||||
| user: true, | user: true, | ||||
| subscription: true, | subscription: true, | ||||
| setting: true, | setting: true, | ||||
| monitoring: true, | |||||
| }, | }, | ||||
| }; | }; | ||||
| @@ -67,6 +67,7 @@ export default function SettingsSidebarModulesAdmin(props) { | |||||
| user: true, | user: true, | ||||
| subscription: true, | subscription: true, | ||||
| setting: true, | setting: true, | ||||
| monitoring: true, | |||||
| }, | }, | ||||
| }); | }); | ||||
| @@ -128,6 +129,7 @@ export default function SettingsSidebarModulesAdmin(props) { | |||||
| user: true, | user: true, | ||||
| subscription: true, | subscription: true, | ||||
| setting: true, | setting: true, | ||||
| monitoring: true, | |||||
| }, | }, | ||||
| }; | }; | ||||
| setSidebarModulesAdmin(defaultModules); | setSidebarModulesAdmin(defaultModules); | ||||
| @@ -197,6 +199,7 @@ export default function SettingsSidebarModulesAdmin(props) { | |||||
| user: true, | user: true, | ||||
| subscription: true, | subscription: true, | ||||
| setting: true, | setting: true, | ||||
| monitoring: true, | |||||
| }, | }, | ||||
| }; | }; | ||||
| setSidebarModulesAdmin(defaultModules); | setSidebarModulesAdmin(defaultModules); | ||||
| @@ -276,6 +279,11 @@ export default function SettingsSidebarModulesAdmin(props) { | |||||
| title: t('系统设置'), | title: t('系统设置'), | ||||
| description: t('系统参数配置'), | description: t('系统参数配置'), | ||||
| }, | }, | ||||
| { | |||||
| key: 'monitoring', | |||||
| title: t('监控'), | |||||
| description: t('外部监控面板'), | |||||
| }, | |||||
| ], | ], | ||||
| }, | }, | ||||
| ]; | ]; | ||||