@@ -10,7 +10,7 @@ import TableHead from '@mui/material/TableHead';
1010import TableBody from '@mui/material/TableBody' ;
1111import TableRow from '@mui/material/TableRow' ;
1212import TableCell from '@mui/material/TableCell' ;
13- import { map , get } from 'lodash'
13+ import { map , get , keys , flatten , uniq } from 'lodash'
1414import Link from '../common/Link'
1515import { formatWebsiteLink , formatDate , formatDateTime } from '../../common/utils'
1616
@@ -31,6 +31,41 @@ const EntityAttributesDialog = ({ entity, fields, open, onClose }) => {
3131 return < Link sx = { { fontSize : '14px' } } label = { value } href = { `#/users/${ value } /` } />
3232 if ( info . type === 'json' )
3333 return < pre > { JSON . stringify ( value , undefined , 2 ) } </ pre >
34+ if ( info . type === 'table' ) {
35+ if ( value ?. length > 0 ) {
36+ let columns = uniq ( flatten ( value . map ( val => keys ( val ) ) ) )
37+ return < Table size = 'small' sx = { { '.MuiTableCell-root' : { padding : '6px' , border : '1px solid rgba(0, 0, 0, 0.1)' } } } >
38+ < TableHead >
39+ < TableRow >
40+ {
41+ columns . map (
42+ col => < TableCell key = { col } sx = { { fontSize : '12px' } } > < b > { col } </ b > </ TableCell >
43+ )
44+ }
45+ </ TableRow >
46+ </ TableHead >
47+ < TableBody >
48+ {
49+ map ( value , ( val , index ) => (
50+ < TableRow key = { index } >
51+ {
52+ columns . map ( col => (
53+ < TableCell key = { col } >
54+ < span style = { { display : 'inline-block' , maxWidth : '200px' , wordBreak : 'break-all' } } >
55+ { val [ col ] || null }
56+ </ span >
57+ </ TableCell >
58+ ) )
59+ }
60+ </ TableRow >
61+ ) )
62+ }
63+ </ TableBody >
64+ </ Table >
65+ } else {
66+ return value
67+ }
68+ }
3469 }
3570 return value
3671 }
@@ -39,12 +74,12 @@ const EntityAttributesDialog = ({ entity, fields, open, onClose }) => {
3974 open = { open }
4075 onClose = { onClose }
4176 scroll = 'paper'
42- maxWidth = "sm "
77+ maxWidth = "lg "
4378 sx = { {
4479 '& .MuiDialog-paper' : {
4580 backgroundColor : 'surface.n92' ,
4681 borderRadius : '28px' ,
47- minWidth : '312px' ,
82+ minWidth : entity ?. properties ?. length > 0 ? '812px' : '312px' ,
4883 minHeight : '262px' ,
4984 padding : 0
5085 }
@@ -54,11 +89,11 @@ const EntityAttributesDialog = ({ entity, fields, open, onClose }) => {
5489 { entity . type } { t ( 'common.attributes' ) }
5590 </ DialogTitle >
5691 < DialogContent style = { { padding : '0 8px' } } >
57- < Table size = "small" >
92+ < Table size = "small" sx = { { '.MuiTableCell-root' : { padding : '6px' } } } >
5893 < TableHead >
5994 < TableRow >
60- < TableCell > < b > { t ( 'common.attribute' ) } </ b > </ TableCell >
61- < TableCell > < b > { t ( 'common.value' ) } </ b > </ TableCell >
95+ < TableCell sx = { { fontSize : '12px' } } > < b > { t ( 'common.attribute' ) } </ b > </ TableCell >
96+ < TableCell sx = { { fontSize : '12px' } } > < b > { t ( 'common.value' ) } </ b > </ TableCell >
6297 </ TableRow >
6398 </ TableHead >
6499 < TableBody >
@@ -69,8 +104,8 @@ const EntityAttributesDialog = ({ entity, fields, open, onClose }) => {
69104 key = { field }
70105 sx = { { '&:last-child td, &:last-child th' : { border : 0 } } }
71106 >
72- < TableCell component = "th" scope = "row" >
73- { info ?. label }
107+ < TableCell component = "th" scope = "row" sx = { { fontSize : '12px' , color : 'rgba(0, 0, 0, 0.7)' } } >
108+ < span style = { { maxWidth : '125px' , display : 'inline-block' } } > { info ?. label } </ span >
74109 </ TableCell >
75110 < TableCell > { getValue ( field , info ) } </ TableCell >
76111 </ TableRow >
0 commit comments