Sooner or later someone will ask us: "How do I know which version of the server I'm talking to?"

This commit is contained in:
Simon MacMullen 2010-09-14 16:05:23 +01:00
parent 165a1de0d7
commit 85f2405f7d
5 changed files with 74 additions and 2 deletions

View File

@ -18,7 +18,7 @@ function dispatcher() {
render(r, t, p);
});
}
path('#/', {'overview': '/overview'}, 'overview');
path('#/', {'overview': '/overview', 'applications': '/applications'}, 'overview');
path('#/connections', {'connections': '/connections/'}, 'connections');
this.get('#/connections/:name', function() {

View File

@ -57,6 +57,29 @@
</div>
</div>
<div class="section-hidden">
<h2>Applications</h2>
<div>
<table class="list">
<thead>
<tr>
<th>Name</th>
<th>Version</th>
</tr>
</thead>
<tbody>
<% for (var i = 0; i < applications.length; i++) { %>
<tr<%= alt_rows(i)%>>
<td><abbr title="<%= applications[i].description %>"><%= applications[i].name %></abbr></td>
<td><%= applications[i].version %></td>
</tr>
<% } %>
</tbody>
</table>
<span class="br"></span>
</div>
</div>
<% if (overview.statistics_level != 'fine') { %>
<div class="section-hidden">
<h2>Message Rates Disabled</h2>

View File

@ -25,6 +25,7 @@
dispatcher() ->
[{[], rabbit_mgmt_wm_help, []},
{["overview"], rabbit_mgmt_wm_overview, []},
{["applications"], rabbit_mgmt_wm_applications, []},
{["connections"], rabbit_mgmt_wm_connections, []},
{["connections", connection], rabbit_mgmt_wm_connection, []},
{["channels"], rabbit_mgmt_wm_channels, []},

View File

@ -22,7 +22,7 @@
-export([format/2, print/2, pid/1, ip/1, table/1, tuple/1, timestamp/1]).
-export([protocol/1, resource/1, permissions/1, user_permissions/1]).
-export([exchange/1, user/1, binding/1, pack_props/2, url/2]).
-export([exchange/1, user/1, binding/1, pack_props/2, url/2, application/1]).
-include_lib("rabbit_common/include/rabbit.hrl").
@ -126,3 +126,8 @@ pack_props(Key, _Args) ->
url(Fmt, Vals) ->
print(Fmt, [mochiweb_util:quote_plus(V) || V <- Vals]).
application({Application, Description, Version}) ->
[{name, Application},
{description, list_to_binary(Description)},
{version, list_to_binary(Version)}].

View File

@ -0,0 +1,43 @@
%% 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_applications).
-export([init/1, to_json/2, content_types_provided/2, is_authorized/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}.
to_json(ReqData, Context) ->
rabbit_mgmt_util:reply(
[rabbit_mgmt_format:application(A) ||
A <- application:which_applications()],
ReqData, Context).
is_authorized(ReqData, Context) ->
rabbit_mgmt_util:is_authorized(ReqData, Context).