feat(react-web-next): 新增.editorconfig和.prettierrc配置文件,添加public/.gitkeep占位文件

This commit is contained in:
2025-09-23 10:32:35 +08:00
parent 10ddfd6f75
commit 408b500b6a
199 changed files with 16850 additions and 34874 deletions
@@ -0,0 +1,61 @@
import React, { useState, useRef } from 'react';
import { PageContainer, ProFormSelect, ProFormText, ProTable } from '@ant-design/pro-components';
import type { ProColumns, ActionType } from '@ant-design/pro-components';
import { GlassCard, SearchBarPlus } from '@/components/ui';
import { searchApi } from '@/services/search';
const AuditLogPage: React.FC = () => {
const [params, setParams] = useState<Record<string, any>>({});
const actionRef = useRef<ActionType>();
const columns: ProColumns<any>[] = [
{ dataIndex: 'index', valueType: 'indexBorder', width: 48 },
{ title: '日志时间', key: 'timestamp', width: 140, render: (_, r) => r.timestamp },
{ title: '用户ID', dataIndex: 'userId', width: 80 },
{ title: '用户名', dataIndex: 'userName', width: 120 },
{ title: '租户ID', dataIndex: 'clientId', width: 120 },
{ title: '操作信息', dataIndex: 'operation', width: 300, ellipsis: true, render: (_, r) => r.operation && <span dangerouslySetInnerHTML={{ __html: r.operation }} /> },
{ title: '应用名', dataIndex: 'appName', width: 140, ellipsis: true },
{ title: '类名', dataIndex: 'className', width: 240, ellipsis: true },
];
return (
<PageContainer header={{ title: '审计日志' }}>
<SearchBarPlus
defaultCollapsed
split
span={8}
onTenantChanged={() => actionRef.current?.reload?.()}
onFinish={async (values) => {
const { searchKey, searchValue } = values as any;
let queryStr = '';
if (searchKey && searchValue) queryStr = searchKey === 'none' ? searchValue : `${searchKey}:${searchValue}`;
setParams({ ...params, queryStr });
}}
>
<ProFormSelect
name="searchKey"
label="检索"
valueEnum={{ none: '全文检索', appName: '应用名', classname: '类名', methodName: '方法名', userId: '用户ID', userName: '用户名', clientId: '租户ID', operation: '操作信息' }}
/>
<ProFormText name="searchValue" placeholder="请输入关键字" />
</SearchBarPlus>
<GlassCard>
<ProTable<any>
actionRef={actionRef}
rowKey="id"
headerTitle="审计日志"
request={(p) => searchApi.auditlog({ ...p, ...params })}
columns={columns}
search={false}
size="small"
pagination={{ showSizeChanger: true, showQuickJumper: true }}
/>
</GlassCard>
</PageContainer>
);
};
export default AuditLogPage;
@@ -0,0 +1,56 @@
import React, { useRef, useState } from 'react';
import { PageContainer, ProFormSelect, ProFormText, ProTable } from '@ant-design/pro-components';
import type { ProColumns, ActionType } from '@ant-design/pro-components';
import { GlassCard, SearchBarPlus } from '@/components/ui';
import { searchApi } from '@/services/search';
const SlowSqlLogPage: React.FC = () => {
const [params, setParams] = useState<Record<string, any>>({});
const actionRef = useRef<ActionType>();
const columns: ProColumns<any>[] = [
{ dataIndex: 'index', valueType: 'indexBorder', width: 48 },
{ title: '日志时间', key: 'timestamp', width: 140, render: (_, r) => r.timestamp },
{ title: '查询语句', dataIndex: 'query_str', width: 400, ellipsis: true },
{ title: '查询时间(ms)', dataIndex: 'query_time', width: 120 },
{ title: '锁等待(ms)', dataIndex: 'lock_time', width: 120 },
{ title: '返回行数', dataIndex: 'rows_sent', width: 120 },
{ title: '扫描行数', dataIndex: 'rows_examined', width: 160 },
];
return (
<PageContainer header={{ title: '慢查询日志' }}>
<SearchBarPlus
defaultCollapsed
split
span={8}
onTenantChanged={() => actionRef.current?.reload?.()}
onFinish={async (values) => {
const { searchKey, searchValue } = values as any;
let queryStr = '';
if (searchKey && searchValue) queryStr = searchKey === 'none' ? searchValue : `${searchKey}:${searchValue}`;
setParams({ ...params, queryStr });
}}
>
<ProFormSelect name="searchKey" label="检索" valueEnum={{ none: '全文检索', query_str: '查询语句' }} />
<ProFormText name="searchValue" placeholder="请输入关键字" />
</SearchBarPlus>
<GlassCard>
<ProTable<any>
actionRef={actionRef}
rowKey="id"
headerTitle="慢查询日志"
request={(p) => searchApi.slowQueryLog({ ...p, ...params })}
columns={columns}
search={false}
size="small"
pagination={{ showSizeChanger: true, showQuickJumper: true }}
/>
</GlassCard>
</PageContainer>
);
};
export default SlowSqlLogPage;
@@ -0,0 +1,38 @@
import React, { useEffect, useState } from 'react';
import { Button, Modal, Table } from 'antd';
import { searchApi } from '@/services/search';
interface Props {
traceId?: string;
open: boolean;
onCancel: () => void;
}
const TraceView: React.FC<Props> = ({ traceId, open, onCancel }) => {
const [data, setData] = useState<any[]>([]);
useEffect(() => {
(async () => {
if (open && traceId) {
const list = await searchApi.tracelog(traceId);
setData(list || []);
}
})();
}, [open, traceId]);
const columns = [
{ title: '应用名', dataIndex: 'appName' },
{ title: 'spanId', dataIndex: 'spanId' },
{ title: '服务IP', dataIndex: 'serverIp' },
{ title: '端口', dataIndex: 'serverPort' },
{ title: '时间', dataIndex: 'timestamp' },
];
return (
<Modal title="日志链路" width={800} open={open} onCancel={onCancel} footer={<Button type="primary" onClick={onCancel}>关闭</Button>}>
<Table rowKey={(r) => r.spanId || r.id} dataSource={data} columns={columns as any} pagination={false} size="small" />
</Modal>
);
};
export default TraceView;
@@ -0,0 +1,75 @@
import React, { useRef, useState } from 'react';
import { PageContainer, ProFormSelect, ProFormText, ProTable } from '@ant-design/pro-components';
import type { ProColumns, ActionType } from '@ant-design/pro-components';
import { Typography } from 'antd';
import { GlassCard, SearchBarPlus } from '@/components/ui';
import { searchApi } from '@/services/search';
import TraceView from './components/TraceView';
const { Link } = Typography;
const SysLogPage: React.FC = () => {
const [params, setParams] = useState<Record<string, any>>({ sortCol: 'timestamp', isHighlighter: 'true' });
const [trace, setTrace] = useState<{ open: boolean; traceId?: string }>({ open: false });
const actionRef = useRef<ActionType>();
const columns: ProColumns<any>[] = [
{ dataIndex: 'index', valueType: 'indexBorder', width: 48 },
{ title: '时间', key: 'timestamp', width: 120, render: (_, r) => r.timestamp },
{ title: '日志信息', dataIndex: 'message', ellipsis: true, width: 400, render: (_, r) => <span dangerouslySetInnerHTML={{ __html: r.message || '' }} /> },
{ title: '日志级别', dataIndex: 'logLevel', width: 80, render: (_, r) => <span dangerouslySetInnerHTML={{ __html: r.logLevel || '' }} /> },
{ title: '应用名', dataIndex: 'appName', width: 120, render: (_, r) => <span dangerouslySetInnerHTML={{ __html: r.appName || '' }} /> },
{
title: '追踪ID', key: 'traceId', width: 200,
render: (_, r) => (
<Link onClick={() => setTrace({ open: true, traceId: String(r.traceId || '').replace('<mark>', '').replace('</mark>', '') })}>
<span dangerouslySetInnerHTML={{ __html: r.traceId || '' }} />
</Link>
)
},
{ title: 'spanId', dataIndex: 'spanId', width: 120, render: (_, r) => <span dangerouslySetInnerHTML={{ __html: r.spanId || '' }} /> },
{ title: '类名', dataIndex: 'classname', width: 200, ellipsis: true, render: (_, r) => <span dangerouslySetInnerHTML={{ __html: r.classname || '' }} /> },
{ title: '线程名', dataIndex: 'threadName', width: 140, ellipsis: true, render: (_, r) => <span dangerouslySetInnerHTML={{ __html: r.threadName || '' }} /> },
{ title: '服务IP', dataIndex: 'serverIp', width: 120, render: (_, r) => <span dangerouslySetInnerHTML={{ __html: r.serverIp || '' }} /> },
{ title: '服务端口', dataIndex: 'serverPort', width: 100, render: (_, r) => <span dangerouslySetInnerHTML={{ __html: r.serverPort || '' }} /> },
];
return (
<PageContainer header={{ title: '系统日志' }}>
<SearchBarPlus
defaultCollapsed
split
span={8}
onTenantChanged={() => actionRef.current?.reload?.()}
onFinish={async (values) => {
const { searchKey, searchValue } = values as any;
let queryStr = '';
if (searchKey && searchValue) queryStr = searchKey === 'none' ? searchValue : `${searchKey}:${searchValue}`;
setParams({ ...params, queryStr });
}}
>
<ProFormSelect name="searchKey" label="检索" valueEnum={{ none: '全文检索', message: '日志信息', logLevel: '日志级别', appName: '应用名', classname: '类名', traceId: '链路追踪ID' }} />
<ProFormText name="searchValue" placeholder="请输入关键字" />
</SearchBarPlus>
<GlassCard>
<ProTable<any>
rowKey="id"
headerTitle="系统日志"
actionRef={actionRef}
request={(p) => searchApi.syslog({ ...p, ...params })}
columns={columns}
search={false}
size="small"
pagination={{ showSizeChanger: true, showQuickJumper: true }}
scroll={{ x: 1600 }}
/>
</GlassCard>
<TraceView open={trace.open} traceId={trace.traceId} onCancel={() => setTrace({ open: false })} />
</PageContainer>
);
};
export default SysLogPage;