Skip to content
This repository was archived by the owner on Nov 17, 2020. It is now read-only.

Display user-provided connection name, if any #172

Merged
merged 4 commits into from
Apr 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion priv/www/js/tmpl/connection.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1>Connection <b><%= fmt_string(connection.name) %></b><%= fmt_maybe_vhost(connection.vhost) %></h1>
<h1>Connection <%= fmt_string(connection.name) %> <%= fmt_maybe_vhost(connection.vhost) %></h1>

<div class="section">
<h2>Overview</h2>
Expand All @@ -13,6 +13,14 @@
<td><%= fmt_node(connection.node) %></td>
</tr>
<% } %>

<% if (connection.client_properties.connection_name) { %>
<tr>
<th>Client-provided name</th>
<td><%= fmt_string(connection.client_properties.connection_name) %></td>
</tr>
<% } %>

<tr>
<th>Username</th>
<td><%= fmt_string(connection.user) %></td>
Expand Down
8 changes: 7 additions & 1 deletion priv/www/js/tmpl/connections.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<% if (vhosts_interesting) { %>
<th><%= fmt_sort('Virtual host', 'vhost') %></th>
<% } %>
<th><%= fmt_sort('Name', 'name') %></th>
<th><%= fmt_sort('Name', 'client_properties.connection_name;name') %></th>
<% if (nodes_interesting) { %>
<th><%= fmt_sort('Node', 'node') %></th>
<% } %>
Expand Down Expand Up @@ -73,7 +73,13 @@
<% if (vhosts_interesting) { %>
<td><%= fmt_string(connection.vhost) %></td>
<% } %>
<% if(connection.client_properties.connection_name) { %>
<td><%= link_conn(connection.name) %>
<%= fmt_string(short_conn(connection.client_properties.connection_name)) %>
</td>
<% } else { %>
<td><%= link_conn(connection.name) %></td>
<% } %>
<% if (nodes_interesting) { %>
<td><%= fmt_node(connection.node) %></td>
<% } %>
Expand Down
2 changes: 2 additions & 0 deletions src/rabbit_mgmt_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ get_dotted_value0([Key], Item) ->
get_dotted_value0([Key | Keys], Item) ->
get_dotted_value0(Keys, pget_bin(list_to_binary(Key), Item, [])).

pget_bin(Key, {struct, List}, Default) ->
pget_bin(Key, List, Default);
pget_bin(Key, List, Default) ->
case lists:partition(fun ({K, _V}) -> a2b(K) =:= Key end, List) of
{[{_K, V}], _} -> V;
Expand Down