Don't list policy as "none" if there is no policy, since it's a string anyway. It's more consistent to just not have it there.

This commit is contained in:
Simon MacMullen 2012-06-25 18:02:03 +01:00
parent 4a688b6554
commit 1476cf3da5
6 changed files with 15 additions and 13 deletions

View File

@ -6,8 +6,9 @@ SOCKETS_THRESHOLDS=[[1.0, 'red'],
PROCESS_THRESHOLDS=[[0.75, 'red'],
[0.5, 'yellow']];
function fmt_string(str) {
if (str == undefined) return UNKNOWN_REPR;
function fmt_string(str, unknown) {
if (unknown == undefined) unkown = UNKNOWN_REPR;
if (str == undefined) return unknown;
return fmt_escape_html("" + str);
}
@ -215,10 +216,6 @@ function fmt_exchange_type(type) {
'</acronym></div>';
}
function fmt_policy(policy) {
return policy == 'none' ? '' : fmt_escape_html(policy);
}
function fmt_exchange_url(name) {
return name == '' ? 'amq.default' : fmt_escape_html(name);
}

View File

@ -14,7 +14,7 @@
</tr>
<tr>
<th>Policy</th>
<td><%= fmt_policy(exchange.policy) %></td>
<td><%= fmt_string(exchange.policy, '') %></td>
</tr>
<% if (vhosts_interesting) { %>
<tr>

View File

@ -29,7 +29,7 @@
<% } %>
<td><%= link_exchange(exchange.vhost, exchange.name) %></td>
<td class="status c"><%= fmt_exchange_type(exchange.type) %></td>
<td class="c"><%= fmt_policy(exchange.policy) %></td>
<td class="c"><%= fmt_string(exchange.policy, '') %></td>
<td class="c"><%= fmt_parameters_short(exchange) %></td>
<td class="r"><%= fmt_rate(exchange.message_stats_in, 'publish', false) %></td>
</tr>

View File

@ -18,7 +18,7 @@
</tr>
<tr>
<th>Policy</th>
<td><%= fmt_policy(queue.policy) %></td>
<td><%= fmt_string(queue.policy, '') %></td>
</tr>
<tr>
<th>Exclusive owner</th>

View File

@ -64,7 +64,7 @@
<% } %>
</td>
<td class="c"><%= fmt_parameters_short(queue) %></td>
<td class="c"><%= fmt_policy(queue.policy) %></td>
<td class="c"><%= fmt_string(queue.policy, '') %></td>
<td class="c"><%= fmt_idle(queue) %></td>
<td class="r"><%= fmt_string(queue.messages_ready) %></td>
<td class="r"><%= fmt_string(queue.messages_unacknowledged) %></td>

View File

@ -152,6 +152,9 @@ resource(_, unknown) ->
resource(NameAs, #resource{name = Name, virtual_host = VHost}) ->
[{NameAs, Name}, {vhost, VHost}].
policy(none) -> [];
policy(Policy) -> [{policy, Policy}].
internal_user(User) ->
[{name, User#internal_user.username},
{password_hash, base64:encode(User#internal_user.password_hash)},
@ -255,7 +258,8 @@ url(Fmt, Vals) ->
exchange(X) ->
format(X, [{fun resource/1, [name]},
{fun amqp_table/1, [arguments]}]).
{fun amqp_table/1, [arguments]},
{fun policy/1, [policy]}]).
%% We get queues using rabbit_amqqueue:list/1 rather than :info_all/1 since
%% the latter wakes up each queue. Therefore we have a record rather than a
@ -275,8 +279,9 @@ queue(#amqqueue{name = Name,
{arguments, Arguments},
{pid, Pid},
{policy, rabbit_policy:name(Q)}],
[{fun resource/1, [name]},
{fun amqp_table/1, [arguments]}]).
[{fun resource/1, [name]},
{fun amqp_table/1, [arguments]},
{fun policy/1, [policy]}]).
%% We get bindings using rabbit_binding:list_*/1 rather than :info_all/1 since
%% there are no per-exchange / queue / etc variants for the latter. Therefore