| import React, { useState, useRef, useEffect, useMemo } from "react"; | 
| import { Box, Card, CardContent, Grid, Typography, Tooltip } from '@mui/material'; | 
| import { | 
|     useTranslate, | 
|     useRecordContext, | 
| } from 'react-admin'; | 
| import PanelTypography from "@/page/components/PanelTypography"; | 
| import * as Common from '@/utils/common' | 
|   | 
| const OperationRecordPanel = () => { | 
|     const record = useRecordContext(); | 
|     if (!record) return null; | 
|     const translate = useTranslate(); | 
|     return ( | 
|         <> | 
|             <Card sx={{ width: { xs: 300, sm: 500, md: 600, lg: 800 }, margin: 'auto' }}> | 
|                 <CardContent> | 
|                     <Grid container spacing={2}> | 
|                         <Grid item xs={12} sx={{ display: 'flex', justifyContent: 'space-between' }}> | 
|                             <Typography variant="h6" gutterBottom align="left" sx={{ | 
|                                 maxWidth: { xs: '100px', sm: '180px', md: '260px', lg: '360px' }, | 
|                                 whiteSpace: 'nowrap', | 
|                                 overflow: 'hidden', | 
|                                 textOverflow: 'ellipsis', | 
|                             }}> | 
|                                 {Common.camelToPascalWithSpaces(translate('table.field.operationRecord.namespace'))}: {record.namespace} | 
|                             </Typography> | 
|                             {/*  inherit, primary, secondary, textPrimary, textSecondary, error */} | 
|                             <Typography variant="h6" gutterBottom align="right" > | 
|                                 ID: {record.id} | 
|                             </Typography> | 
|                         </Grid> | 
|                     </Grid> | 
|                     <Grid container spacing={2}> | 
|                         <Grid item xs={12} container alignContent="flex-end"> | 
|                             <Typography variant="caption" color="textSecondary" sx={{ wordWrap: 'break-word', wordBreak: 'break-all' }}> | 
|                                 {Common.camelToPascalWithSpaces(translate('common.field.memo'))}:{record.memo} | 
|                             </Typography> | 
|                         </Grid> | 
|                     </Grid> | 
|                     <Box height={20}> </Box> | 
|                     <Grid container spacing={2}> | 
|                         <Grid item xs={6}> | 
|                             <PanelTypography | 
|                                 title="table.field.operationRecord.namespace"  | 
|                                 property={record.namespace} | 
|                             /> | 
|                         </Grid> | 
|                         <Grid item xs={6}> | 
|                             <PanelTypography | 
|                                 title="table.field.operationRecord.url"  | 
|                                 property={record.url} | 
|                             /> | 
|                         </Grid> | 
|                         <Grid item xs={6}> | 
|                             <PanelTypography | 
|                                 title="table.field.operationRecord.appkey"  | 
|                                 property={record.appkey} | 
|                             /> | 
|                         </Grid> | 
|                         <Grid item xs={6}> | 
|                             <PanelTypography | 
|                                 title="table.field.operationRecord.timestamp"  | 
|                                 property={record.timestamp} | 
|                             /> | 
|                         </Grid> | 
|                         <Grid item xs={6}> | 
|                             <PanelTypography | 
|                                 title="table.field.operationRecord.clientIp"  | 
|                                 property={record.clientIp} | 
|                             /> | 
|                         </Grid> | 
|                         <Grid item xs={6}> | 
|                             <PanelTypography | 
|                                 title="table.field.operationRecord.request"  | 
|                                 property={record.request} | 
|                             /> | 
|                         </Grid> | 
|                         <Grid item xs={6}> | 
|                             <PanelTypography | 
|                                 title="table.field.operationRecord.response"  | 
|                                 property={record.response} | 
|                             /> | 
|                         </Grid> | 
|                         <Grid item xs={6}> | 
|                             <PanelTypography | 
|                                 title="table.field.operationRecord.spendTime"  | 
|                                 property={record.spendTime} | 
|                             /> | 
|                         </Grid> | 
|                         <Grid item xs={6}> | 
|                             <PanelTypography | 
|                                 title="table.field.operationRecord.err"  | 
|                                 property={record.err} | 
|                             /> | 
|                         </Grid> | 
|                         <Grid item xs={6}> | 
|                             <PanelTypography | 
|                                 title="table.field.operationRecord.result"  | 
|                                 property={record.result$} | 
|                             /> | 
|                         </Grid> | 
|                         <Grid item xs={6}> | 
|                             <PanelTypography | 
|                                 title="table.field.operationRecord.userId"  | 
|                                 property={record.userId$} | 
|                             /> | 
|                         </Grid> | 
|   | 
|                     </Grid> | 
|                 </CardContent> | 
|             </Card > | 
|         </> | 
|     ); | 
| }; | 
|   | 
| export default OperationRecordPanel; |