feat: 增加日志入口
This commit is contained in:
parent
d144a97b6d
commit
a168940b33
|
|
@ -56,7 +56,7 @@ export default () => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dataIndex: 'title',
|
dataIndex: 'title',
|
||||||
title: "工作流",
|
title: "工作",
|
||||||
render: (_, record) => {
|
render: (_, record) => {
|
||||||
return <Space>
|
return <Space>
|
||||||
<Typography.Text>{record?.work_title}</Typography.Text>
|
<Typography.Text>{record?.work_title}</Typography.Text>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { Outlet, useNavigate, useLocation } from "react-router-dom";
|
import { Outlet, useNavigate, useLocation } from "react-router-dom";
|
||||||
import { Layout, Menu, Button, Flex, Dropdown, Steps } from "antd";
|
import { Layout, Menu, Button, Flex, Dropdown, Steps } from "antd";
|
||||||
import { MenuFoldOutlined, MenuUnfoldOutlined, UserOutlined, LoginOutlined, ProfileOutlined, NodeExpandOutlined, LaptopOutlined } from "@ant-design/icons";
|
import { MenuFoldOutlined, MenuUnfoldOutlined, UserOutlined, LoginOutlined, ProfileOutlined, NodeExpandOutlined, LaptopOutlined, SolutionOutlined } from "@ant-design/icons";
|
||||||
import { useAuth } from "../context/AuthContext";
|
import { useAuth } from "../context/AuthContext";
|
||||||
import './Layout.css';
|
import './Layout.css';
|
||||||
|
|
||||||
|
|
@ -14,8 +14,9 @@ export default function LayoutPage() {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|
||||||
const menuItems = [
|
const menuItems = [
|
||||||
{ key: "1", icon: <NodeExpandOutlined />, label: "工作台", path: "/flow" },
|
{ key: "flow", icon: <NodeExpandOutlined />, label: "工作台", path: "/flow" },
|
||||||
{ key: "2", icon: <LaptopOutlined />, label: "节点管理", path: "/client" },
|
{ key: "logs", icon: <SolutionOutlined />, label: "操作日志", path: "/logs" },
|
||||||
|
{ key: "client", icon: <LaptopOutlined />, label: "节点管理", path: "/client" },
|
||||||
];
|
];
|
||||||
|
|
||||||
const selectedKey = menuItems.find(item => location.pathname.startsWith(item.path))?.key || "";
|
const selectedKey = menuItems.find(item => location.pathname.startsWith(item.path))?.key || "";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
import { ProTable } from "@ant-design/pro-components";
|
||||||
|
import { Card } from "antd";
|
||||||
|
import { useRef } from "react";
|
||||||
|
|
||||||
|
const LogPage = () => {
|
||||||
|
const actionRef = useRef(null);
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
dataIndex: 'index',
|
||||||
|
title: "序号",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'title',
|
||||||
|
title: "工作",
|
||||||
|
render: (_, record) => {
|
||||||
|
return <Space>
|
||||||
|
<Typography.Text>{record?.work_title}</Typography.Text>
|
||||||
|
<Typography.Text type="secondary">({record?.work_desc})</Typography.Text>
|
||||||
|
</Space>
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'last_user',
|
||||||
|
title: '执行用户',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'last_run_time',
|
||||||
|
title: '执行时间',
|
||||||
|
render: (_, record) => record?.last_run_time ? new Date(record?.last_run_time * 1000).toLocaleString() : ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'last_status',
|
||||||
|
title: '执行结果',
|
||||||
|
valueType: 'select',
|
||||||
|
valueEnum: {
|
||||||
|
'RUNNING': { text: "执行中", status: 'processing' },
|
||||||
|
'SUCCESS': { text: "成功", status: 'success' },
|
||||||
|
'FAILED': { text: "失败", status: 'error' },
|
||||||
|
'CANCELLED': { text: "取消", status: 'default' }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
valueType: 'option',
|
||||||
|
key: 'option',
|
||||||
|
width: 60,
|
||||||
|
fixed: 'right',
|
||||||
|
render: (_, record) => [
|
||||||
|
<a>查看</a>
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
const onRequest = async (params) => {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
return <Card title="操作日志">
|
||||||
|
<ProTable
|
||||||
|
columns={columns}
|
||||||
|
rowKey='id'
|
||||||
|
actionRef={actionRef}
|
||||||
|
search={false}
|
||||||
|
scroll={{ x: 'max-content' }}
|
||||||
|
request={onRequest}
|
||||||
|
/>
|
||||||
|
</Card>
|
||||||
|
}
|
||||||
|
|
||||||
|
export default LogPage;
|
||||||
|
|
@ -9,7 +9,7 @@ import Flow from "./pages/Flow";
|
||||||
import FlowDetail from "./pages/Flow/Detail";
|
import FlowDetail from "./pages/Flow/Detail";
|
||||||
import LayoutPage from "./pages/Layout";
|
import LayoutPage from "./pages/Layout";
|
||||||
import ClientPage from "./pages/Client";
|
import ClientPage from "./pages/Client";
|
||||||
|
import LogPage from "./pages/Log";
|
||||||
|
|
||||||
// 受保护的路由:没登录就跳转到登录页
|
// 受保护的路由:没登录就跳转到登录页
|
||||||
function PrivateRoute() {
|
function PrivateRoute() {
|
||||||
|
|
@ -33,7 +33,8 @@ const routes = [
|
||||||
{ path: "/client", element: <ClientPage /> },
|
{ path: "/client", element: <ClientPage /> },
|
||||||
{ path: "/flow/detail/:work_uuid", element: <FlowDetail /> },
|
{ path: "/flow/detail/:work_uuid", element: <FlowDetail /> },
|
||||||
{ path: "/user", element: <User /> },
|
{ path: "/user", element: <User /> },
|
||||||
{ path: "/user/detail", element: <Profile /> }
|
{ path: "/user/detail", element: <Profile /> },
|
||||||
|
{ path: "/logs", element: <LogPage /> }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue