diff mbox series

[yocto-autobuilder-helper,4/4] dashboard/bugtriage: Add a "View on Bugzilla" link

Message ID 20260313140029.805927-4-yoann.congal@smile.fr
State New
Headers show
Series [yocto-autobuilder-helper,1/4] dashboard/bugtriage: Re-order Wrong Milestone above Old bugs | expand

Commit Message

Yoann Congal March 13, 2026, 2 p.m. UTC
From: Yoann Congal <yoann.congal@smile.fr>

That link may be useful to jump from bugtriage page to bugzilla (e.g. to
then do bulk edit, ...)

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
 scripts/dashboard/bugtriage/index.html | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/scripts/dashboard/bugtriage/index.html b/scripts/dashboard/bugtriage/index.html
index 9a773aa..6c782dd 100644
--- a/scripts/dashboard/bugtriage/index.html
+++ b/scripts/dashboard/bugtriage/index.html
@@ -200,11 +200,11 @@ 
       ["assigned_to", "Owner"],
     ]);
 
-    function populateTable(selector, bugs) {
+    function populateTable(selector, bugs, bzlink) {
       if (bugs.length === 0) {
         const p = document.createElement("p");
         p.innerHTML = "<em>No bugs found</em>.";
-        document.querySelector(selector).replaceChildren(p);
+        document.querySelector(selector).replaceChildren(p, bzlink);
         return;
       }
 
@@ -230,7 +230,7 @@ 
       }
 
       const footer = table.appendChild(document.createElement("tfoot"));
-      footer.innerHTML = `<tr><td colspan="${fields.size}">${bugs.length} bugs found.</td></tr>`;
+      footer.innerHTML = `<tr><td colspan="${fields.size}">${bugs.length} bugs found. ${bzlink.outerHTML}</td></tr>`;
 
       sorttable.makeSortable(table);
 
@@ -245,7 +245,11 @@ 
       const spinner = document.createElement("div");
       spinner.setAttribute("class", "progress")
       spinner.innerHTML = `<div class="indeterminate"></div>`;
-      document.querySelector(selector).replaceChildren(spinner);
+      var bzlink = document.createElement("a");
+      var buglistURL = `${serverUrl}/buglist.cgi?${params}`;
+      bzlink.setAttribute("href", buglistURL);
+      bzlink.appendChild(document.createTextNode("View on Bugzilla"));
+      document.querySelector(selector).replaceChildren(spinner, bzlink);
 
       try {
 
@@ -255,7 +259,7 @@ 
         }
 
         const data = await response.json();
-        populateTable(selector, data.bugs);
+        populateTable(selector, data.bugs, bzlink);
       } catch (error) {
         console.error(`Failed to fetch bugs for ${selector}: ${error}`);
         alert("Error fetching bugs. Check the console for details.");