Merge remote-tracking branch 'aliyun/develop' into develop

This commit is contained in:
tao.chen
2026-08-07 18:50:57 +08:00
2 changed files with 21 additions and 7 deletions
+20 -7
View File
@@ -1,12 +1,5 @@
import Icon from "./Icon";
const navigation = [
{ label: "工作台", icon: "home" as const, page: "home" as const },
{ label: "构建脚本", icon: "script" as const, page: "scripts" as const },
{ label: "调度配置", icon: "schedule" as const, page: "schedules" as const },
{ label: "系统管理", icon: "settings" as const, page: "system" as const },
];
type ActivePage = "home" | "scripts" | "schedules" | "system";
type SidebarProps = {
@@ -17,6 +10,13 @@ type SidebarProps = {
onEndEditing?: () => void;
onSelectScript?: (scriptId: null) => void;
editSessionRef?: React.RefObject<unknown | null>;
isSystemAdmin?: boolean;
};
type NavigationItem = {
label: string;
icon: "home" | "script" | "schedule" | "settings";
page: ActivePage;
};
export function Sidebar({
@@ -27,6 +27,7 @@ export function Sidebar({
onEndEditing,
onSelectScript,
editSessionRef,
isSystemAdmin = false,
}: SidebarProps) {
const handleNavigationClick = (page: ActivePage) => {
if (page !== "scripts") {
@@ -39,6 +40,18 @@ export function Sidebar({
onNavigate(page);
};
// 根据管理员权限构建菜单项
const navigation: NavigationItem[] = [
{ label: "工作台", icon: "home", page: "home" },
{ label: "构建脚本", icon: "script", page: "scripts" },
{ label: "调度配置", icon: "schedule", page: "schedules" },
];
// 系统管理员才显示"系统管理"菜单
if (isSystemAdmin) {
navigation.push({ label: "系统管理", icon: "settings", page: "system" });
}
return (
<aside className={`sidebar${collapsed ? " is-collapsed" : ""}`}>
<div className="brand">
+1
View File
@@ -115,6 +115,7 @@ function AuthenticatedLayout() {
onEndEditing={() => void endEditing(true)}
onSelectScript={selectScript}
editSessionRef={editSessionHandle}
isSystemAdmin={user?.is_system_admin ?? false}
/>
<main className="main-area">