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;
|