Skip to content

Commit 1f5c90e

Browse files
Merge pull request #9320 from liu-samuel/tag-list-customer-case
Making tags more readable
2 parents 06fdccb + 14fd627 commit 1f5c90e

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

app/javascript/components/miq-structured-list/miq-structured-list-body/value-tags/miq-structured-list-text.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ import classNames from 'classnames';
44

55
/** Component to print the text value inside a cell. */
66
const MiqStructuredListText = ({ value }) => {
7-
const text = (value === null || value === undefined ? '' : String(value));
8-
7+
let text;
8+
if (Array.isArray(value)) {
9+
text = value.join('\n');
10+
} else {
11+
text = (value === null || value === undefined ? '' : String(value));
12+
}
913
return (
1014
<div className={classNames(text ? 'expand' : '', 'wrap_text')}>
1115
{text}

app/javascript/spec/textual_summary/tests/__snapshots__/tag_group.test.js.snap

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,8 @@ exports[`TagGroup renders just fine 1`] = `
782782
<div
783783
className="expand wrap_text"
784784
>
785-
Policy,2
785+
Policy
786+
2
786787
</div>
787788
</MiqStructuredListText>
788789
</div>
@@ -1173,7 +1174,9 @@ exports[`TagGroup renders just fine 1`] = `
11731174
<div
11741175
className="expand wrap_text"
11751176
>
1176-
Policy,2,3
1177+
Policy
1178+
2
1179+
3
11771180
</div>
11781181
</MiqStructuredListText>
11791182
</div>

app/javascript/spec/textual_summary/tests/tag_group.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('TagGroup', () => {
3636
};
3737

3838
const wrapper = mount(<TagGroup items={tagData.items} title={tagData.title} />);
39-
expect(wrapper.html()).toContain('<div class="expand wrap_text">Policy,2</div>');
39+
expect(wrapper.html()).toContain('<div class="expand wrap_text">Policy\n2</div>');
4040
expect(wrapper.containsMatchingElement(<i className="fa fa-tag" />)).toEqual(true);
4141
});
4242
});

app/stylesheet/miq-structured-list.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
.wrap_text {
159159
width: 100%;
160160
word-break: break-all;
161+
white-space: pre-line;
161162
}
162163

163164
&.bordered-list {

0 commit comments

Comments
 (0)