Add cluster link UI (bug 26598)

Make it possible to break out the chart header. Then use that to display
stats for cluster links.
This commit is contained in:
Simon MacMullen 2015-02-20 12:48:29 +00:00
parent 1cfea228fc
commit 3821d1ed52
3 changed files with 60 additions and 6 deletions

View File

@ -72,7 +72,7 @@ input#truncate { width: 50px; text-align: right; }
table { border-collapse: collapse; }
table th { font-weight: normal; color: black; }
table th, table td { font: 12px/17px Verdana,sans-serif; padding: 4px; }
table th, table td { font: 12px Verdana,sans-serif; padding: 5px 4px; }
table.list th, table.list td { vertical-align: top; min-width: 5em; width: auto; }
table.list { border-width: 1px; margin-bottom: 1em; }
@ -85,6 +85,10 @@ table.list th a.sort .arrow { color: #888; }
table.list td p { margin: 0; padding: 1px 0 0 0; }
table.list td p.warning { margin: 0; padding: 5px; }
table.list td.plain, table.list td.plain td, table.list td.plain th { border: none; background: none; }
table.list th.plain { border-left: none; border-top: none; border-right: none; background: none; }
table.list th.plain h3 { margin: 0; border: 0; }
#main .internal-purpose, #main .internal-purpose * { color: #aaa; }
div.section table.list, div.section-hidden table.list { margin-bottom: 0; }

View File

@ -31,15 +31,21 @@ function data_rates(id, stats) {
function rates_chart_or_text(id, stats, items, fmt, axis_fmt, chart_rates,
heading, heading_help) {
var mode = get_pref('rate-mode-' + id);
var range = get_pref('chart-range');
var prefix = chart_h3(id, heading, heading_help);
var res;
return prefix + rates_chart_or_text_no_heading(
id, id, stats, items, fmt, axis_fmt, chart_rates);
}
function rates_chart_or_text_no_heading(type_id, id, stats, items,
fmt, axis_fmt, chart_rates) {
var mode = get_pref('rate-mode-' + type_id);
var range = get_pref('chart-range');
var res;
if (keys(stats).length > 0) {
if (mode == 'chart') {
res = rates_chart(
id, id, items, stats, fmt, axis_fmt, 'full', chart_rates);
type_id, id, items, stats, fmt, axis_fmt, 'full', chart_rates);
}
else {
res = rates_text(items, stats, mode, fmt, chart_rates);
@ -49,7 +55,7 @@ function rates_chart_or_text(id, stats, items, fmt, axis_fmt, chart_rates,
else {
res = '<p>Currently idle</p>';
}
return prefix + res;
return res;
}
function chart_h3(id, heading, heading_help) {

View File

@ -173,9 +173,53 @@
fmt_ms, fmt_ms, false, 'I/O average time per operation') %>
</div>
</div>
<div class="section-hidden">
<h2>Cluster links</h2>
<div class="hider">
<% if (node.cluster_links.length > 0) { %>
<table class="list">
<tr>
<th>Remote node</th>
<th>Local address</th>
<th>Local port</th>
<th>Remote address</th>
<th>Remote port</th>
<th class="plain">
<%= chart_h3('cluster-link-data-rates', 'Data rates') %>
</th>
</tr>
<%
for (var i = 0; i < node.cluster_links.length; i++) {
var link = node.cluster_links[i];
%>
<tr<%= alt_rows(i)%>>
<td><%= link_node(link.name) %></td>
<td><%= fmt_string(link.sock_addr) %></td>
<td><%= fmt_string(link.sock_port) %></td>
<td><%= fmt_string(link.peer_addr) %></td>
<td><%= fmt_string(link.peer_port) %></td>
<td class="plain">
<%= rates_chart_or_text_no_heading(
'cluster-link-data-rates', 'cluster-link-data-rates' + link.name,
link.stats,
[['Recv', 'recv_bytes'],
['Send', 'send_bytes']],
fmt_rate_bytes, fmt_rate_bytes_axis, true) %>
</td>
</tr>
<% } %>
</table>
<% } else { %>
<p>... no cluster links ...</p>
<% } %>
</div>
</div>
<% } %>
</div>
<!--
The next two need to be non-updatable or we will wipe the memory details
as soon as we have drawn it.