@@ -56,6 +56,10 @@ const OrgHeader = ({ org, members, onDeleteClick, canDelete, fetchMembers }) =>
5656 history . push ( org . url + 'repos/new' )
5757 }
5858
59+ const extrasKeys = Object . keys ( org . extras || { } )
60+ const hasCustomAttrs = extrasKeys . length > 0
61+ const extrasFields = Object . fromEntries ( extrasKeys . map ( key => [ `extras.${ key } ` , { label : key } ] ) )
62+
5963 return (
6064 < Paper component = "div" className = 'col-xs-12' sx = { { backgroundColor : 'surface.main' , boxShadow : 'none' , padding : '16px' , borderRadius : '8px 8px 0 0' , display : 'inline-flex' } } >
6165 {
@@ -85,22 +89,18 @@ const OrgHeader = ({ org, members, onDeleteClick, canDelete, fetchMembers }) =>
8589 < Property icon = { < LocationIcon sx = { iconStyle } /> } value = { org . location } />
8690 < Property icon = { < LinkIcon sx = { iconStyle } /> } value = { org ?. website } label = { formatWebsiteLink ( org ?. website , { color : 'inherit' } ) } />
8791 < Property icon = { < CompanyIcon sx = { iconStyle } /> } value = { org ?. company } />
88- < Property label = { < Link sx = { { fontSize : '14px' } } label = { t ( 'common.view_all_attributes' ) } onClick = { ( ) => setViewAll ( true ) } /> } />
92+ { hasCustomAttrs && < Property label = { < Link sx = { { fontSize : '14px' } } label = { t ( 'common.view_all_attributes' ) } onClick = { ( ) => setViewAll ( true ) } /> } /> }
8993 </ div >
9094 </ div >
91- < EntityAttributesDialog
92- fields = { {
93- company : { label : t ( 'user.company' ) } ,
94- extras : { label : t ( 'custom_attributes.label' ) , type : 'json' } ,
95- created_on : { label : t ( 'common.created_on' ) , type : 'datetime' } ,
96- updated_on : { label : t ( 'common.updated_on' ) , type : 'datetime' } ,
97- created_by : { label : t ( 'common.created_by' ) , type : 'user' } ,
98- updated_by : { label : t ( 'common.updated_by' ) , type : 'user' } ,
99- } }
100- entity = { org }
101- open = { viewAll }
102- onClose = { ( ) => setViewAll ( false ) }
103- />
95+ {
96+ hasCustomAttrs &&
97+ < EntityAttributesDialog
98+ fields = { extrasFields }
99+ entity = { org }
100+ open = { viewAll }
101+ onClose = { ( ) => setViewAll ( false ) }
102+ />
103+ }
104104 < Menu
105105 sx = { { '.MuiPaper-root' : { backgroundColor : 'surface.n94' } } }
106106 anchorEl = { anchorEl }
0 commit comments