diff mbox series

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

Message ID 20260317232902.2404326-5-yoann.congal@smile.fr
State New
Headers show
Series [yocto-autobuilder-helper,v2,1/5] dashboard/bugtriage: Add newline at EOL | expand

Commit Message

Yoann Congal March 17, 2026, 11:29 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 | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

Yoann Congal March 17, 2026, 11:37 p.m. UTC | #1
On Wed Mar 18, 2026 at 12:29 AM CET, Yoann Congal wrote:
> 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>
> ---

FYI, you can see it at
https://ycongal-smile.github.io/tmp/scripts/dashboard/bugtriage/index.html

>  scripts/dashboard/bugtriage/index.html | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/dashboard/bugtriage/index.html b/scripts/dashboard/bugtriage/index.html
> index 758284d..c154c9e 100644
> --- a/scripts/dashboard/bugtriage/index.html
> +++ b/scripts/dashboard/bugtriage/index.html
> @@ -491,10 +491,11 @@
>        navLink.innerText = `(${bugCount})`
>      }
>  
> -    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>.";
> +        p.innerHTML += " " + bzlink.outerHTML;
>          document.querySelector(selector).replaceChildren(p);
>          appendBugCount(selector, 0)
>          return;
> @@ -525,7 +526,7 @@
>        }
>  
>        const footer = table.appendChild(document.createElement("tfoot"));
> -      footer.innerHTML = `<tr><td colspan="${fields.size}">${bugs.length} bug${bugs.length > 1 ? 's' : ''} found</td></tr>`;
> +      footer.innerHTML = `<tr><td colspan="${fields.size}">${bugs.length} bug${bugs.length > 1 ? 's' : ''} found. ${bzlink.outerHTML}</td></tr>`;
>  
>        appendBugCount(selector, bugs.length)
>  
> @@ -546,6 +547,11 @@
>        params.append("o0", "notregexp",)
>        params.append("v0", `^(${ignoreProducts.map((s) => escapeRegExp(s)).join("|")})$`)
>  
> +      var bzlink = document.createElement("a");
> +      var buglistURL = `${serverUrl}/buglist.cgi?${params}`;
> +      bzlink.setAttribute("href", buglistURL);
> +      bzlink.appendChild(document.createTextNode("View on Bugzilla"));
> +
>        try {
>          const response = await fetch(`${serverUrl}/rest/bug?${params}`);
>          if (!response.ok) {
> @@ -553,7 +559,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.");
diff mbox series

Patch

diff --git a/scripts/dashboard/bugtriage/index.html b/scripts/dashboard/bugtriage/index.html
index 758284d..c154c9e 100644
--- a/scripts/dashboard/bugtriage/index.html
+++ b/scripts/dashboard/bugtriage/index.html
@@ -491,10 +491,11 @@ 
       navLink.innerText = `(${bugCount})`
     }
 
-    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>.";
+        p.innerHTML += " " + bzlink.outerHTML;
         document.querySelector(selector).replaceChildren(p);
         appendBugCount(selector, 0)
         return;
@@ -525,7 +526,7 @@ 
       }
 
       const footer = table.appendChild(document.createElement("tfoot"));
-      footer.innerHTML = `<tr><td colspan="${fields.size}">${bugs.length} bug${bugs.length > 1 ? 's' : ''} found</td></tr>`;
+      footer.innerHTML = `<tr><td colspan="${fields.size}">${bugs.length} bug${bugs.length > 1 ? 's' : ''} found. ${bzlink.outerHTML}</td></tr>`;
 
       appendBugCount(selector, bugs.length)
 
@@ -546,6 +547,11 @@ 
       params.append("o0", "notregexp",)
       params.append("v0", `^(${ignoreProducts.map((s) => escapeRegExp(s)).join("|")})$`)
 
+      var bzlink = document.createElement("a");
+      var buglistURL = `${serverUrl}/buglist.cgi?${params}`;
+      bzlink.setAttribute("href", buglistURL);
+      bzlink.appendChild(document.createTextNode("View on Bugzilla"));
+
       try {
         const response = await fetch(`${serverUrl}/rest/bug?${params}`);
         if (!response.ok) {
@@ -553,7 +559,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.");