Skip to content

Commit a73b26c

Browse files
authored
Merge pull request #553 from RedHatProductSecurity/task/OSIDB-3993-conditional-label-display
✨ Hide labels that have contributor assigned
2 parents e1d51d7 + cbfb1de commit a73b26c

File tree

4 files changed

+83
-10
lines changed

4 files changed

+83
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
### Changed
1212
* Show privacy notice to users only once (`OSIDB-4077`)
13+
* Hide labels that are already assigned to a contributor on flaw queue (`OSIDB-3993`)
1314

1415
## [2025.3.1]
1516
### Fixed

src/components/IssueQueue/IssueQueueItem.vue

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,22 @@ function getLabelColor(label: string, type: string): string {
9191
class="badge rounded-pill text-bg-danger border border-primary"
9292
>Embargoed</span>
9393
<template v-if="showLabels">
94-
<span
94+
<template
9595
v-for="label in sortedLabels"
9696
:key="label.label"
97-
:style="{ backgroundColor: getLabelColor(label.label, label.type) }"
98-
class="badge rounded-pill border"
99-
:class="{
100-
'text-bg-warning fw-bold border-warning': label.state == 'REQ',
101-
'text-black': label.state != 'REQ' && label.relevant,
102-
'text-decoration-line-through text-bg-gray border-secondary': !label.relevant,
103-
}"
104-
:title="label.state == 'REQ' ? 'Requested' : ''"
105-
>{{ label.label }}</span>
97+
>
98+
<span
99+
v-if="!label.contributor"
100+
:style="{ backgroundColor: getLabelColor(label.label, label.type) }"
101+
class="badge rounded-pill border"
102+
:class="{
103+
'text-bg-warning fw-bold border-warning': label.state == 'REQ',
104+
'text-black': label.state != 'REQ' && label.relevant,
105+
'text-decoration-line-through text-bg-gray border-secondary': !label.relevant,
106+
}"
107+
:title="label.state === 'REQ' ? 'Requested' : ''"
108+
>{{ label.label }}</span>
109+
</template>
106110
</template>
107111
</div>
108112
</td>

src/components/__tests__/IssueQueue.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,23 @@ describe('issueQueue', () => {
215215
expect(wrapper.html()).toMatchSnapshot();
216216
});
217217

218+
it('should not render flaw labels that are already assigned', () => {
219+
const wrapper = mountIssueQueue({
220+
issues: [{
221+
...mockData[0],
222+
labels: [
223+
{ label: 'test', state: 'REQ', contributor: 'test' },
224+
{ label: 'test-2', state: 'NEW', contributor: 'test-2' },
225+
],
226+
} as ZodFlawType],
227+
});
228+
229+
const labels = wrapper.findComponent(IssueQueueItem).findAll('span.badge');
230+
231+
expect(labels.length).toBe(0);
232+
expect(wrapper.html()).toMatchSnapshot();
233+
});
234+
218235
it('should not render flaw labels when isHidingLabels is true', async () => {
219236
const wrapper = mountIssueQueue({
220237
issues: [{

src/components/__tests__/__snapshots__/IssueQueue.spec.ts.snap

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,56 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3+
exports[`issueQueue > should not render flaw labels that are already assigned 1`] = `
4+
"<div data-v-48717bcb="" class="osim-content container-fluid osim-issue-queue">
5+
<div data-v-48717bcb="" class="osim-incident-filter">
6+
<div data-v-b2ceeac4="" data-v-48717bcb="" class="osim-input ps-3 d-inline-block d-inline-block"><label data-v-b2ceeac4="" class="form-check h-100 d-inline-block ps-4 p-1"><input data-v-b2ceeac4="" class="d-inline-block form-check-input" type="checkbox"><span data-v-b2ceeac4="" class="form-check-label">My Issues</span></label></div>
7+
<div data-v-b2ceeac4="" data-v-48717bcb="" class="osim-input ps-3 d-inline-block d-inline-block"><label data-v-b2ceeac4="" class="form-check h-100 d-inline-block ps-4 p-1"><input data-v-b2ceeac4="" class="d-inline-block form-check-input" type="checkbox"><span data-v-b2ceeac4="" class="form-check-label">Open Issues</span></label></div>
8+
<div data-v-b2ceeac4="" data-v-48717bcb="" class="osim-input ps-3 d-inline-block d-inline-block"><label data-v-b2ceeac4="" class="form-check h-100 d-inline-block ps-4 p-1"><input data-v-b2ceeac4="" class="d-inline-block form-check-input" type="checkbox"><span data-v-b2ceeac4="" class="form-check-label">Hide labels</span></label></div>
9+
<!--v-if--><span data-v-48717bcb="" class="float-end"> Loaded 1 of 10</span>
10+
</div>
11+
<div data-v-48717bcb="" class="osim-incident-list">
12+
<table data-v-48717bcb="" class="table align-middle">
13+
<thead data-v-48717bcb="" class="sticky-top">
14+
<!-- <thead class=""> -->
15+
<tr data-v-48717bcb="">
16+
<th data-v-48717bcb="">ID <i data-v-48717bcb="" class="opacity-0 bi-caret-down-fill bi"></i></th>
17+
<th data-v-48717bcb="">Impact <i data-v-48717bcb="" class="opacity-0 bi-caret-down-fill bi"></i></th>
18+
<th data-v-48717bcb="">Created <i data-v-48717bcb="" class="bi-caret-down-fill bi"></i></th>
19+
<th data-v-48717bcb="">Title <i data-v-48717bcb="" class="opacity-0 bi-caret-down-fill bi"></i></th>
20+
<th data-v-48717bcb="">State <i data-v-48717bcb="" class="opacity-0 bi-caret-down-fill bi"></i></th>
21+
<th data-v-48717bcb="">Owner <i data-v-48717bcb="" class="opacity-0 bi-caret-down-fill bi"></i></th>
22+
</tr>
23+
</thead>
24+
<tbody data-v-48717bcb="" class="table-group-divider">
25+
<tr data-v-15d9c71d="" class="osim-issue-queue-item osim-shaded">
26+
<td data-v-15d9c71d="" class="osim-issue-title pb-0"><a data-v-15d9c71d="" href="/flaws/CVE-2903-0092" class="">CVE-2903-0092</a></td>
27+
<td data-v-15d9c71d="" class="pb-0">MODERATE</td>
28+
<td data-v-15d9c71d="" class="pb-0">2021-07-29</td>
29+
<td data-v-15d9c71d="" class="pb-0">title</td>
30+
<td data-v-15d9c71d="" class="pb-0">NEW</td>
31+
<td data-v-15d9c71d="" class="pb-0">[email protected]</td>
32+
<!--<td>{{ issue.assigned }}</td>-->
33+
</tr>
34+
<tr data-v-15d9c71d="" class="osim-badge-lane osim-shaded">
35+
<td data-v-15d9c71d="" colspan="1">
36+
<div data-v-15d9c71d="" class="gap-1 d-flex flex-wrap">
37+
<!--v-if-->
38+
<!--v-if-->
39+
<!--v-if-->
40+
</div>
41+
</td>
42+
<td data-v-15d9c71d="" colspan="90%"></td>
43+
</tr>
44+
</tbody>
45+
</table><button data-v-48717bcb="" class="btn btn-primary" type="button">
46+
<!--v-if--><span data-v-48717bcb=""> Load More Flaws </span>
47+
</button>
48+
<!--v-if-->
49+
<!--v-if-->
50+
</div>
51+
</div>"
52+
`;
53+
354
exports[`issueQueue > should not render flaw labels when isHidingLabels is true 1`] = `
455
"<div data-v-48717bcb="" class="osim-content container-fluid osim-issue-queue">
556
<div data-v-48717bcb="" class="osim-incident-filter">

0 commit comments

Comments
 (0)