Fix Dashboard not showing data

This commit is contained in:
turtled 2017-10-09 18:08:46 +08:00
parent 88c77cf4c2
commit 54534967bd
2 changed files with 8 additions and 5 deletions

View File

@ -59,8 +59,10 @@ handle_request(Req, State) ->
inner_handle_request(Req, State) ->
Path = Req:get(path),
handle_request(Path, Req, State).
case Path of
"/api/v2/auth" -> handle_request(Path, Req, State);
_ -> if_authorized(Req, fun() -> handle_request(Path, Req, State) end)
end.
handle_request("/api/v2/" ++ Url, Req, #state{dispatch = Dispatch}) ->
Dispatch(Req, Url);

View File

@ -212,9 +212,10 @@ session_list('GET', Params, Node, ClientId) ->
{ok, [{objects, [session_row(Row) || Row <- Data]}]}.
session_row({ClientId, _Pid, _Persistent, Session}) ->
InfoKeys = [clean_sess, max_inflight, inflight_queue, message_queue,
message_dropped, awaiting_rel, awaiting_ack, awaiting_comp, created_at],
[{client_id, ClientId} | [{Key, format(Key, get_value(Key, Session))} || Key <- InfoKeys]].
Data = lists:append(Session, emqttd_stats:get_session_stats(ClientId)),
InfoKeys = [clean_sess, subscriptions, max_inflight, inflight_len, mqueue_len,
mqueue_dropped, awaiting_rel_len, deliver_msg,enqueue_msg, created_at],
[{client_id, ClientId} | [{Key, format(Key, get_value(Key, Data))} || Key <- InfoKeys]].
%%--------------------------------------------------------------------------
%% subscription