cl
15 小时以前 52e09a6b7b7054fc51b9d4bf5f1fbec0a57e60f1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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;