From: Amaury Denoyelle Date: Tue, 3 Nov 2020 14:04:46 +0000 (+0100) Subject: MINOR: stats: do not display empty stat module title on html X-Git-Tag: v2.3.0~20 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=e6ee820c07a503f88c767a6800c2ea4e2f346012;p=haproxy-2.5.git MINOR: stats: do not display empty stat module title on html If a stat module is not available on the current proxy scope, do not display its title on the related html box. This is clearer for the user. --- diff --git a/src/stats.c b/src/stats.c index 82e2b1f..762672f 100644 --- a/src/stats.c +++ b/src/stats.c @@ -949,22 +949,24 @@ static int stats_dump_fields_html(struct buffer *out, if (flags & STAT_SHMODULES) { list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) { - chunk_appendf(out, - "%s
", - mod->name); + chunk_appendf(out, "
"); + if (stats_px_get_cap(mod->domain_flags) & STATS_PX_CAP_FE) { + chunk_appendf(out, + "%s
", + mod->name); for (j = 0; j < mod->stats_count; ++j) { chunk_appendf(out, "", mod->stats[j].desc, field_to_html_str(&stats[ST_F_TOTAL_FIELDS + i])); ++i; } + chunk_appendf(out, "
%s%s
"); } else { i += mod->stats_count; } - chunk_appendf(out, - "
"); + chunk_appendf(out, ""); } } @@ -1033,22 +1035,24 @@ static int stats_dump_fields_html(struct buffer *out, if (flags & STAT_SHMODULES) { list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) { - chunk_appendf(out, - "%s
", - mod->name); + chunk_appendf(out, "
"); + if (stats_px_get_cap(mod->domain_flags) & STATS_PX_CAP_LI) { + chunk_appendf(out, + "%s
", + mod->name); for (j = 0; j < mod->stats_count; ++j) { chunk_appendf(out, "", mod->stats[j].desc, field_to_html_str(&stats[ST_F_TOTAL_FIELDS + i])); ++i; } + chunk_appendf(out, "
%s%s
"); } else { i += mod->stats_count; } - chunk_appendf(out, - "
"); + chunk_appendf(out, ""); } } @@ -1371,22 +1375,24 @@ static int stats_dump_fields_html(struct buffer *out, if (flags & STAT_SHMODULES) { list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) { - chunk_appendf(out, - "%s
", - mod->name); + chunk_appendf(out, "
"); + if (stats_px_get_cap(mod->domain_flags) & STATS_PX_CAP_SRV) { + chunk_appendf(out, + "%s
", + mod->name); for (j = 0; j < mod->stats_count; ++j) { chunk_appendf(out, "", mod->stats[j].desc, field_to_html_str(&stats[ST_F_TOTAL_FIELDS + i])); ++i; } + chunk_appendf(out, "
%s%s
"); } else { i += mod->stats_count; } - chunk_appendf(out, - "
"); + chunk_appendf(out, ""); } } @@ -1562,21 +1568,24 @@ static int stats_dump_fields_html(struct buffer *out, if (flags & STAT_SHMODULES) { list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) { - chunk_appendf(out, - "%s
", - mod->name); + chunk_appendf(out, "
"); + if (stats_px_get_cap(mod->domain_flags) & STATS_PX_CAP_BE) { + chunk_appendf(out, + "%s
", + mod->name); for (j = 0; j < mod->stats_count; ++j) { chunk_appendf(out, "", mod->stats[j].desc, field_to_html_str(&stats[ST_F_TOTAL_FIELDS + i])); ++i; } + chunk_appendf(out, "
%s%s
"); } else { i += mod->stats_count; } - chunk_appendf(out, - "
"); + + chunk_appendf(out, ""); } }