deploy-ease-app/src/renderer/src/router/index.ts
2024-08-13 10:18:20 +08:00

84 lines
2.3 KiB
TypeScript

import React, { lazy } from "react";
import { BrowserRouterProps } from "react-router-dom";
import { DashboardIcon, TreeListIcon, ServerIcon, TreeRoundDotVerticalIcon } from "tdesign-icons-react";
export interface IRouter {
path: string;
redirect?: string;
Component?: React.FC<BrowserRouterProps> | (() => any);
meta?: {
title?: string;
Icon?: React.FC;
hidden?: boolean;
single?: boolean;
fullScreen?: boolean;
};
children?: IRouter[];
}
const routes: IRouter[] = [
{
path: "/",
meta: {
title: "仪表盘",
hidden: false,
Icon: DashboardIcon
},
Component: lazy(() => import("../pages/index/Dashboard"))
},
{
path: "/k8s",
meta: {
title: "集群",
hidden: false,
Icon: TreeListIcon
},
children: [
{
path: "deployments",
Component: lazy(() => import("../pages/k8s/K8sDeployments")),
meta: {
title: "服务列表",
hidden: false,
Icon: ServerIcon
}
},
{
path: "podList",
Component: lazy(() => import("../pages/k8s/K8sPodList")),
meta: {
title: "节点列表",
hidden: false,
Icon: TreeRoundDotVerticalIcon
}
},
{
path: "pods",
Component: lazy(() => import("../pages/k8s/K8sPods")),
meta: {
hidden: true
}
},
{
path: "pods/:namespace/:deploymentName",
Component: lazy(() => import("../pages/k8s/K8sPods")),
meta: {
hidden: true
}
},
{
path: "/pod/log",
Component: lazy(() => import("../pages/k8s/K8sLogs")),
meta: {
title: "查看LOG",
hidden: true,
fullScreen: true
}
}
]
}
];
const allRoutes = [...routes];
export default allRoutes;