Skip to content

Commit

Permalink
lib: Support non-string ModalError.dialogErrorDetail
Browse files Browse the repository at this point in the history
The Kdump dialog sets this to a `<CodeBlockCode>` aka. `<pre>` element,
which cannot be a child of a `<p>`. However, we do need the `<p>` for
plain strings according to the PF docs. So do a type check and support
both cases.
  • Loading branch information
martinpitt committed Oct 24, 2023
1 parent 542e4b7 commit edefcc3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/lib/cockpit-components-inline-notification.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ InlineNotification.propTypes = {
export const ModalError = ({ dialogError, dialogErrorDetail, id, isExpandable }) => {
return (
<Alert id={id} variant='danger' isInline title={dialogError} isExpandable={!!isExpandable}>
{ dialogErrorDetail && <p> {dialogErrorDetail} </p> }
{ typeof dialogErrorDetail === 'string' ? <p>{dialogErrorDetail}</p> : dialogErrorDetail }
</Alert>
);
};

0 comments on commit edefcc3

Please sign in to comment.