Optimize log page

This commit is contained in:
2023-11-05 22:54:55 +08:00
parent eadc74ca67
commit ae73ecfd92
3 changed files with 45 additions and 20 deletions

View File

@@ -4,5 +4,5 @@
background-color: constants.$origin-color; background-color: constants.$origin-color;
border-radius: 8px; border-radius: 8px;
overflow: hidden; overflow: hidden;
box-shadow: 5px 5px 10px 0 rgba(0,0,0,0.1); box-shadow: 5px 5px 15px 0 rgba(0,0,0,0.1);
} }

1
src/global.d.ts vendored
View File

@@ -182,4 +182,5 @@ interface SysLogGetVo {
endTime: string endTime: string
executeTime: number executeTime: number
userAgent: string userAgent: string
operateUsername: string
} }

View File

@@ -21,44 +21,68 @@ const Log: React.FC = () => {
}) })
const dataColumns: ColumnsType<SysLogGetVo> = [ const dataColumns: ColumnsType<SysLogGetVo> = [
{ title: '类型', dataIndex: 'logType' }, {
title: '类型',
dataIndex: 'logType',
render: (value) =>
value === 'ERROR' ? (
<AntdTag color={'error'}>{value}</AntdTag>
) : (
<AntdTag>{value}</AntdTag>
),
align: 'center'
},
{ {
title: '操作者', title: '操作者',
dataIndex: 'operateUserId' dataIndex: 'operateUsername',
align: 'center',
render: (value, record) =>
value ? (
<AntdTag color={'purple'}>{`${value}(${record.operateUserId})`}</AntdTag>
) : (
<AntdTag>Anonymous</AntdTag>
)
}, },
{ {
title: '操作时间', title: '操作时间',
dataIndex: 'operateTime', dataIndex: 'operateTime',
render: (value) => getLocalTime(value) render: (value: string) => getLocalTime(value),
}, align: 'center'
{
title: '请求 Uri',
dataIndex: 'requestUri'
}, },
{ {
title: '请求方式', title: '请求方式',
dataIndex: 'requestMethod' dataIndex: 'requestMethod',
align: 'center'
}, },
{ {
title: '请求参数', title: '请求 Url',
dataIndex: 'requestParams' render: (_value, record) =>
`${record.requestServerAddress}${record.requestUri}${
record.requestParams ? `?${record.requestParams}` : ''
}`
}, },
{ {
title: '请求 IP', title: '请求 IP',
dataIndex: 'requestIp' dataIndex: 'requestIp',
align: 'center'
}, },
{ {
title: '请求服务器地址', title: '异常',
dataIndex: 'requestServerAddress' dataIndex: 'exception',
}, render: (value: boolean, record) => (value ? record.exceptionInfo : '无'),
{ align: 'center'
title: '异常信息',
dataIndex: 'exceptionInfo'
}, },
{ {
title: '执行时间', title: '执行时间',
dataIndex: 'executeTime', dataIndex: 'executeTime',
render: (value) => `${value}ms` render: (value, record) => (
<AntdTooltip
title={`${getLocalTime(record.startTime)} - ${getLocalTime(record.endTime)}`}
>
{`${value}ms`}
</AntdTooltip>
),
align: 'center'
}, },
{ {
title: '用户代理', title: '用户代理',
@@ -83,7 +107,7 @@ const Log: React.FC = () => {
return return
} }
r_getSysLog({ void r_getSysLog({
currentPage: tableParams.pagination?.current, currentPage: tableParams.pagination?.current,
pageSize: tableParams.pagination?.pageSize pageSize: tableParams.pagination?.pageSize
}) })