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
import React from "react";
import { Show, SimpleShowLayout, TextField, DateField, FunctionField } from "react-admin";
import { Box, Chip } from "@mui/material";
 
const JsonBlock = ({ text }) => (
    <Box component="pre" sx={{ whiteSpace: "pre-wrap", wordBreak: "break-all", m: 0, fontSize: 12 }}>
        {text ?? ""}
    </Box>
);
 
const HttpAuditLogShow = () => (
    <Show>
        <SimpleShowLayout>
            <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" />
            <TextField source="responseTruncated" label="table.field.httpAuditLog.responseTruncated" />
            <DateField source="createTime" label="common.field.createTime" showTime />
            <FunctionField
                source="queryString"
                label="table.field.httpAuditLog.queryString"
                render={(record) => <JsonBlock text={record.queryString} />}
            />
            <FunctionField
                source="requestBody"
                label="table.field.httpAuditLog.requestBody"
                render={(record) => <JsonBlock text={record.requestBody} />}
            />
            <FunctionField
                source="responseBody"
                label="table.field.httpAuditLog.responseBody"
                render={(record) => <JsonBlock text={record.responseBody} />}
            />
            <FunctionField
                source="errorMessage"
                label="table.field.httpAuditLog.errorMessage"
                render={(record) => <JsonBlock text={record.errorMessage} />}
            />
        </SimpleShowLayout>
    </Show>
);
 
export default HttpAuditLogShow;