Skip to content

Commit 2256bc8

Browse files
Add "Hide Bugs" filter to release notes view
1 parent b4ab623 commit 2256bc8

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

src/paths/index/components/changes/ReleaseNotesItem.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ export default class ReleaseNotesItem extends LitElement {
148148
this._copiableUnifiedText = "";
149149
this._copiableGroupedText = "";
150150
this._copyStatus = "idle";
151+
this._hideBugs = false;
151152
}
152153

153154
_onViewModeClicked(type) {
@@ -187,14 +188,26 @@ export default class ReleaseNotesItem extends LitElement {
187188
});
188189
}
189190

191+
_onBugChange(e) {
192+
this._hideBugs = e.target.checked;
193+
this._updateNotes();
194+
this.requestUpdate();
195+
}
196+
190197
_updateNotes() {
191198
this._sortedNotes = [];
192199
this._groupedNotes = [];
193200
this._copiableUnifiedText = "";
194201
this._copiableGroupedText = "";
195202

203+
// Filter pulls based on bug label and hide bugs checkbox
204+
const filteredPulls = this.pulls.filter((pull) => {
205+
const hasBugLabel = pull.labels && pull.labels.some(label => label.name === 'bug');
206+
return this._hideBugs ? !hasBugLabel : true;
207+
});
208+
196209
let groupedNotes = {};
197-
this.pulls.forEach((pull) => {
210+
filteredPulls.forEach((pull) => {
198211
// Store under the determined group.
199212
if (typeof groupedNotes[pull.group_name] === "undefined") {
200213
groupedNotes[pull.group_name] = [];
@@ -306,6 +319,22 @@ export default class ReleaseNotesItem extends LitElement {
306319
<div class="item-container">
307320
<div class="item-changes">
308321
<div class="item-changes-types">
322+
<span
323+
class="item-changes-type"
324+
@click="${() => {
325+
this._hideBugs = !this._hideBugs;
326+
this._updateNotes();
327+
this.requestUpdate();
328+
}}"
329+
>
330+
<input
331+
type="checkbox"
332+
.checked="${this._hideBugs}"
333+
@change="${this._onBugChange}"
334+
>
335+
Hide Bug Fixes
336+
</span>
337+
|
309338
<span
310339
class="item-changes-type ${(this._viewMode === "pretty" ? "item-changes--active" : "")}"
311340
@click="${this._onViewModeClicked.bind(this, "pretty")}"

0 commit comments

Comments
 (0)