]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stats: fix confirmation links on the stats interface
authorWilly Tarreau <w@1wt.eu>
Fri, 19 Apr 2013 10:16:55 +0000 (12:16 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 19 Apr 2013 10:16:55 +0000 (12:16 +0200)
The confirmation link on the web interface forgets to set the displaying
options, so that when one clicks on "[X] Action processed successfully",
the auto-refresh, up/down and scope search settings are lost. We need to
pass all these info in the new link.

src/dumpstats.c

index 806d9c6d80078a4531df15d257e6f0f26bfe2405..168b0ade360cacf00ef9731adc3c86bf9f0d956c 100644 (file)
@@ -3252,58 +3252,79 @@ static void stats_dump_html_info(struct stream_interface *si, struct uri_auth *u
                case STAT_STATUS_DONE:
                        chunk_appendf(&trash,
                                      "<p><div class=active3>"
-                                     "<a class=lfsb href=\"%s\" title=\"Remove this message\">[X]</a> "
+                                     "<a class=lfsb href=\"%s%s%s%s\" title=\"Remove this message\">[X]</a> "
                                      "Action processed successfully."
-                                     "</div>\n", uri->uri_prefix);
+                                     "</div>\n", uri->uri_prefix,
+                                     (si->applet.ctx.stats.flags & STAT_HIDE_DOWN) ? ";up" : "",
+                                     (si->applet.ctx.stats.flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+                                     scope_txt);
                        break;
                case STAT_STATUS_NONE:
                        chunk_appendf(&trash,
                                      "<p><div class=active2>"
-                                     "<a class=lfsb href=\"%s\" title=\"Remove this message\">[X]</a> "
+                                     "<a class=lfsb href=\"%s%s%s%s\" title=\"Remove this message\">[X]</a> "
                                      "Nothing has changed."
-                                     "</div>\n", uri->uri_prefix);
+                                     "</div>\n", uri->uri_prefix,
+                                     (si->applet.ctx.stats.flags & STAT_HIDE_DOWN) ? ";up" : "",
+                                     (si->applet.ctx.stats.flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+                                     scope_txt);
                        break;
                case STAT_STATUS_PART:
                        chunk_appendf(&trash,
                                      "<p><div class=active2>"
-                                     "<a class=lfsb href=\"%s\" title=\"Remove this message\">[X]</a> "
+                                     "<a class=lfsb href=\"%s%s%s%s\" title=\"Remove this message\">[X]</a> "
                                      "Action partially processed.<br>"
                                      "Some server names are probably unknown or ambiguous (duplicated names in the backend)."
-                                     "</div>\n", uri->uri_prefix);
+                                     "</div>\n", uri->uri_prefix,
+                                     (si->applet.ctx.stats.flags & STAT_HIDE_DOWN) ? ";up" : "",
+                                     (si->applet.ctx.stats.flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+                                     scope_txt);
                        break;
                case STAT_STATUS_ERRP:
                        chunk_appendf(&trash,
                                      "<p><div class=active0>"
-                                     "<a class=lfsb href=\"%s\" title=\"Remove this message\">[X]</a> "
+                                     "<a class=lfsb href=\"%s%s%s%s\" title=\"Remove this message\">[X]</a> "
                                      "Action not processed because of invalid parameters."
                                      "<ul>"
                                      "<li>The action is maybe unknown.</li>"
                                      "<li>The backend name is probably unknown or ambiguous (duplicated names).</li>"
                                      "<li>Some server names are probably unknown or ambiguous (duplicated names in the backend).</li>"
                                      "</ul>"
-                                     "</div>\n", uri->uri_prefix);
+                                     "</div>\n", uri->uri_prefix,
+                                     (si->applet.ctx.stats.flags & STAT_HIDE_DOWN) ? ";up" : "",
+                                     (si->applet.ctx.stats.flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+                                     scope_txt);
                        break;
                case STAT_STATUS_EXCD:
                        chunk_appendf(&trash,
                                      "<p><div class=active0>"
-                                     "<a class=lfsb href=\"%s\" title=\"Remove this message\">[X]</a> "
+                                     "<a class=lfsb href=\"%s%s%s%s\" title=\"Remove this message\">[X]</a> "
                                      "<b>Action not processed : the buffer couldn't store all the data.<br>"
                                      "You should retry with less servers at a time.</b>"
-                                     "</div>\n", uri->uri_prefix);
+                                     "</div>\n", uri->uri_prefix,
+                                     (si->applet.ctx.stats.flags & STAT_HIDE_DOWN) ? ";up" : "",
+                                     (si->applet.ctx.stats.flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+                                     scope_txt);
                        break;
                case STAT_STATUS_DENY:
                        chunk_appendf(&trash,
                                      "<p><div class=active0>"
-                                     "<a class=lfsb href=\"%s\" title=\"Remove this message\">[X]</a> "
+                                     "<a class=lfsb href=\"%s%s%s%s\" title=\"Remove this message\">[X]</a> "
                                      "<b>Action denied.</b>"
-                                     "</div>\n", uri->uri_prefix);
+                                     "</div>\n", uri->uri_prefix,
+                                     (si->applet.ctx.stats.flags & STAT_HIDE_DOWN) ? ";up" : "",
+                                     (si->applet.ctx.stats.flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+                                     scope_txt);
                        break;
                default:
                        chunk_appendf(&trash,
                                      "<p><div class=active6>"
-                                     "<a class=lfsb href=\"%s\" title=\"Remove this message\">[X]</a> "
+                                     "<a class=lfsb href=\"%s%s%s%s\" title=\"Remove this message\">[X]</a> "
                                      "Unexpected result."
-                                     "</div>\n", uri->uri_prefix);
+                                     "</div>\n", uri->uri_prefix,
+                                     (si->applet.ctx.stats.flags & STAT_HIDE_DOWN) ? ";up" : "",
+                                     (si->applet.ctx.stats.flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+                                     scope_txt);
                }
                chunk_appendf(&trash, "<p>\n");
        }