From ab02b3f3456f1547fcbb6f7e564561711d3535e1 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 9 Oct 2019 11:11:46 +0200 Subject: [PATCH] MINOR: stats: get rid of the STAT_SHOWADMIN flag This flag is used to decide to show the check box in front of a proxy on the HTML stat page. It is always equal to STAT_ADMIN except when the proxy has no backend capability (i.e. a pure frontend) or has no server, in which case it's only used to avoid leaving an empty column at the beginning of the table. Not only this is pretty useless, but it also causes the columns not to align well when mixing multiple proxies with or without servers. Let's simply always use STAT_ADMIN and get rid of this flag. --- include/types/stats.h | 1 - src/stats.c | 14 ++++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/include/types/stats.h b/include/types/stats.h index ee16ac750..d078b676d 100644 --- a/include/types/stats.h +++ b/include/types/stats.h @@ -34,7 +34,6 @@ #define STAT_SHNODE 0x00000200 /* conf: show node name */ #define STAT_SHDESC 0x00000400 /* conf: show description */ #define STAT_SHLGNDS 0x00000800 /* conf: show legends */ -#define STAT_SHOWADMIN 0x00001000 /* conf: show the admin column */ #define STAT_BOUND 0x00800000 /* bound statistics to selected proxies/types/services */ #define STAT_STARTED 0x01000000 /* some output has occurred */ diff --git a/src/stats.c b/src/stats.c index afa2e305f..d464bd582 100644 --- a/src/stats.c +++ b/src/stats.c @@ -670,7 +670,7 @@ err: } /* Dump all fields from into using the HTML format. A column is - * reserved for the checkbox is STAT_SHOWADMIN is set in . Some extra info + * reserved for the checkbox is STAT_ADMIN is set in . Some extra info * are provided if STAT_SHLGNDS is present in . */ static int stats_dump_fields_html(struct buffer *out, @@ -684,7 +684,7 @@ static int stats_dump_fields_html(struct buffer *out, /* name, queue */ ""); - if (flags & STAT_SHOWADMIN) { + if (flags & STAT_ADMIN) { /* Column sub-heading for Enable or Disable server */ chunk_appendf(out, ""); } @@ -827,7 +827,7 @@ static int stats_dump_fields_html(struct buffer *out, } else if (stats[ST_F_TYPE].u.u32 == STATS_TYPE_SO) { chunk_appendf(out, ""); - if (flags & STAT_SHOWADMIN) { + if (flags & STAT_ADMIN) { /* Column sub-heading for Enable or Disable server */ chunk_appendf(out, ""); } @@ -932,7 +932,7 @@ static int stats_dump_fields_html(struct buffer *out, (stats[ST_F_BCK].u.u32) ? "backup" : "active", style); - if (flags & STAT_SHOWADMIN) + if (flags & STAT_ADMIN) chunk_appendf(out, "", field_str(stats, ST_F_PXNAME), @@ -1188,7 +1188,7 @@ static int stats_dump_fields_html(struct buffer *out, } else if (stats[ST_F_TYPE].u.u32 == STATS_TYPE_BE) { chunk_appendf(out, ""); - if (flags & STAT_SHOWADMIN) { + if (flags & STAT_ADMIN) { /* Column sub-heading for Enable or Disable server */ chunk_appendf(out, ""); } @@ -1356,9 +1356,7 @@ int stats_dump_one_line(const struct field *stats, unsigned int flags, struct pr { int ret; - if ((px->cap & PR_CAP_BE) && px->srv && (appctx->ctx.stats.flags & STAT_ADMIN)) - flags |= STAT_SHOWADMIN; - + flags |= appctx->ctx.stats.flags & STAT_ADMIN; if (appctx->ctx.stats.flags & STAT_FMT_HTML) ret = stats_dump_fields_html(&trash, stats, flags); else if (appctx->ctx.stats.flags & STAT_FMT_TYPED)