diff mbox series

[yocto-autobuilder-helper,6/8] dashboard/bugtriage: move common query setup to BZSearch's constructor

Message ID 20260911210351.2020798-6-ross.burton@arm.com
State New
Headers show
Series [yocto-autobuilder-helper,1/8] dashboard/bugtriage: reformat HTML | expand

Commit Message

Ross Burton Sept. 11, 2026, 9:03 p.m. UTC
Use .appendQuery() for neater code.

This consolidates the query construction into a single location.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 scripts/dashboard/bugtriage/index.html | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/scripts/dashboard/bugtriage/index.html b/scripts/dashboard/bugtriage/index.html
index a9ccf2e7..939dd8fb 100644
--- a/scripts/dashboard/bugtriage/index.html
+++ b/scripts/dashboard/bugtriage/index.html
@@ -486,6 +486,17 @@ 
   <script>
     // URLSearchParams subclass to make it easier to construct Bugzilla queries
     class BZSearch extends URLSearchParams {
+      constructor(...args) {
+        super(...args);
+
+        // Filter to just the fields we want
+        this.append("include_fields", Array.from(fields.keys()).join());
+
+        // Ignore specific products and components.
+        this.appendQuery("product", "notregexp", `^(${ignoreProducts.map((s) => escapeRegExp(s)).join("|")})$`);
+        this.appendQuery("component", "notregexp", `^(${ignoreComponents.map((s) => escapeRegExp(s)).join("|")})$`);
+      }
+
       appendNotResolved() {
         this.append("resolution", "---");
       }
@@ -604,18 +615,6 @@ 
       const reloadButton = container.querySelector('.reload-button')
       reloadButton.classList.toggle('spin')
 
-      params.append("include_fields", Array.from(fields.keys()).join());
-
-      // Ignore specific products and components. The field numbers are high so
-      // that caller's queries can use fields without conflicts.
-      params.append("f100", "product",)
-      params.append("o100", "notregexp",)
-      params.append("v100", `^(${ignoreProducts.map((s) => escapeRegExp(s)).join("|")})$`)
-
-      params.append("f101", "component",)
-      params.append("o101", "notregexp",)
-      params.append("v101", `^(${ignoreComponents.map((s) => escapeRegExp(s)).join("|")})$`)
-
       var bzlink = document.createElement("a");
       var buglistURL = `${serverUrl}/buglist.cgi?${params}`;
       bzlink.setAttribute("href", buglistURL);