feat: 增加日志入口

This commit is contained in:
李如威 2025-09-23 16:47:59 +08:00
parent d144a97b6d
commit a168940b33
4 changed files with 76 additions and 6 deletions

View File

@ -56,7 +56,7 @@ export default () => {
},
{
dataIndex: 'title',
title: "工作",
title: "工作",
render: (_, record) => {
return <Space>
<Typography.Text>{record?.work_title}</Typography.Text>

View File

@ -1,7 +1,7 @@
import React, { useState } from "react";
import { Outlet, useNavigate, useLocation } from "react-router-dom";
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 './Layout.css';
@ -14,8 +14,9 @@ export default function LayoutPage() {
const location = useLocation();
const menuItems = [
{ key: "1", icon: <NodeExpandOutlined />, label: "工作台", path: "/flow" },
{ key: "2", icon: <LaptopOutlined />, label: "节点管理", path: "/client" },
{ key: "flow", icon: <NodeExpandOutlined />, label: "工作台", path: "/flow" },
{ 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 || "";

View File

@ -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;

View File

@ -9,7 +9,7 @@ import Flow from "./pages/Flow";
import FlowDetail from "./pages/Flow/Detail";
import LayoutPage from "./pages/Layout";
import ClientPage from "./pages/Client";
import LogPage from "./pages/Log";
//
function PrivateRoute() {
@ -33,7 +33,8 @@ const routes = [
{ path: "/client", element: <ClientPage /> },
{ path: "/flow/detail/:work_uuid", element: <FlowDetail /> },
{ path: "/user", element: <User /> },
{ path: "/user/detail", element: <Profile /> }
{ path: "/user/detail", element: <Profile /> },
{ path: "/logs", element: <LogPage /> }
]
}
],