Merged bug 23376 into default
This commit is contained in:
commit
84b5b010ac
|
|
@ -53,8 +53,10 @@ function dispatcher() {
|
|||
|
||||
path('#/connections', {'connections': '/connections'}, 'connections');
|
||||
this.get('#/connections/:name', function() {
|
||||
render({'connection': '/connections/' + esc(this.params['name'])}, 'connection',
|
||||
'#/connections');
|
||||
var name = esc(this.params['name']);
|
||||
render({'connection': '/connections/' + name,
|
||||
'channels': '/connections/' + name + '/channels'},
|
||||
'connection', '#/connections');
|
||||
});
|
||||
this.del('#/connections', function() {
|
||||
if (sync_delete(this, '/connections/:name'))
|
||||
|
|
|
|||
|
|
@ -0,0 +1,85 @@
|
|||
<% if (channels.length > 0) { %>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<% if (mode == 'standalone') { %>
|
||||
<th colspan="5">Details</th>
|
||||
<% } else { %>
|
||||
<th colspan="3">Details</th>
|
||||
<% } %>
|
||||
<% if (statistics_level == 'fine') { %>
|
||||
<th colspan="6">Message rates</th>
|
||||
<% } %>
|
||||
</tr>
|
||||
<tr>
|
||||
<% if (mode == 'standalone') { %>
|
||||
<th><%= fmt_sort('Channel', 'name') %></th>
|
||||
<th><%= fmt_sort('Virtual host', 'vhost') %></th>
|
||||
<th><%= fmt_sort('User name', 'user') %></th>
|
||||
<th><%= fmt_sort('Transactional', 'transactional') %></th>
|
||||
<th><%= fmt_sort('Prefetch', 'prefetch_count') %></th>
|
||||
<th><%= fmt_sort('Message unacked', 'messages_unacknowledged') %></th>
|
||||
<% if (statistics_level == 'fine') { %>
|
||||
<th><%= fmt_sort('publish', 'message_stats.publish_details.rate') %></th>
|
||||
<th><%= fmt_sort('deliver', 'message_stats.deliver_details.rate') %></th>
|
||||
<th><%= fmt_sort('get', 'message_stats.get_details.rate') %></th>
|
||||
<th><%= fmt_sort('deliver<sub>(noack)</sub>', 'message_stats.deliver_no_ack_details.rate') %></th>
|
||||
<th><%= fmt_sort('get<sub>(noack)</sub>', 'message_stats.get_no_ack_details.rate') %></th>
|
||||
<th><%= fmt_sort('ack', 'message_stats.ack_details.rate') %></th>
|
||||
<% } %>
|
||||
<% } else { %>
|
||||
<!-- TODO make sortable after bug 23401 -->
|
||||
<th>Channel</th>
|
||||
<th>Transactional</th>
|
||||
<th>Prefetch</th>
|
||||
<th>Message unacked</th>
|
||||
<% if (statistics_level == 'fine') { %>
|
||||
<th>publish</th>
|
||||
<th>deliver</th>
|
||||
<th>get</th>
|
||||
<th>deliver<sub>(noack)</sub></th>
|
||||
<th>get<sub>(noack)</sub></th>
|
||||
<th>ack</th>
|
||||
<% } %>
|
||||
<% } %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
for (var i = 0; i < channels.length; i++) {
|
||||
var channel = channels[i];
|
||||
%>
|
||||
<tr<%= alt_rows(i)%>>
|
||||
<td>
|
||||
<%= link_channel(channel.name) %>
|
||||
</td>
|
||||
<% if (mode == 'standalone') { %>
|
||||
<td class="c"><%= link_vhost(channel.vhost) %></td>
|
||||
<td class="c"><%= link_user(channel.user) %></td>
|
||||
<% } %>
|
||||
<td class="c">
|
||||
<%= fmt_boolean(channel.transactional) %>
|
||||
<% if (channel.transactional) { %>
|
||||
<sub><%= channel.acks_uncommitted %> uncommitted acks</sub>
|
||||
<% } %>
|
||||
</td>
|
||||
<td class="c"><%= channel.prefetch_count %></td>
|
||||
<td class="c"><%= channel.messages_unacknowledged %></td>
|
||||
<% if (statistics_level == 'fine') { %>
|
||||
<td class="l"><%= fmt_rate(channel.message_stats, 'publish') %></td>
|
||||
<td class="l"><%= fmt_rate(channel.message_stats, 'deliver') %></td>
|
||||
<td class="l"><%= fmt_rate(channel.message_stats, 'get') %></td>
|
||||
<td class="l"><%= fmt_rate(channel.message_stats, 'deliver_no_ack') %></td>
|
||||
<td class="l"><%= fmt_rate(channel.message_stats, 'get_no_ack') %></td>
|
||||
<td class="l">
|
||||
<%= fmt_rate(channel.message_stats, 'ack') %>
|
||||
</td>
|
||||
<% } %>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% } else { %>
|
||||
<p>... no channels ...</p>
|
||||
<% } %>
|
||||
|
|
@ -1,67 +1,5 @@
|
|||
<h1>Channels</h1>
|
||||
<%= maybe_truncate(channels) %>
|
||||
<div class="updatable">
|
||||
<% if (channels.length > 0) { %>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th colspan="5">Details</th>
|
||||
<% if (statistics_level == 'fine') { %>
|
||||
<th colspan="6">Message rates</th>
|
||||
<% } %>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><%= fmt_sort('Channel', 'name') %></th>
|
||||
<th><%= fmt_sort('Virtual host', 'vhost') %></th>
|
||||
<th><%= fmt_sort('User name', 'user') %></th>
|
||||
<th><%= fmt_sort('Transactional', 'transactional') %></th>
|
||||
<th><%= fmt_sort('Prefetch', 'prefetch_count') %></th>
|
||||
<th><%= fmt_sort('Message unacked', 'messages_unacknowledged') %></th>
|
||||
<% if (statistics_level == 'fine') { %>
|
||||
<th><%= fmt_sort('publish', 'message_stats.publish_details.rate') %></th>
|
||||
<th><%= fmt_sort('deliver', 'message_stats.deliver_details.rate') %></th>
|
||||
<th><%= fmt_sort('get', 'message_stats.get_details.rate') %></th>
|
||||
<th><%= fmt_sort('deliver<sub>(noack)</sub>', 'message_stats.deliver_no_ack_details.rate') %></th>
|
||||
<th><%= fmt_sort('get<sub>(noack)</sub>', 'message_stats.get_no_ack_details.rate') %></th>
|
||||
<th><%= fmt_sort('ack', 'message_stats.ack_details.rate') %></th>
|
||||
<% } %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
for (var i = 0; i < channels.length; i++) {
|
||||
var channel = channels[i];
|
||||
%>
|
||||
<tr<%= alt_rows(i)%>>
|
||||
<td>
|
||||
<%= link_channel(channel.name) %>
|
||||
</td>
|
||||
<td class="c"><%= link_vhost(channel.vhost) %></td>
|
||||
<td class="c"><%= link_user(channel.user) %></td>
|
||||
<td class="c">
|
||||
<%= fmt_boolean(channel.transactional) %>
|
||||
<% if (channel.transactional) { %>
|
||||
<sub><%= channel.acks_uncommitted %> uncommitted acks</sub>
|
||||
<% } %>
|
||||
</td>
|
||||
<td class="c"><%= channel.prefetch_count %></td>
|
||||
<td class="c"><%= channel.messages_unacknowledged %></td>
|
||||
<% if (statistics_level == 'fine') { %>
|
||||
<td class="l"><%= fmt_rate(channel.message_stats, 'publish') %></td>
|
||||
<td class="l"><%= fmt_rate(channel.message_stats, 'deliver') %></td>
|
||||
<td class="l"><%= fmt_rate(channel.message_stats, 'get') %></td>
|
||||
<td class="l"><%= fmt_rate(channel.message_stats, 'deliver_no_ack') %></td>
|
||||
<td class="l"><%= fmt_rate(channel.message_stats, 'get_no_ack') %></td>
|
||||
<td class="l">
|
||||
<%= fmt_rate(channel.message_stats, 'ack') %>
|
||||
</td>
|
||||
<% } %>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% } else { %>
|
||||
<p>... no channels ...</p>
|
||||
<% } %>
|
||||
<%= format('channels-list', {'channels': channels, 'mode': 'standalone'}) %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,13 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Channels</h2>
|
||||
<div class="updatable">
|
||||
<%= format('channels-list', {'channels': channels, 'mode': 'connection'}) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-hidden">
|
||||
<h2>Client Library</h2>
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ dispatcher() ->
|
|||
{["all-configuration"], rabbit_mgmt_wm_all_configuration, []},
|
||||
{["connections"], rabbit_mgmt_wm_connections, []},
|
||||
{["connections", connection], rabbit_mgmt_wm_connection, []},
|
||||
{["connections", connection, "channels"], rabbit_mgmt_wm_connection_channels, []},
|
||||
{["channels"], rabbit_mgmt_wm_channels, []},
|
||||
{["channels", channel], rabbit_mgmt_wm_channel, []},
|
||||
{["exchanges"], rabbit_mgmt_wm_exchanges, []},
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
-module(rabbit_mgmt_wm_connection).
|
||||
|
||||
-export([init/1, resource_exists/2, to_json/2, content_types_provided/2,
|
||||
is_authorized/2, allowed_methods/2, delete_resource/2]).
|
||||
is_authorized/2, allowed_methods/2, delete_resource/2, conn/1]).
|
||||
|
||||
-include("rabbit_mgmt.hrl").
|
||||
-include_lib("webmachine/include/webmachine.hrl").
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
%% The contents of this file are subject to the Mozilla Public License
|
||||
%% Version 1.1 (the "License"); you may not use this file except in
|
||||
%% compliance with the License. You may obtain a copy of the License at
|
||||
%% http://www.mozilla.org/MPL/
|
||||
%%
|
||||
%% Software distributed under the License is distributed on an "AS IS"
|
||||
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
%% License for the specific language governing rights and limitations
|
||||
%% under the License.
|
||||
%%
|
||||
%% The Original Code is RabbitMQ Management Console.
|
||||
%%
|
||||
%% The Initial Developers of the Original Code are Rabbit Technologies Ltd.
|
||||
%%
|
||||
%% Copyright (C) 2010 Rabbit Technologies Ltd.
|
||||
%%
|
||||
%% All Rights Reserved.
|
||||
%%
|
||||
%% Contributor(s): ______________________________________.
|
||||
%%
|
||||
-module(rabbit_mgmt_wm_connection_channels).
|
||||
|
||||
-export([init/1, to_json/2, content_types_provided/2, is_authorized/2]).
|
||||
-export([resource_exists/2]).
|
||||
|
||||
-include("rabbit_mgmt.hrl").
|
||||
-include_lib("webmachine/include/webmachine.hrl").
|
||||
-include_lib("rabbit_common/include/rabbit.hrl").
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
init(_Config) -> {ok, #context{}}.
|
||||
|
||||
content_types_provided(ReqData, Context) ->
|
||||
{[{"application/json", to_json}], ReqData, Context}.
|
||||
|
||||
resource_exists(ReqData, Context) ->
|
||||
case rabbit_mgmt_wm_connection:conn(ReqData) of
|
||||
error -> {false, ReqData, Context};
|
||||
_Conn -> {true, ReqData, Context}
|
||||
end.
|
||||
|
||||
to_json(ReqData, Context) ->
|
||||
Name = proplists:get_value(name, rabbit_mgmt_wm_connection:conn(ReqData)),
|
||||
Chs = rabbit_mgmt_util:filter_user(
|
||||
[Ch || Ch <- rabbit_mgmt_db:get_channels(), conn_name(Ch) =:= Name],
|
||||
ReqData, Context),
|
||||
rabbit_mgmt_util:reply_list(Chs, ReqData, Context).
|
||||
|
||||
is_authorized(ReqData, Context) ->
|
||||
rabbit_mgmt_util:is_authorized(ReqData, Context).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
conn_name(Ch) ->
|
||||
proplists:get_value(name, proplists:get_value(connection_details, Ch)).
|
||||
Loading…
Reference in New Issue