Fix system console plugin headers (#26196)

* Fix system console plugin headers

* Fix tests
This commit is contained in:
Daniel Espino García 2024-02-13 10:28:38 +01:00 committed by GitHub
parent 578216a5e4
commit 845f28cb76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 9 deletions

View File

@ -92,7 +92,9 @@ exports[`components/admin_console/SchemaAdminSettings should match snapshot with
<div
className="wrapper--fixed "
>
config
<AdminHeader>
config
</AdminHeader>
<div
className="admin-console__wrapper"
>

View File

@ -4,7 +4,9 @@ exports[`components/admin_console/CustomPluginSettings should match snapshot wit
<div
className="wrapper--fixed "
>
testplugin
<AdminHeader>
testplugin
</AdminHeader>
<div
className="admin-console__wrapper"
>
@ -233,7 +235,9 @@ exports[`components/admin_console/CustomPluginSettings should match snapshot wit
<div
className="wrapper--fixed "
>
testplugin
<AdminHeader>
testplugin
</AdminHeader>
<div
className="admin-console__wrapper"
>
@ -300,7 +304,9 @@ exports[`components/admin_console/CustomPluginSettings should match snapshot wit
<div
className="wrapper--fixed "
>
testplugin
<AdminHeader>
testplugin
</AdminHeader>
<div
className="admin-console__wrapper"
>

View File

@ -329,18 +329,24 @@ export class SchemaAdminSettings extends React.PureComponent<Props, State> {
if (!this.props.schema) {
return '';
}
if (!('name' in this.props.schema)) {
return this.props.schema.id;
let name: string | MessageDescriptor = this.props.schema.id;
if (('name' in this.props.schema)) {
name = this.props.schema.name;
}
if (typeof this.props.schema.name === 'string') {
return this.props.schema.name;
if (typeof name === 'string') {
return (
<AdminHeader>
{name}
</AdminHeader>
);
}
return (
<AdminHeader>
<FormattedMessage
{...this.props.schema.name}
{...name}
/>
</AdminHeader>
);