]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stats: Fix HTML output for the frontends heading
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 2 Dec 2019 10:29:04 +0000 (11:29 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 2 Dec 2019 10:40:04 +0000 (11:40 +0100)
Since the flag STAT_SHOWADMIN was removed, the frontends heading in the HTML
output appears unaligned because the space reserved for the checkbox (not
displayed for frontends) is not inserted.

This patch fixes the issue #390. It must be backported to 2.1.

src/stats.c

index 5954fe67f88f8dda0a4e260bc9327e8fb349427e..32236f4570d0796c76c3f56f43091b9d1e85c59b 100644 (file)
@@ -2020,14 +2020,17 @@ static void stats_dump_html_px_hdr(struct stream_interface *si, struct proxy *px
                      (appctx->ctx.stats.flags & STAT_SHLGNDS) ? "</u>":"",
                      px->desc ? "desc" : "empty", px->desc ? px->desc : "");
 
-       if ((px->cap & PR_CAP_BE) && px->srv && (appctx->ctx.stats.flags & STAT_ADMIN)) {
+       if (appctx->ctx.stats.flags & STAT_ADMIN) {
                /* Column heading for Enable or Disable server */
-        chunk_appendf(&trash,
-                "<th rowspan=2 width=1><input type=\"checkbox\" \
-                onclick=\"for(c in document.getElementsByClassName('%s-checkbox')) \
-                document.getElementsByClassName('%s-checkbox').item(c).checked = this.checked\"></th>",
-                px->id,
-                px->id);
+               if ((px->cap & PR_CAP_BE) && px->srv)
+                       chunk_appendf(&trash,
+                                     "<th rowspan=2 width=1><input type=\"checkbox\" "
+                                     "onclick=\"for(c in document.getElementsByClassName('%s-checkbox')) "
+                                     "document.getElementsByClassName('%s-checkbox').item(c).checked = this.checked\"></th>",
+                                     px->id,
+                                     px->id);
+               else
+                       chunk_appendf(&trash, "<th rowspan=2></th>");
        }
 
        chunk_appendf(&trash,