Skip to content

Commit

Permalink
Improve rendering of VM descriptions
Browse files Browse the repository at this point in the history
Render the description as a single paragraph, with preserved line
breaks and word breaking on overflow.

Fixes cockpit-project#1888, cockpit-project#1890.
  • Loading branch information
mvollmer committed Nov 11, 2024
1 parent de46d0f commit d9d9051
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/vm/vmDetailsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ export const VmDetailsPage = ({
</div>
{
vm.inactiveXML.description &&
<div className="vm-description">
{vm.inactiveXML.description.split("\n").map((p, i) => <p key={i}>{p}</p>)}
</div>
<p className="vm-description">
{vm.inactiveXML.description}
</p>
}
</PageSection>
);
Expand Down
5 changes: 5 additions & 0 deletions src/machines.scss
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,8 @@
#storage-pool-delete-modal span.pf-v5-c-check__body {
margin-block-start: 0;
}

.vm-description {
white-space: pre-wrap;
overflow-wrap: break-word;
}

0 comments on commit d9d9051

Please sign in to comment.