Rework for updated info items.

This commit is contained in:
Simon MacMullen 2012-01-13 15:10:30 +00:00
parent d6595625fb
commit 0d1b112560
5 changed files with 30 additions and 36 deletions

View File

@ -145,6 +145,8 @@ acronym { background: #add; color: #222; padding: 2px 4px; border-radius: 2px; -
acronym.warning { background: #daa; }
.status acronym { background: none; color: inherit; padding: 0; border-bottom: 1px dotted; cursor: default; }
table.bindings { margin-bottom: 1em; }
td.binding-endpoint span.object { border: 1px solid #bbb; padding: 10px; border-radius: 10px; -moz-border-radius: 10px; }
td.binding-endpoint span.arrow { font-size: 200%; }

View File

@ -342,27 +342,34 @@ function fmt_node_host(node_host) {
return host + ' <small>(' + node_host + ')</small>';
}
function fmt_mem_blocked(blocked) {
if (blocked == 'if_publish') {
return '<div class="yellow">...</div>';
}
else if (blocked) {
return '<div class="red">Yes</div>';
}
else {
return '<div class="green">No</div>';
}
}
function fmt_connection_state(conn) {
var colour = 'green';
var text = conn.state;
var explanation;
function fmt_time_since_flow_ctl(time) {
if (time == 'never') {
return '<div class="green">Never</div>';
if (conn.last_blocked_by == 'mem' && conn.state == 'blocked') {
colour = 'red';
explanation = 'Memory alarm: Connection blocked.';
}
else if (conn.state == 'blocking') {
colour = 'yellow';
explanation = 'Memory alarm: Connection will block on publish.';
}
else if (conn.last_blocked_by == 'flow') {
var age = conn.last_blocked_age.toFixed();
if (age < 5) {
colour = 'yellow';
text = 'flow';
explanation = 'Connection publishing rate recently restricted by RabbitMQ.';
}
}
if (explanation) {
return '<div class="' + colour + '"><acronym title="' + explanation +
'">' + text + '</acronym></div>';
}
else {
var t = time.toFixed();
var colour = (t < 10) ? 'yellow' : 'green';
var ts = (t == 0) ? 'Now' : t + 's';
return '<div class="' + colour + '">' + ts + '</div>';
return '<div class="' + colour + '">' + text + '</div>';
}
}

View File

@ -164,11 +164,6 @@ HELP = {
<dd>Rate at which basic.return is sent to publishers for undeliverable messages published with the \'immediate\' flag set.</dd>\
</dl>',
'last-flow-controlled':
'Time since RabbitMQ last imposed flow control on this connection as it was attempting to publish too fast for the server to keep up. Connections which are flow controlled can still publish but at a reduced rate.',
'mem-blocked':
'Whether this connection is blocked due to the memory high watermark having been exceeded. Connections will be blocked if the watermark is exceeded and they attempt to publish a message.',
'foo': 'foo' // No comma.
};

View File

@ -64,17 +64,9 @@
<% if (connection.state) { %>
<table class="facts">
<tr>
<th>Last flow controlled <span class="help" id="last-flow-controlled"></th>
<td class="status"><%= fmt_time_since_flow_ctl(connection.time_since_flow_ctl) %></td>
</tr>
<tr>
<th>Blocked <span class="help" id="mem-blocked"></th>
<td class="status"><%= fmt_mem_blocked(connection.mem_blocked) %></td>
</tr>
<tr>
<th>State</th>
<td><%= connection.state %></td>
<td class="status"><%= fmt_connection_state(connection) %></td>
</tr>
<tr>
<th>Timeout</th>

View File

@ -21,8 +21,7 @@
<th><%= fmt_sort('Virtual host', 'vhost') %></th>
<% } %>
<th><%= fmt_sort('User name', 'user') %></th>
<th><%= fmt_sort('Flow ctl', 'time_since_flow_ctl') %> <span class="help" id="last-flow-controlled"></th>
<th><%= fmt_sort('Blocked', 'mem_blocked') %> <span class="help" id="mem-blocked"></th>
<th><%= fmt_sort('State', 'state') %></th>
</tr>
</thead>
<tbody>
@ -48,8 +47,7 @@
<td><%= fmt_string(connection.vhost) %></td>
<% } %>
<td><%= fmt_string(connection.user) %></td>
<td class="status"><%= fmt_time_since_flow_ctl(connection.time_since_flow_ctl) %></td>
<td class="status c"><%= fmt_mem_blocked(connection.mem_blocked) %></td>
<td class="status"><%= fmt_connection_state(connection) %></td>
</tr>
<% } %>
</tbody>