]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] add additional "a href"s to stats page
authorKrzysztof Piotr Oledzki <ole@ans.pl>
Sat, 24 Oct 2009 12:24:30 +0000 (14:24 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 27 Oct 2009 20:56:47 +0000 (21:56 +0100)
This patch adds <a href> html links for proxies, frontends, servers
and backends. Once located, can be clicked. Users no longer have to
manually add #anchor to stat's url.

src/dumpstats.c

index 70b96b5af80793893eead5dc6be5aee22a3e3e0a..1f0ae903573ecd65752018f13e37d45522c706fe 100644 (file)
@@ -989,6 +989,13 @@ int stats_dump_http(struct session *s, struct buffer *rep, struct uri_auth *uri)
                             ".backup6  {background: #e0e0e0;}\n"
                             ".rls      {letter-spacing: 0.2em; margin-right: 1px;}\n" /* right letter spacing (used for grouping digits) */
                             "\n"
+                            "a.px:link {color: #ffff40; text-decoration: none;}"
+                            "a.px:visited {color: #ffff40; text-decoration: none;}"
+                            "a.px:hover {color: #ffffff; text-decoration: none;}"
+                            "a.lfsb:link {color: #000000; text-decoration: none;}"
+                            "a.lfsb:visited {color: #000000; text-decoration: none;}"
+                            "a.lfsb:hover {color: #505050; text-decoration: none;}"
+                            "\n"
                             "table.tbl { border-collapse: collapse; border-style: none;}\n"
                             "table.tbl td { text-align: right; border-width: 1px 1px 1px 1px; border-style: solid solid solid solid; padding: 2px 3px; border-color: gray; white-space: nowrap;}\n"
                             "table.tbl td.ac { text-align: center;}\n"
@@ -1224,7 +1231,9 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
                        chunk_printf(&msg,
                                     "<table class=\"tbl\" width=\"100%%\">\n"
                                     "<tr class=\"titre\">"
-                                    "<th class=\"pxname\" width=\"10%%\"><a name=\"%s\">%s</a></th>"
+                                    "<th class=\"pxname\" width=\"10%%\">"
+                                    "<a name=\"%s\"></a>"
+                                    "<a class=px href=\"#%s\">%s</a></th>"
                                     "<th class=\"%s\" width=\"90%%\">%s</th>"
                                     "</tr>\n"
                                     "</table>\n"
@@ -1247,7 +1256,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
                                     "<th>Bck</th><th>Chk</th><th>Dwn</th><th>Dwntme</th>"
                                     "<th>Thrtle</th>\n"
                                     "</tr>",
-                                    px->id, px->id,
+                                    px->id, px->id, px->id,
                                     px->desc ? "desc" : "empty", px->desc ? px->desc : "");
 
                        if (buffer_feed_chunk(rep, &msg) >= 0)
@@ -1265,7 +1274,8 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
                                chunk_printf(&msg,
                                     /* name, queue */
                                     "<tr class=\"frontend\"><td class=ac>"
-                                    "<a name=\"%s/Frontend\">Frontend</a></td><td colspan=3></td>"
+                                    "<a name=\"%s/Frontend\"></a>"
+                                    "<a class=lfsb href=\"#%s/Frontend\">Frontend</a></td><td colspan=3></td>"
                                     /* sessions rate : current, max, limit */
                                     "<td>%s</td><td>%s</td><td>%s</td>"
                                     /* sessions : current, max, limit, total, lbtot */
@@ -1274,7 +1284,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
                                     /* bytes : in, out */
                                     "<td>%s</td><td>%s</td>"
                                     "",
-                                    px->id,
+                                    px->id, px->id,
                                     U2H0(read_freq_ctr(&px->fe_sess_per_sec)),
                                     U2H1(px->counters.fe_sps_max), LIM2A2(px->fe_sps_lim, "-"),
                                     U2H3(px->feconn), U2H4(px->counters.feconn_max), U2H5(px->maxconn),
@@ -1491,7 +1501,9 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
                                                               "<i>no check</i>" };
                                chunk_printf(&msg,
                                     /* name */
-                                    "<tr class=\"%s%d\"><td class=ac><a name=\"%s/%s\">%s</a></td>"
+                                    "<tr class=\"%s%d\"><td class=ac>"
+                                    "<a name=\"%s/%s\"></a>"
+                                    "<a class=lfsb href=\"#%s/%s\">%s</a></td>"
                                     /* queue : current, max, limit */
                                     "<td>%s</td><td>%s</td><td>%s</td>"
                                     /* sessions rate : current, max, limit */
@@ -1501,7 +1513,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
                                     "<td"
                                     "",
                                     (sv->state & SRV_BACKUP) ? "backup" : "active",
-                                    sv_state, px->id, sv->id, sv->id,
+                                    sv_state, px->id, sv->id, px->id, sv->id, sv->id,
                                     U2H0(sv->nbpend), U2H1(sv->counters.nbpend_max), LIM2A2(sv->maxqueue, "-"),
                                     U2H3(read_freq_ctr(&sv->sess_per_sec)), U2H4(sv->counters.sps_max),
                                     U2H5(sv->cur_sess), U2H6(sv->counters.cur_sess_max), LIM2A7(sv->maxconn, "-"));
@@ -1749,13 +1761,14 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
                                chunk_printf(&msg,
                                     /* name */
                                     "<tr class=\"backend\"><td class=ac>"
-                                    "<a name=\"%s/Backend\">Backend</a></td>"
+                                    "<a name=\"%s/Backend\"></a>"
+                                    "<a class=lfsb href=\"#%s/Backend\">Backend</a></td>"
                                     /* queue : current, max */
                                     "<td>%s</td><td>%s</td><td></td>"
                                     /* sessions rate : current, max, limit */
                                     "<td>%s</td><td>%s</td><td></td>"
                                     "",
-                                    px->id,
+                                    px->id, px->id,
                                     U2H0(px->nbpend) /* or px->totpend ? */, U2H1(px->counters.nbpend_max),
                                     U2H2(read_freq_ctr(&px->be_sess_per_sec)), U2H3(px->counters.be_sps_max));