import React from "react";
|
import {
|
List,
|
Datagrid,
|
TextField,
|
DateField,
|
TopToolbar,
|
FilterButton,
|
TextInput,
|
SelectInput,
|
ShowButton,
|
BulkDeleteButton,
|
FunctionField,
|
} from "react-admin";
|
import { Chip } from "@mui/material";
|
import EmptyData from "@/page/components/EmptyData";
|
import { DEFAULT_PAGE_SIZE } from "@/config/setting";
|
|
const filters = [
|
<TextInput source="uri" label="table.field.httpAuditLog.uri" alwaysOn />,
|
<TextInput source="clientIp" label="table.field.httpAuditLog.clientIp" />,
|
<SelectInput
|
source="okFlag"
|
label="table.field.httpAuditLog.okFlag"
|
choices={[
|
{ id: 1, name: "正常" },
|
{ id: 0, name: "异常" },
|
]}
|
/>,
|
<TextInput source="serviceName" label="table.field.httpAuditLog.serviceName" />,
|
<SelectInput
|
source="scopeType"
|
label="table.field.httpAuditLog.scopeType"
|
choices={[
|
{ id: "EXTERNAL", name: "外部" },
|
{ id: "INTERNAL", name: "内部" },
|
]}
|
/>,
|
<TextInput source="functionDesc" label="table.field.httpAuditLog.functionDesc" />,
|
<TextInput source="method" label="table.field.httpAuditLog.method" />,
|
];
|
|
const HttpAuditLogList = () => (
|
<List
|
title="menu.httpAuditLog"
|
filters={filters}
|
sort={{ field: "create_time", order: "DESC" }}
|
perPage={DEFAULT_PAGE_SIZE}
|
empty={<EmptyData />}
|
actions={
|
<TopToolbar>
|
<FilterButton />
|
</TopToolbar>
|
}
|
>
|
<Datagrid bulkActionButtons={<BulkDeleteButton />}>
|
<TextField source="id" />
|
<TextField source="serviceName" label="table.field.httpAuditLog.serviceName" />
|
<TextField source="scopeType" label="table.field.httpAuditLog.scopeType" />
|
<TextField source="uri" label="table.field.httpAuditLog.uri" />
|
<TextField source="method" label="table.field.httpAuditLog.method" />
|
<TextField source="functionDesc" label="table.field.httpAuditLog.functionDesc" />
|
<TextField source="clientIp" label="table.field.httpAuditLog.clientIp" />
|
<FunctionField
|
label="table.field.httpAuditLog.okFlag"
|
render={(record) =>
|
record.okFlag === 1 ? (
|
<Chip label="正常" color="success" size="small" variant="outlined" />
|
) : (
|
<Chip label="异常" color="error" size="small" variant="outlined" />
|
)
|
}
|
/>
|
<TextField source="httpStatus" label="table.field.httpAuditLog.httpStatus" />
|
<TextField source="spendMs" label="table.field.httpAuditLog.spendMs" />
|
<DateField source="createTime" label="common.field.createTime" showTime />
|
<ShowButton />
|
</Datagrid>
|
</List>
|
);
|
|
export default HttpAuditLogList;
|