Переглянути джерело

fix: clients api node params

DDDHuang 4 роки тому
батько
коміт
32a84b3aba
1 змінених файлів з 9 додано та 2 видалено
  1. 9 2
      apps/emqx_management/src/emqx_mgmt_api_clients.erl

+ 9 - 2
apps/emqx_management/src/emqx_mgmt_api_clients.erl

@@ -514,8 +514,15 @@ subscriptions(get, Request) ->
 %% api apply
 %% api apply
 
 
 list(Params) ->
 list(Params) ->
-    Response = emqx_mgmt_api:cluster_query(Params, ?CLIENT_QS_SCHEMA, ?query_fun),
-    {200, Response}.
+    case proplists:get_value(<<"node">>, Params, undefined) of
+        undefined ->
+            Response = emqx_mgmt_api:cluster_query(Params, ?CLIENT_QS_SCHEMA, ?query_fun),
+            {200, Response};
+        Node1 ->
+            Node = binary_to_atom(Node1, utf8),
+            Response = emqx_mgmt_api:node_query(Node, proplists:delete(<<"node">>, Params), ?CLIENT_QS_SCHEMA, ?query_fun),
+            {200, Response}
+    end.
 
 
 lookup(#{clientid := ClientID}) ->
 lookup(#{clientid := ClientID}) ->
     case emqx_mgmt:lookup_client({clientid, ClientID}, ?format_fun) of
     case emqx_mgmt:lookup_client({clientid, ClientID}, ?format_fun) of