update code to handle column headers without text (#27419)

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Scott Bishel
2024-06-24 08:50:25 -06:00
коммит произвёл GitHub
родитель 13109aeb98
Коммит 6a2078ecf0
3 изменённых файлов: 45 добавлений и 9 удалений

Просмотреть файл

@@ -88,6 +88,15 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
id="admin.systemUserDetail.teamList.header.role" id="admin.systemUserDetail.teamList.header.role"
/> />
</div> </div>
<div
className="AbstractList__header-label"
key="3"
style={
Object {
"width": "150px",
}
}
/>
</div> </div>
<div <div
className="AbstractList__body" className="AbstractList__body"
@@ -322,6 +331,15 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
id="admin.systemUserDetail.teamList.header.role" id="admin.systemUserDetail.teamList.header.role"
/> />
</div> </div>
<div
className="AbstractList__header-label"
key="3"
style={
Object {
"width": "150px",
}
}
/>
</div> </div>
<div <div
className="AbstractList__body" className="AbstractList__body"
@@ -556,6 +574,15 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
id="admin.systemUserDetail.teamList.header.role" id="admin.systemUserDetail.teamList.header.role"
/> />
</div> </div>
<div
className="AbstractList__header-label"
key="3"
style={
Object {
"width": "150px",
}
}
/>
</div> </div>
<div <div
className="AbstractList__body" className="AbstractList__body"

Просмотреть файл

@@ -65,6 +65,11 @@ describe('admin_console/system_user_detail/team_list/AbstractList', () => {
width: '150px', width: '150px',
}, },
}, },
{
style: {
width: '150px',
},
},
]; ];
const defaultProps = { const defaultProps = {

Просмотреть файл

@@ -104,15 +104,19 @@ export default class AbstractList extends React.PureComponent<Props, State> {
if (this.props.data.length > 0) { if (this.props.data.length > 0) {
return ( return (
<div className='AbstractList__header'> <div className='AbstractList__header'>
{this.props.headerLabels.map((headerLabel, id) => ( {this.props.headerLabels.map((headerLabel, id) => {
<div const key = id;
key={id} const message = headerLabel.label ? <FormattedMessage {...headerLabel.label}/> : '';
className='AbstractList__header-label' return (
style={headerLabel.style} <div
> key={key}
<FormattedMessage {...headerLabel.label}/> className='AbstractList__header-label'
</div> style={headerLabel.style}
))} >
{message}
</div>
);
})}
</div> </div>
); );
} }