@@ -484,6 +484,39 @@
</script>
<script>
+ // URLSearchParams subclass to make it easier to construct Bugzilla queries
+ class BZSearch extends URLSearchParams {
+ appendNotResolved() {
+ this.append("resolution", "---");
+ }
+
+ // appendQuery: add the specified field/operator/value as fN/oN/vN parameters.
+ appendQuery(field, operator, value) {
+ const index = this.nextFieldIndex();
+ this.append(`f${index}`, field);
+ this.append(`o${index}`, operator);
+ this.append(`v${index}`, value);
+ };
+
+ // appendOperator: add a logical operator (fN/vN) pair to the search
+ appendOperator(operator) {
+ const index = this.nextFieldIndex();
+ this.append(`f${index}`, "OP");
+ this.append(`j${index}`, operator);
+ };
+
+ // nextFieldIndex: return the next field number, searching for fields of the form f<int>.
+ nextFieldIndex() {
+ let max = -1;
+ for (const [key] of this) {
+ const match = /^f(\d+)$/.exec(key);
+ if (match)
+ max = Math.max(max, Number(match[1]));
+ }
+ return max + 1;
+ };
+ }
+
const serverUrl = "https://bugzilla.yoctoproject.org";
const ignoreProducts = [
@@ -604,7 +637,7 @@
}
function bugsByWhiteboard(keyword) {
- const params = new URLSearchParams({
+ const params = new BZSearch({
resolution: "---",
status_whiteboard: keyword,
status_whiteboard_type: "anywords",
@@ -613,7 +646,7 @@
}
function bugsByPriority(priority) {
- const params = new URLSearchParams({
+ const params = new BZSearch({
resolution: "---",
priority: priority
});
@@ -621,14 +654,14 @@
}
function bugsByStatus(status) {
- const params = new URLSearchParams({
+ const params = new BZSearch({
bug_status: status
});
return params;
}
function bugsInactive(operator) {
- const params = new URLSearchParams({
+ const params = new BZSearch({
resolution: "---",
f1: "days_elapsed",
o1: "greaterthaneq",
@@ -729,7 +762,7 @@
async function bugsOldMilestone() {
const activeMilestones = await activeMilestonesPromise;
- const params = new URLSearchParams({
+ const params = new BZSearch({
resolution: "---",
f1: "target_milestone",
o1: "notregexp",
Add a subclass of URLSearchParams that has some helper functions for constructing Bugzilla search queries. Change all constructors that use URLSearchParams to BZSearch. Signed-off-by: Ross Burton <ross.burton@arm.com> --- scripts/dashboard/bugtriage/index.html | 43 +++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 5 deletions(-)