Skip to content

Commit bf4c07f

Browse files
committed
Add triage statuses
1 parent ac34075 commit bf4c07f

15 files changed

Lines changed: 256 additions & 154 deletions

server/frontend/src/components/Buckets/HideBucketBtn.vue

Lines changed: 0 additions & 50 deletions
This file was deleted.

server/frontend/src/components/Buckets/HideBucketBtnForm.vue

Lines changed: 0 additions & 60 deletions
This file was deleted.

server/frontend/src/components/Buckets/List.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ export default {
293293
pageSize: 100,
294294
queryError: "",
295295
queryStr: JSON.stringify(
296-
{ op: "AND", bug__isnull: true, hide_until__isnull: true },
296+
{ op: "AND", bug__isnull: true, triage_status__isnull: true },
297297
null,
298298
2,
299299
),
@@ -325,7 +325,7 @@ export default {
325325
return !this.queryStr.includes('"bug__isnull": true');
326326
},
327327
showHidden() {
328-
return !this.queryStr.includes('"hide_until__isnull": true');
328+
return !this.queryStr.includes('"triage_status__isnull": true');
329329
},
330330
},
331331
created() {
@@ -385,15 +385,15 @@ export default {
385385
if (this.showHidden) {
386386
this.queryStr = JSON.stringify(
387387
Object.assign(
388-
{ hide_until__isnull: true },
388+
{ triage_status__isnull: true },
389389
JSON.parse(this.queryStr),
390390
),
391391
null,
392392
2,
393393
);
394394
} else {
395395
const query = JSON.parse(this.queryStr);
396-
delete query["hide_until__isnull"];
396+
delete query["triage_status__isnull"];
397397
this.queryStr = JSON.stringify(query, null, 2);
398398
}
399399
this.fetch();
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
<template>
2+
<div class="triage-bucket-dropdown">
3+
<a class="btn btn-default" @click="showPanel">
4+
{{ currentStatus ? "Change triage status" : "Mark triaged" }}
5+
</a>
6+
7+
<div v-if="isPanelVisible" class="triage-panel">
8+
<div class="panel-header">Select triage status:</div>
9+
<div class="panel-options">
10+
<a
11+
v-for="choice in choices"
12+
:key="choice.value"
13+
class="panel-option"
14+
:class="{ 'panel-option-selected': choice.value === currentStatus }"
15+
@click="choice.value !== currentStatus && selectStatus(choice.value)"
16+
>
17+
<span v-if="choice.value === currentStatus">✓ </span
18+
>{{ choice.label }}
19+
</a>
20+
<a
21+
v-if="currentStatus"
22+
class="panel-option panel-option-unmark"
23+
@click="selectStatus(null)"
24+
>Unmark triaged</a
25+
>
26+
</div>
27+
<div class="panel-footer">
28+
<a class="btn btn-sm btn-default" @click="hidePanel">Cancel</a>
29+
</div>
30+
</div>
31+
32+
<div v-if="isPanelVisible" class="panel-backdrop" @click="hidePanel"></div>
33+
</div>
34+
</template>
35+
36+
<script>
37+
export default {
38+
name: "TriageBucketDropdown",
39+
props: {
40+
bucketId: {
41+
type: Number,
42+
required: true,
43+
},
44+
currentStatus: {
45+
type: String,
46+
default: null,
47+
},
48+
choices: {
49+
type: Array,
50+
default: () => [],
51+
},
52+
},
53+
emits: ["update"],
54+
data() {
55+
return {
56+
isPanelVisible: false,
57+
};
58+
},
59+
methods: {
60+
showPanel() {
61+
this.isPanelVisible = true;
62+
},
63+
hidePanel() {
64+
this.isPanelVisible = false;
65+
},
66+
selectStatus(status) {
67+
this.isPanelVisible = false;
68+
this.$emit("update", status);
69+
},
70+
},
71+
};
72+
</script>
73+
74+
<style scoped>
75+
.triage-bucket-dropdown {
76+
display: inline-block;
77+
position: relative;
78+
}
79+
80+
.triage-panel {
81+
position: absolute;
82+
top: 100%;
83+
left: 0;
84+
margin-top: 5px;
85+
background: white;
86+
border: 1px solid #ccc;
87+
border-radius: 4px;
88+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
89+
z-index: 1000;
90+
min-width: 200px;
91+
}
92+
93+
.panel-header {
94+
padding: 10px 15px;
95+
border-bottom: 1px solid #eee;
96+
font-weight: bold;
97+
font-size: 14px;
98+
}
99+
100+
.panel-options {
101+
padding: 5px 0;
102+
}
103+
104+
.panel-option {
105+
display: block;
106+
padding: 8px 15px;
107+
cursor: pointer;
108+
color: #333;
109+
text-decoration: none;
110+
}
111+
112+
.panel-option:hover {
113+
background-color: #f5f5f5;
114+
}
115+
116+
.panel-option-selected {
117+
background-color: #e6f3ff;
118+
color: #0066cc;
119+
cursor: default;
120+
pointer-events: none;
121+
}
122+
123+
.panel-option-unmark {
124+
border-top: 1px solid #eee;
125+
margin-top: 5px;
126+
color: #d9534f;
127+
}
128+
129+
.panel-footer {
130+
padding: 8px 15px;
131+
border-top: 1px solid #eee;
132+
text-align: right;
133+
}
134+
135+
.panel-backdrop {
136+
position: fixed;
137+
top: 0;
138+
left: 0;
139+
right: 0;
140+
bottom: 0;
141+
z-index: 999;
142+
}
143+
</style>

server/frontend/src/components/Buckets/View.vue

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,18 @@
3232
</td>
3333
<td v-else>
3434
No bug associated.
35-
<span v-if="bucket.hide_until"
36-
>Marked triaged until {{ formatDate(bucket.hide_until) }}.</span
35+
<span v-if="bucket.triage_status"
36+
>Marked triaged as: {{ bucket.triage_status_display }}.</span
3737
>
3838
<br v-if="canEdit" /><br v-if="canEdit" />
3939
<div v-if="canEdit" class="btn-group">
4040
<assignbutton :bucket="bucket.id" :providers="providers" />
41-
<hidebucketbutton
42-
v-if="!bucket.hide_until"
43-
:bucket="bucket.id"
41+
<TriageBucketDropdown
42+
:bucket-id="bucket.id"
43+
:current-status="bucket.triage_status"
44+
:choices="bucket.triage_status_choices || []"
45+
@update="handleTriageStatusUpdate"
4446
/>
45-
<a v-else class="btn btn-default" @click="unhide"
46-
>Unmark triaged</a
47-
>
4847
</div>
4948
<br v-if="canEdit" /><br v-if="canEdit" />
5049
<div v-if="canEdit" class="btn-group">
@@ -226,9 +225,9 @@ import {
226225
assignExternalBug,
227226
date,
228227
errorParser,
229-
hideBucketUntil,
230228
jsonPretty,
231229
parseHash,
230+
updateBucketTriageStatus,
232231
} from "../../helpers";
233232
import {
234233
etpStrictReportDescription,
@@ -240,7 +239,7 @@ import * as api from "../../api";
240239
import PageNav from "../PageNav.vue";
241240
import ActivityGraph from "../ActivityGraph.vue";
242241
import AssignBtn from "./AssignBtn.vue";
243-
import HideBucketBtn from "./HideBucketBtn.vue";
242+
import TriageBucketDropdown from "./TriageBucketDropdown.vue";
244243
import ReportPreviewRow from "./ReportPreviewRow.vue";
245244
246245
const pageSize = 50;
@@ -250,7 +249,7 @@ export default {
250249
activitygraph: ActivityGraph,
251250
assignbutton: AssignBtn,
252251
ClipLoader: LoadingSpinner,
253-
hidebucketbutton: HideBucketBtn,
252+
TriageBucketDropdown,
254253
PageNav: PageNav,
255254
ReportPreviewRow: ReportPreviewRow,
256255
},
@@ -400,15 +399,6 @@ export default {
400399
submitWatchForm() {
401400
this.$refs.bucketWatchForm.submit();
402401
},
403-
unhide() {
404-
hideBucketUntil(this.bucket.id, null)
405-
.then((data) => {
406-
window.location.href = data.url;
407-
})
408-
.catch((err) => {
409-
swal("Oops", errorParser(err), "error");
410-
});
411-
},
412402
unlink() {
413403
swal({
414404
title: "Unlink bug",
@@ -531,6 +521,14 @@ export default {
531521
searchParams.append("dependson", "tp-breakage");
532522
openPrefilledBugzillaBug(searchParams);
533523
},
524+
async handleTriageStatusUpdate(newStatus) {
525+
try {
526+
const data = await updateBucketTriageStatus(this.bucket.id, newStatus);
527+
window.location.href = data.url;
528+
} catch (err) {
529+
swal("Oops", errorParser(err), "error");
530+
}
531+
},
534532
},
535533
watch: {
536534
currentPage() {

server/frontend/src/helpers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ export const assignExternalBug = (bucketId, bugId, providerId) => {
8989
}
9090
};
9191

92-
export const hideBucketUntil = (bucketId, dateObj) => {
92+
export const updateBucketTriageStatus = (bucketId, triageStatus) => {
9393
const payload = {
94-
hide_until: dateObj ? dateObj.toISOString() : null,
94+
triage_status: triageStatus,
9595
};
9696

9797
try {

server/frontend/tests/buckets_list.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ afterEach(jest.resetAllMocks);
1616
const defaultQueryStr = `{
1717
"op": "AND",
1818
"bug__isnull": true,
19-
"hide_until__isnull": true
19+
"triage_status__isnull": true
2020
}`;
2121

2222
test("bucket list has no buckets", async () => {

0 commit comments

Comments
 (0)